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

fix: data normalization and improve handling of runs in JcampMSConverter #220

Merged
merged 4 commits into from
Nov 28, 2024

Conversation

Nicolass67
Copy link
Contributor

@Nicolass67 Nicolass67 commented Nov 22, 2024

Problem
Users reported that certain ESI mass files were failing to open in the Spectra Viewer within the ELN. This issue was caused by inconsistencies in data handling and unexpected data structures during file parsing and processing.

Solution : Normalization of Input Data
Added a new method __normalize_data to ensure all input data conforms to a consistent shape.
This handles cases where data is represented as 3D arrays with a single initial dimension (e.g., shape (1, N, 2)), converting them into the expected 2D shape (N, 2).

Introduced a test test_jcamp_single_point_last_line to validate the parsing of single points in the last line of the JCAMP-DX file.
This ensures that edge cases where single data points occur are correctly handled.

Included the MS_ESI.jdx file in the repository under tests/fixtures/source/ms/MS_ESI.jdx that is used in the previous mentioned test.

Dependencies
This PR requires changes made in the library library_name to work correctly. Ensure the following branch is used in your environment:
Library Name: nmrglue
Branch: Refactor-parse_xy_xy-standardize-output-3D-arrays
Reference in requirements.txt:
-e git+https://github.com/ComPlat/nmrglue.git@Refactor-parse_xy_xy-standardize-output-3D-arrays#egg=nmrglue
Ensure this branch is installed (with pip install -r requirements.txt) in your environment before testing or deploying these changes.

Testing
Verified that the affected ESI mass files now open correctly in the Spectra Viewer.
Launch the unit tests with : coverage run -m pytest --disable-pytest-warnings

Issue Reference:
Issue #218: Problem with opening ESI Mass Files in Spectra Viewer

Resources :
File to reproduce the error and validate the test : MS_ESI.txt

@PiTrem PiTrem changed the title Fix data normalization and improve handling of runs in JcampMSConverter fix: data normalization and improve handling of runs in JcampMSConverter Nov 28, 2024
@PiTrem PiTrem merged commit e7e517b into master Nov 28, 2024
1 check passed
PiTrem added a commit to ComPlat/chemotion_ELN that referenced this pull request Dec 4, 2024
* fix: conditional header generation for NMR JCAMP export [#219](ComPlat/chem-spectra-app#219)
* fix: data normalization and improve handling of runs in JcampMSConverter [#220](ComPlat/chem-spectra-app#220)
* chore: Bump werkzeug from 3.0.3 to 3.0.6 [#217](ComPlat/chem-spectra-app#217)
PiTrem added a commit to ComPlat/chemotion_ELN that referenced this pull request Dec 4, 2024
* fix: conditional header generation for NMR JCAMP export [#219](ComPlat/chem-spectra-app#219)
* fix: data normalization and improve handling of runs in JcampMSConverter [#220](ComPlat/chem-spectra-app#220)
* chore: Bump werkzeug from 3.0.3 to 3.0.6 [#217](ComPlat/chem-spectra-app#217)
PiTrem added a commit to ComPlat/chemotion_ELN that referenced this pull request Dec 9, 2024
* fix: conditional header generation for NMR JCAMP export [#219](ComPlat/chem-spectra-app#219)
* fix: data normalization and improve handling of runs in JcampMSConverter [#220](ComPlat/chem-spectra-app#220)
* chore: Bump werkzeug from 3.0.3 to 3.0.6 [#217](ComPlat/chem-spectra-app#217)
adambasha0 pushed a commit to ComPlat/chemotion_ELN that referenced this pull request Dec 17, 2024
* fix: conditional header generation for NMR JCAMP export [#219](ComPlat/chem-spectra-app#219)
* fix: data normalization and improve handling of runs in JcampMSConverter [#220](ComPlat/chem-spectra-app#220)
* chore: Bump werkzeug from 3.0.3 to 3.0.6 [#217](ComPlat/chem-spectra-app#217)
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