Add patch for updated Attolight metadata with new version test dataset #24
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 * 1e6After 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_shiftfunction after checking the code in the functionfov = cl.original_metadata.Object_0_Channel_0.Parsed.SEM.Real_Magnificationfov 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: