plot_2D_image example file visualize() AttributeError

55 views
Skip to first unread message

Bradley Sutliff

unread,
May 12, 2021, 9:52:39 PM5/12/21
to pycroscopy
Hello!

I'm fairly new to this module and have been trying to read the docs to figure things out, but I'm having a lot of issues with dead links to notebooks and such. One of the few I could find is the plot_2D_image.ipynb (also here), but it fails at step 6 when running:

h5_main.visualize(num_ticks=5)

and gives 

AttributeError: can't set attribute 

(see attached image for more details).
I've also tried removing the usid.plot_utils.use_nice_plot_params() since I get a future warning every time I import pyUSID, but that didn't help.
The alternative plot_2D_image.py file also fails with the same error in spyder.

I'm running on Windows 10 with the following versions:
pyUSID: 0.0.10 
pycroscopy: 0.60.8
python: 3.8.5

Thank you for the help!
Brad

P.S.
This also might not be the place, but if the slack is active, I'd love an invite.
error_message.PNG

Rajiv Giridharagopal

unread,
May 13, 2021, 8:00:53 PM5/13/21
to pycroscopy
Hi Brad,
 Sorry for the delayed answer! The Slack isn't active, last I checked. As for pycroscopy, you're catching the package in the middle of a big transition so I think a lot of the old notebooks won't be working any more. But I think that command should work-- can you try without num_ticks and see if that functions?

Also, if you don't mind me asking, what are you interested in applying pyUSID towards? It's nice to see what other folks are up to, that's why I'm asking, and it might help better inform how to move forward with your data. 

Best,
Raj

suhas....@gmail.com

unread,
May 13, 2021, 8:46:42 PM5/13/21
to pycroscopy
@Raj thanks for jumping in

@Brad - I will look into the documentation on USID tomorrow. It needs to be updated. 

I would encourage you to get an overview of our ecosystem here - https://pycroscopy.github.io/pycroscopy/ecosystem.html if you are new.

As Raj says, It would be great to learn about your needs and use-case. 

Looking forward to hearing from you 

Bradley Sutliff

unread,
May 14, 2021, 2:40:27 PM5/14/21
to pycroscopy
Hi Raj and Suhas,

Thanks for the quick responses! I'll look into the ecosystem more, but yes I think I discovered this package at a bad time haha. The link to the poster on that page is dead by the way, but I found a copy from digging around on the github. I will say that the other image on that page might be a little confusing because it's not clear what the difference is between the pycroscopy ecosystem and the pycroscopy module.

In any case, removing the num_ticks argument doesn't help. I also tried adding in some try/except statements to handle the error and see if it happens with a certain value of scale since the traceback seems to indicate an error with:
item.values /= 10 ** scale
the error throws with scale = -9, but as I write this I'm wondering if the issue is with item or item.values and not scale...I'll play around with it until I hear from y'all again.

Finally, the main reason for using pycroscopy is that I want to use some image recognition to take AFM images of cellulose nanocrystals (CNCs), flatten them, identify single crystals, and characterize their length, width, and height. Ideally, all within a single notebook that can read in the Asylum AFM data (Igor .ibw files). Eventually, I'd love to do some XRD analysis and curve deconvolution from a Bruker XRD instrument, but that seems a little outside the scope of pycroscopy.

Thank you again for the help!
Brad

suhas....@gmail.com

unread,
May 14, 2021, 4:04:02 PM5/14/21
to pycroscopy
Brad,

Thanks for pointing out the broken link to the poster. I believe I have fixed it now. 
I am working on cleaning up and updating the USID documentation now.

Historically, pycroscopy used to be one giant package and the pycroscopy ecosystem was nothing but the pycroscopy package itself. Roughly about a year ago, we decided to break that package into several pieces, each focused on different goals. Given the popularity of the pycroscopy package, we have decided to re-imagine the package as the place for multidisciplinary and general science tools. Application specific packages have since migrated to dedicated packages. I guess we need to be clearer about the differences in our documentation and we will work on that too.

For your application, I would suggest using NSID instead of USID to represent your data since your data has a clear N-dimensional form. Either way, you should not need to understand every detail of NSID. Our package - SciFiReaders has a Reader capable of reading data and metadata out of Asylum .ibw files. This example points out how one can use a Reader. All you need are 2-3 lines to read the data and metadata. Once you have your data and metadata in memory as as sidpy.Dataset (think of it as a scientific version of a numpy array), you can feel free to process the data as you see fit. 

The prior iteration of the pycroscopy package (v. 0.60.8) had a translator for Bruker files (it would write data out into a USID formatted HDF5 file instead of giving you a sidpy.Dataset), but we have not migrated it to SciFiReaders yet since we have limited manpower and the majority of our users haven't requested for it. It would be nice to test this old Translator and convert it to a Reader in SciFiReaders. If you are interested in joining forces, we would be very happy to have you. We meet via weekly hackathons on Fridays between 3-5 PM (eastern). 

I hope this helps.

suhas....@gmail.com

unread,
May 17, 2021, 4:00:59 PM5/17/21
to pycroscopy
Brad, 

I have rebuilt and corrected the documentation for USID. Thank you for pointing out that the documentation was broken. As it turns out, a recent change within the pycroscopy ecosystem (Dimension is now a numpy.ndarray) had broken the visualize() function within pyUSID.USIDataset. I have pushed a fix for this on the master branch of pyUSID. In order to work through the examples on USID, you will need to uninstall the version of pyUSID you got from pip and install from GitHub:

pip uninstall pyUSID
Reply all
Reply to author
Forward
0 new messages