Skip to content

Conversation

@ConnieTTR
Copy link

What’s Broken

In 2025, Attolight updated several parameter names in the metadata. As a result, the original code in the Correction of acquisition defects section no longer functions correctly.
The broken line is:fov = cl.original_metadata.Object_0_Channel_0.Parsed.SITE_IMAGE.Field_of_view * 1e6
After runing the correction, the wavelength shift across different XY positions in the image is not fully compensated.

How to Fix

This version updates the definition of fov passed to the correct_grating_shift function after checking the code in the function
fov = cl.original_metadata.Object_0_Channel_0.Parsed.SEM.Real_Magnification
fov now references Real_Magnification from the SEM original metadata instead of the old Field_of_view.

Example Map Test

A test dataset with the new metadata format (with quite large field of view) has been included in demo-files/load_from_AttoLightSEM_2025New.
Original version of code fails on this dataset while the updated code for acquisition defects correction successfully removes peak shifts across the image. The result of which is shown below:
test_output

@github-actions
Copy link

Binder 👈 Launch a binder notebook on branch ConnieTTR/lumispy-demos/fix-demo-bug-add-testdata

@jlaehne
Copy link
Collaborator

jlaehne commented Nov 24, 2025

Thanks @ConnieTTR - do I see it right that this Notebook replicates the existing Attolight one, with just a new dataset and adapted only in a small part to account for this change in metadata? For maintainability, I would try to avoid having largely overlapping demo notebooks.

Would it make sense to either

  • Completely replace the existing one (though some people might want to work with older data still?)
  • Combine the two datasets in a single notebook, but only replicate the cells where they deviate with appropriate comments (the loading and the one calling the correction function)

Also, I realize that (both) the attolight demo files are fairly large (All the other demo files we have included are < 20 MB). Bandwidth is not such a big bottleneck anymore nowadays, but usually it is still nice to avoid overly large datasets (e.g. if someone wants to use them at a conference demo). I realize you need the large field of view, but I guess it would be sufficient to have overall less points with a larger spacing - so either a rebinned dataset or one recorded specifically with a coarser grid?

@ConnieTTR
Copy link
Author

Thank you for the feedback @jlaehne!
You're right, this Notebook overlaps largely with the existing Attolight one with only a new dataset and small adaptations. I will combine the two into a single notebook, and only replicate the cells where they deviate. I will also rebin the new dataset uploaded and keep only the .sur file as the test data.
I hope this would make the notebook lighter and more manageable.

@ConnieTTR
Copy link
Author

The latest commit includes the updated Attolight demo notebook, where I incorporated the deviations and comments, along with the rebined dataset. I was able to reduce the size of new HYPCard.sur to 4 MB; however, HYPCard.bin remains approximately 16 MB. Since the .bin file is not used in the demo, please feel free to remove it.

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.

2 participants