Skip to content

Add CIF->PXRD calculator and refactor XRD block to better show multiple patterns #1128

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

Merged
merged 9 commits into from
May 23, 2025

Conversation

ml-evs
Copy link
Member

@ml-evs ml-evs commented Apr 16, 2025

Closes #1120 by adding a matador-based PXRD calculator for CIF files.

Bonus: record peak information in database where possible, and update FileSelectDropdown to allow for "All compatible files" option to be turned on.

Copy link

codecov bot commented Apr 16, 2025

Codecov Report

Attention: Patch coverage is 58.90411% with 30 lines in your changes missing coverage. Please review.

Project coverage is 71.58%. Comparing base (46130d9) to head (41766cf).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pydatalab/src/pydatalab/apps/xrd/blocks.py 48.21% 29 Missing ⚠️
pydatalab/src/pydatalab/apps/xrd/utils.py 90.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1128      +/-   ##
==========================================
+ Coverage   71.41%   71.58%   +0.16%     
==========================================
  Files          66       66              
  Lines        4440     4469      +29     
==========================================
+ Hits         3171     3199      +28     
- Misses       1269     1270       +1     
Files with missing lines Coverage Δ
pydatalab/src/pydatalab/apps/xrd/models.py 100.00% <100.00%> (+100.00%) ⬆️
pydatalab/src/pydatalab/file_utils.py 38.83% <ø> (ø)
pydatalab/src/pydatalab/apps/xrd/utils.py 60.43% <90.00%> (+3.64%) ⬆️
pydatalab/src/pydatalab/apps/xrd/blocks.py 62.67% <48.21%> (-7.60%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

cypress bot commented Apr 16, 2025

datalab    Run #3400

Run Properties:  status check passed Passed #3400  •  git commit f75dc936e9 ℹ️: Merge 41766cfcbcd9dbf542f7be5d65c6a6893c540a8a into 46130d9df9ef70ba8117bd29d14d...
Project datalab
Branch Review ml-evs/simple-cif-xrd-plots
Run status status check passed Passed #3400
Run duration 10m 12s
Commit git commit f75dc936e9 ℹ️: Merge 41766cfcbcd9dbf542f7be5d65c6a6893c540a8a into 46130d9df9ef70ba8117bd29d14d...
Committer Matthew Evans
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 504
View all changes introduced in this branch ↗︎

@ml-evs ml-evs force-pushed the ml-evs/simple-cif-xrd-plots branch from 4615c2c to 05b36e9 Compare April 17, 2025 16:33
@ml-evs
Copy link
Member Author

ml-evs commented Apr 17, 2025

Note to self: expose raw data in this PR

@ml-evs ml-evs force-pushed the ml-evs/simple-cif-xrd-plots branch from 05b36e9 to 6ef5786 Compare April 23, 2025 22:53
@ml-evs ml-evs added this to the v0.5.x milestone Apr 25, 2025
@ml-evs ml-evs force-pushed the ml-evs/simple-cif-xrd-plots branch from 6ef5786 to 2f28150 Compare April 25, 2025 18:18
@ml-evs
Copy link
Member Author

ml-evs commented Apr 25, 2025

Note to self: expose raw data in this PR

Actually going to push this back to a later PR so that we can avoid holding this up

@ml-evs ml-evs force-pushed the ml-evs/simple-cif-xrd-plots branch from 2f28150 to 1ca9917 Compare April 25, 2025 19:57
@jdbocarsly
Copy link
Member

Seems to work for me! We can iterate on the UX with ability to turn on/off patterns, offset them, display ticks etc. But its a really useful thing to have in there.

When choosing all files, a warning comes up (even though it plots fine). Also, the second warning is very frequently on our data sets since they have points at 0 and the log calculation throws the warning. Can you suppress that? It gets annoying.
Screenshot 2025-04-28 at 11 14 54 PM

@ml-evs ml-evs force-pushed the ml-evs/simple-cif-xrd-plots branch from 1ca9917 to fd5cf40 Compare April 29, 2025 12:34
@ml-evs ml-evs modified the milestones: v0.5.x, v0.6.x May 20, 2025
@ml-evs ml-evs force-pushed the ml-evs/simple-cif-xrd-plots branch from fd5cf40 to 41766cf Compare May 23, 2025 20:39
@ml-evs
Copy link
Member Author

ml-evs commented May 23, 2025

Seems to work for me! We can iterate on the UX with ability to turn on/off patterns, offset them, display ticks etc. But its a really useful thing to have in there.

When choosing all files, a warning comes up (even though it plots fine). Also, the second warning is very frequently on our data sets since they have points at 0 and the log calculation throws the warning. Can you suppress that? It gets annoying.

Resolved the warnings now, will merge.

You can already turn patterns on/off by clicking them in the legend, and offsetting can be done using the "normalized intensity (staggered)" y_option, though might not be perfect.

The main drawback here is that it will try to read every file attached to an item as an XRD pattern when you select "all compatible files". Fixed eventually by adding some kind of multiselect, and allowing multiple files to be attached/uploaded to a single block -- think this is a reasonable point to merge and iterate on it for the next version though.

@ml-evs ml-evs added enhancement New feature or request datablock An issue pertaining to a specific datablock labels May 23, 2025
@ml-evs
Copy link
Member Author

ml-evs commented May 23, 2025

Not totally awful if you limit it to a few patterns:

2025-05-23-214621_740x620_scrot

Think we need to think generally about making better use of space for plots like this though (see if we can't make the plot resizable), and use the whitespace outside for things like the legend.

@ml-evs ml-evs merged commit 9952fb4 into main May 23, 2025
17 checks passed
@ml-evs ml-evs deleted the ml-evs/simple-cif-xrd-plots branch May 23, 2025 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datablock An issue pertaining to a specific datablock enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to upload CIF references to XRD block
2 participants