Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

correcting import of rectangular image array #4

Closed
wants to merge 9 commits into from

Conversation

jhellerstedt
Copy link
Contributor

Hi,

I've been dealing with a rectangular image file, 512x128 pixels. It seems that the convention for reshaping the raw bytes by the scan_pixels tuple from the header is mixed up? When I switched the nx and ny, it works perfectly on my image.

@underchemist
Copy link
Owner

hey just replying to say I'm looking at this finally.

I'm just going to write some test cases for differently sized grid inputs. It's very possible i mixed up the nx ny order, almost all my data is square!

@underchemist
Copy link
Owner

underchemist commented Dec 11, 2017

Just to clarify, how did you figure out that the nx ny order was mixed up? Are you plotting it with matplotlib's imshow?

The reason I'm asking is because imshow has an 'origin' parameter which defaults to 'upper' which flips all array images (i.e. scan data). The proper orientation that corresponds to what I view in the nanonis scan inspector is to use origin='lower' in my imshow call.

See https://stackoverflow.com/questions/14320159/matplotlib-imshow-data-rotated

If the nx ny issue is different can you explain it a bit more? or have a sample file that I can play with to see exactly how it's being loaded in with the read functions?

Thanks

@jhellerstedt
Copy link
Contributor Author

jhellerstedt commented Dec 11, 2017

I'm dealing with some 512x192 images, here's hopefully an sxm file that will reproduce the error:
https://www.dropbox.com/s/cn22o126ln9x6au/Ag111_TbPc2_830K_5min_072.sxm?dl=0
When I used nanonispy as-is, I'd get an image like this:
figure_1
Then after trying a lot of things (the origin thing is a protip, thanks), after switching your nx, ny convention I would get the "correct" answer:
figure_1-3

@jhellerstedt
Copy link
Contributor Author

PS the same solution (swapping nx/ ny) fixed the same problem with reading in a rectangular grid spectroscopy.

@angelo-peronio
Copy link

angelo-peronio commented Feb 15, 2018

Dear Yann-Sebastien,

thank you for nanonispy! It lets me enjoy more my research.

I support the merging of this pull request, in particular a6439b6 fixes #8, an issue I am facing in every .dat spectroscopy file I load.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants