Skip to content

UV-vis block #1133

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 12 commits into from
May 2, 2025
Merged

UV-vis block #1133

merged 12 commits into from
May 2, 2025

Conversation

be-smith
Copy link
Contributor

Added a block for plotting UV-Vis data. Currently works on .Raw8.txt files from the grey group UV-Vis spectrometer. Requires two files minimum for plotting, a reference file and the sample file - but multiple samples can be plotted at the same time if more than two files are supplied.

Absorbance is calculated using the standard approach, where I0 is the reference intensity and I the sample intensity.
A = log(I0/I)

Included is a vue component for selecting and ordering multiple files - could be useful for other blocks (Like echem if files need to be stitched together)

Screenshot 2025-04-18 at 18 50 52

Feedback on this component specifically would be nice - was a bit of a vibe coding session.

Example data not uploaded yet as waiting on permission from the owner.

Copy link

cypress bot commented Apr 18, 2025

datalab    Run #3239

Run Properties:  status check passed Passed #3239  •  git commit 56d9b230f3 ℹ️: Merge b53660790b3ae25b64e56a6d52ac035bfc694743 into c8b31c35dd40821fc3dfdbf12f98...
Project datalab
Branch Review bes/uv-vis-block
Run status status check passed Passed #3239
Run duration 07m 53s
Commit git commit 56d9b230f3 ℹ️: Merge b53660790b3ae25b64e56a6d52ac035bfc694743 into c8b31c35dd40821fc3dfdbf12f98...
Committer Ben Smith
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 501
View all changes introduced in this branch ↗︎

Copy link

codecov bot commented Apr 22, 2025

Codecov Report

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

Project coverage is 71.19%. Comparing base (c8b31c3) to head (b536607).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pydatalab/src/pydatalab/apps/uvvis/__init__.py 54.92% 32 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1133      +/-   ##
==========================================
- Coverage   71.45%   71.19%   -0.26%     
==========================================
  Files          63       64       +1     
  Lines        4162     4236      +74     
==========================================
+ Hits         2974     3016      +42     
- Misses       1188     1220      +32     
Files with missing lines Coverage Δ
pydatalab/src/pydatalab/blocks/__init__.py 96.29% <100.00%> (+0.14%) ⬆️
pydatalab/src/pydatalab/bokeh_plots.py 81.81% <100.00%> (+0.15%) ⬆️
pydatalab/src/pydatalab/apps/uvvis/__init__.py 54.92% <54.92%> (ø)
🚀 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.

@be-smith be-smith marked this pull request as ready for review April 23, 2025 14:04
@ml-evs ml-evs changed the title Bes/uv vis block UV-vis block Apr 23, 2025
@ml-evs ml-evs added enhancement New feature or request datablock An issue pertaining to a specific datablock labels Apr 23, 2025
Copy link
Member

@ml-evs ml-evs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some initial comments on the Python side, will try out the full block soon!

@be-smith
Copy link
Contributor Author

So I have changed the extensions for the block to Raw8.txt

Dealing with multiple suffixes is a bit janky, the following seems to work but has to be called often in the code or in tests as far as I can tell to deal with upper and lower cases matching. This is robust for if there is only one extension like .txt - so could be the standard going forwards. Let me know if there is a better way of doing this!

ext = "".join(Path(file["location"]).suffixes).lower()
if ext not in {ext.lower() for ext in self.accepted_file_extensions}:
do something

@ml-evs ml-evs added this to the v0.5.x milestone Apr 25, 2025
@ml-evs ml-evs force-pushed the bes/uv-vis-block branch from 66e6c89 to 687cda7 Compare April 30, 2025 14:34
@ml-evs ml-evs force-pushed the bes/uv-vis-block branch from 687cda7 to b536607 Compare April 30, 2025 22:59
Copy link
Member

@ml-evs ml-evs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good from my side now, thanks @be-smith! I'm just going to ask that @BenjaminCharmes tries it out and reviews the JS multi-select more finely before we merge.

Copy link
Contributor

@BenjaminCharmes BenjaminCharmes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't remove this comment, wanted to approve!

Copy link
Contributor

@BenjaminCharmes BenjaminCharmes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, everything works very well 👌

Maybe just a comment on CSS: a few classes are useless because they are already bootstrap classes: .active, .disabled,:focus. It may be slightly different here (as in the case of :focus, which adds a blue border) But I'm not sure we want to add too much custom CSS to keep it uniform everywhere.

@ml-evs ml-evs merged commit cc31504 into main May 2, 2025
17 checks passed
@ml-evs ml-evs deleted the bes/uv-vis-block branch May 2, 2025 21:10
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.

3 participants