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

Custom Scan .mrc #356

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Custom Scan .mrc #356

wants to merge 2 commits into from

Conversation

CSSFrancis
Copy link
Member

@CSSFrancis CSSFrancis commented Jan 16, 2025

Description of the change

Direct Electron allows for custom scan patterns/ non-linear distributed or serpentine scan patterns to be loaded. This is a nice feature, but sometimes it can be difficult to account for when loading data. Ultimately, the data is still locked to a grid, but no every pixel has to be scanned and the data is often not in the correct order.

Along with each .mrc file a scan_coordinates.csv file is also saved which is simply two columns with x, y scan positions. This file is likely to be updated in future with additional columns (time stamp, in situ information etc) but for now it should be relatively static.

Loading this type of data is a little tricky, but the core concept is that a fully dense array is created. If a scan position isn't scanned, it is set to all zeros and should be easy to ignore, mask etc. and it should compress down to almost nothing. Otherwise I could set those missing arrays to all nan but that would require casting from int to float which I would rather not do.

Progress of the PR

  • Add loading custom scans
  • Zeros where no scan is
  • update docstring (if appropriate),
  • update user guide (if appropriate),
  • add a changelog entry in the upcoming_changes folder (see upcoming_changes/README.rst),
  • Check formatting of the changelog entry (and eventual user guide changes) in the docs/readthedocs.org:rosettasciio build of this PR (link in github checks)
  • add tests,
  • ready for review.

Minimal example of the bug fix or the new feature

s = hs.load("test_scan.mrc", scan_file="scan_coordinates.csv")

Copy link

codecov bot commented Jan 16, 2025

Codecov Report

Attention: Patch coverage is 41.81818% with 32 lines in your changes missing coverage. Please review.

Project coverage is 87.60%. Comparing base (85a2d9d) to head (dcabb3a).
Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
rsciio/utils/distributed.py 26.92% 17 Missing and 2 partials ⚠️
rsciio/mrc/_api.py 55.17% 11 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #356      +/-   ##
==========================================
- Coverage   87.84%   87.60%   -0.24%     
==========================================
  Files          85       85              
  Lines       11246    11289      +43     
  Branches     2084     2094      +10     
==========================================
+ Hits         9879     9890      +11     
- Misses        868      896      +28     
- Partials      499      503       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

1 participant