Re: Your IDE's?

2019-08-16 Thread Pankaj Jangid
Ben Finney  writes:

> John Doe  writes:
>
>> What is your favorite Python IDE?
>
> Maybe the Atom editor will get there some day, though for now I hear
> many complaints that with many plug-ins active it's just too slow when
> doing the kind of complex tasks we expect of a programmer's editor like
> Vim or GNU Emacs.

I also use Emacs for all my coding requirements.

Atom will probably be abandonded now. Github is now acquired by
Microsoft and hence their is no point for them to run two similar
projects. The community might fork it though.

-- 
Pankaj
Planet Earth. 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Re: absolute path to a file

2019-08-16 Thread Paul St George

Thank you Manfred and Cameron!
I think the problem may lie within syntax rather than vocabulary. The 
code works in one place but not where I use it in my script*. Cameron’s 
suggestion works when I try


| print('test1:', os.path.realpath(bpy.data.filepath))|

This returns:
|/Users/Lion/Desktop/test8/tifftest8.blend|


BUT does not work with
| print('test2:',os.path.realpath(n.image.filepath))|

This returns only
|/image01.tif|


Here is my full script:
# starts

|import bpy||
||import os||
||from pathlib import Path ||
||
||texture_list = []||
||
||with open(os.path.splitext(bpy.data.filepath)[0] + ".txt", "w") as 
outstream:||

||
||
|| for obj in bpy.context.scene.objects:||
||    for s in obj.material_slots:||
||    if s.material and s.material.use_nodes:||
||    for n in s.material.node_tree.nodes:||
||    if n.type == 'TEX_IMAGE':||
||    texture_list += [n.image]||
||print(obj.name,'uses',n.image.name,'saved at',n.image.filepath, 'which 
is at', os.path.realpath(n.image.filepath), file=outstream)||


|# ends

Notes:
Chris, I only mention the extra leading slash on my Mac in case anyone 
wonders why it is there. Python puts it there to escape the following slash.
Perhaps I should also mention (in case it is relevant) that I am calling 
my script ‘texturescript.py’ from the Python console of Blender. I use:


|filename = "/Users/Lion/Desktop/test8/texturescript.py"||
||exec(compile(open(filename).read(), filename, 'exec'))|


* My original |os.path.abspath| also works (and doesn’t work) in these 
circumstances. As does Manfred’s: |Path('./myfile').resolve()|.


On 16/08/2019 05:44, Manfred Lotz wrote:

On Fri, 16 Aug 2019 09:00:38 +1000
Cameron Simpson  wrote:


On 15Aug2019 22:52, Manfred Lotz  wrote:

I did this:

>from pathlib import Path

abs_myfile = Path('./myfile').resolve()
which worked fine for me.

There is also os.path.realpath(filename) for this purpose. In modern
Python that also accepts a Pathlike object.

Thanks for this.

I changed my code to use your suggestion which seems to
be better for the situation where I used resolve() before.


--
Paul St George
http://www.paulstgeorge.com
http://www.devices-of-wonder.com

+44(0)7595 37 1302

--
https://mail.python.org/mailman/listinfo/python-list


Re: Re: absolute path to a file

2019-08-16 Thread Chris Angelico
On Sat, Aug 17, 2019 at 2:27 AM Paul St George  wrote:
> BUT does not work with
> | print('test2:',os.path.realpath(n.image.filepath))|
>
> This returns only
> |/image01.tif|
>
>
> Notes:
> Chris, I only mention the extra leading slash on my Mac in case anyone
> wonders why it is there. Python puts it there to escape the following slash.

I still don't understand what you mean by that, because there's no
concept of "escaping" with these slashes. It looks like you're
actually working with absolute paths (starting with the leading slash)
when you want to work with relative paths (NOT starting with a leading
slash). The double slash isn't "escaping" anything, to my knowledge,
and Python would not add it.

>From the look of things, you really are getting a valid absolute path
- "/image01.tif" is already absolute. It just isn't the path you want.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: absolute path to a file

2019-08-16 Thread Paul St George

On 16/08/2019 18:37, Chris Angelico wrote:

On Sat, Aug 17, 2019 at 2:27 AM Paul St George  wrote:

BUT does not work with
| print('test2:',os.path.realpath(n.image.filepath))|

This returns only
|/image01.tif|


Notes:
Chris, I only mention the extra leading slash on my Mac in case anyone
wonders why it is there. Python puts it there to escape the following slash.


I still don't understand what you mean by that, because there's no
concept of "escaping" with these slashes. It looks like you're
actually working with absolute paths (starting with the leading slash)
when you want to work with relative paths (NOT starting with a leading
slash). The double slash isn't "escaping" anything, to my knowledge,
and Python would not add it.

 From the look of things, you really are getting a valid absolute path
- "/image01.tif" is already absolute. It just isn't the path you want.

ChrisA



Yes, perhaps I am using the wrong terms. I want to find the path that 
looks like this:

/Users/Lion/Desktop/test8/image01.tif

With such a path, I can find the image file. I cannot find the file with 
only /image01.tif


It is safe to ignore what I said about the double forward slashes. I am 
not using these. I only observed their presence and made a guess at 
their meaning.


Paul

--
https://mail.python.org/mailman/listinfo/python-list


Re: absolute path to a file

2019-08-16 Thread Chris Angelico
On Sat, Aug 17, 2019 at 5:28 AM Paul St George  wrote:
>
> On 16/08/2019 18:37, Chris Angelico wrote:
> > On Sat, Aug 17, 2019 at 2:27 AM Paul St George  
> > wrote:
> >> BUT does not work with
> >> | print('test2:',os.path.realpath(n.image.filepath))|
> >>
> >> This returns only
> >> |/image01.tif|
> >>
> >>
> >> Notes:
> >> Chris, I only mention the extra leading slash on my Mac in case anyone
> >> wonders why it is there. Python puts it there to escape the following 
> >> slash.
> >
> > I still don't understand what you mean by that, because there's no
> > concept of "escaping" with these slashes. It looks like you're
> > actually working with absolute paths (starting with the leading slash)
> > when you want to work with relative paths (NOT starting with a leading
> > slash). The double slash isn't "escaping" anything, to my knowledge,
> > and Python would not add it.
> >
> >  From the look of things, you really are getting a valid absolute path
> > - "/image01.tif" is already absolute. It just isn't the path you want.
> >
> > ChrisA
> >
>
> Yes, perhaps I am using the wrong terms. I want to find the path that
> looks like this:
> /Users/Lion/Desktop/test8/image01.tif
>
> With such a path, I can find the image file. I cannot find the file with
> only /image01.tif
>
> It is safe to ignore what I said about the double forward slashes. I am
> not using these. I only observed their presence and made a guess at
> their meaning.
>

When your path starts with "/Users", that means the Users directory
which is found in the root directory of your hard drive. When your
path starts with "/image01.tif", that means that image01.tif needs to
be in the root directory. If that's not the case (which I highly
suspect), then you do NOT want a leading slash - just use
"image01.tif", which means the file should be in the *current*
directory.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


ANN: DIPY 1.0.0 - a historic release

2019-08-16 Thread Eleftherios Garyfallidis
We are excited to announce a new major and historic release of Diffusion
Imaging in Python (DIPY). DIPY 1.0.0 is out!

Please cite using the following DOI: 10.3389/fninf.2014.8


DIPY 1.0.0 (Monday, 5 August 2019)

This release received contributions from 17 developers (the full release
notes are at:
https://dipy.org/documentation/1.0.0./release_notes/release1.0/). Thank you
all for your contributions and feedback!

A new DIPY era is starting: this release is compatible with python 3.5+ and
breaks backward compatibility with 0.x.x. Please click here
 to check API changes
or look at the end of this email. The 0.16.x series will have extended
bug-fix-only support for Python 2.7 until June 2020.

Highlights of this release include:

   -

   Critical API changes 
   -

   New awesome website 
   -

   Large refactoring of tracking API
   -

   New denoising algorithm: MP-PCA
   -

   New Gibbs ringing removal
   -

   New interpolation module: dipy.core.interpolation
   -

   New reconstruction models: Mean Signal DKI, MTMS-CSD
   -

   Increased coordinate systems consistency
   -

   New object to manage safely tractography data: StatefulTractogram
   -

   New command line interface for downloading datasets: FetchFlow
   -

   Horizon updated, medical visualization interface powered by QuickBundlesX
   -

   Removed all deprecated functions and parameters
   -

   Removed compatibility with Python 2.7
   -

   Updated minimum dependencies version (Numpy, Scipy)
   -

   All tutorials updated to API changes and 3 new added
   -

   Large documentation update
   -

   Closed 289 issues and merged 98 pull requests

Note:

   -

   DIPY 0.16.x will be the last series to support python 2. The next
   release, DIPY 1.0,  will support python 3 only.



To upgrade or install  DIPY

Run the following command in your terminal:


pip install --upgrade dipy

or

conda install -c conda-forge dipy

This version of DIPY depends on nibabel (2.4.0+).

For visualization you need FURY (0.3.0+).

Questions or suggestions?



For any questions go to http://dipy.org, or send an e-mail to
[email protected] 

We also have an instant messaging service and chat room available at
https://gitter.im/nipy/dipy

On behalf of the DIPY developers,

Eleftherios Garyfallidis, Ariel Rokem, Serge Koudoro

https://dipy.org/contributors

API Changes

Some of the changes introduced in the 1.0 release will break backwards
compatibility with previous versions. This release is compatible with
Python 3.5+

Reconstruction

The spherical harmonics bases mrtrix and fibernav have been renamed to
tournier07 and descoteaux07 after the deprecation cycle started in the 0.15
release.

We changed dipy.data.default_sphere from symmetric724 to repulsion724 which
is more evenly distributed.

Segmentation

The API of dipy.segment.mask.median_otsu has changed in the following ways:
if you are providing a 4D volume, vol_idx is now a required argument. The
order of parameters has also changed.

Tractogram loading and saving

The API of dipy.io.streamlines.load_tractogram and
dipy.io.streamlines.save_tractogram has changed in the following ways: When
loading trk, tck, vtk, fib, or dpy) a reference nifti file is needed to
guarantee proper spatial transformation handling.

Spatial transformation handling

Functions from dipy.tracking.streamlines were modified to enforce the
affine parameter and uniform docstrings. deform_streamlines select_by_rois,
orient_by_rois, _extract_vals and values_from_volume.

Functions from dipy.tracking.utils were modified to enforce the affine
parameter and uniform docstring. density_map connectivity_matrix,
seeds_from_mask, random_seeds_from_mask, target, target_line_based, near_roi,
length and path_length were all modified.

The function affine_for_trackvis, move_streamlines, flexi_tvis_affine and
get_flexi_tvis_affine were deleted.

Functions from dipy.tracking.life were modified to enforce the affine
parameter and uniform docstring. voxel2streamline, setup and fit from class
FiberModel were all modified.

afq_profile from dipy.stats.analysis was modified in a similar way.

Simulations

   -

   dipy.sims.voxel.SingleTensor has been replaced by
   dipy.sims.voxel.single_tensor
   -

   dipy.sims.voxel.MultiTensor has been replaced by
   dipy.sims.voxel.multi_tensor
   -

   dipy.sims.voxel.SticksAndBall has been replaced by
   dipy.sims.voxel.sticks_and_ball

Interpolation

All interpolation functions have been moved to a new module name
dipy.core.interpolation

Tracking

The voxel_size parameter has been removed from the following function:

   -

   dipy.tracking.utils.connectivity_matrix
   -

   dipy.tracking.utils.density_map
   -

   dipy.tracking.utils.stremline_mapping
   -

   dipy.tracking._util

Re: absolute path to a file

2019-08-16 Thread Gregory Ewing

On Sat, Aug 17, 2019 at 2:27 AM Paul St George  wrote:


BUT does not work with
| print('test2:',os.path.realpath(n.image.filepath))|

This returns only
|/image01.tif|


What does n.image.filepath look like on its own? If it starts
with a leading slash, then os.path.realpath will think it's
already an absolute path and leave it alone.

The problem then is why it's getting a leading slash in the
first place. It looks like the result of something naively
trying to append a filename to an empty directory path.

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list


Re: Your IDE's?

2019-08-16 Thread Abdur-Rahmaan Janhangeer
XD John Doe, seems like an anonymous survey.

I use sublime text, with linter + anaconda exec when needed. It also has an
in-built run mode if you want to use it. The main advantage for me is that
it is light. I used many IDEs before settling on this one.

Abdur-Rahmaan Janhangeer
http://www.pythonmembers.club | https://github.com/Abdur-rahmaanJ
Mauritius
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Your IDE's?

2019-08-16 Thread Hongyi Zhao
On Fri, 16 Aug 2019 16:10:51 -0700, Paul Rubin wrote:

> Does Microsoft have another product that is similar to Atom?  What is
> it?
> Just wondering.  I use Emacs myself.

vscode:
https://code.visualstudio.com/
-- 
https://mail.python.org/mailman/listinfo/python-list