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

Ensure Consistent Output Structure for _parse_xy_xy #225

Conversation

Nicolass67
Copy link

This pull request modifies the _parse_xy_xy function in nmrglue to ensure consistent data output, regardless of the structure of the input data. Previously, the function returned a different structure based on the number of data points in a line, leading to inconsistencies in downstream processing.

The updated function now always returns a consistent structure ([[x, y], ...] wrapped in a list) to align with expected behavior.

Changes Made
Removed the conditional check on len_group_data at the end of the function.
The function now consistently returns [[x, y], ...] wrapped in a list, regardless of the input format.

Dependency Note
This change must be made in tandem with ChemSpectra Backend PR #220, which addresses related inconsistencies in the Spectra Viewer.

The backend PR resolves:
Normalization of input data to handle inconsistent array dimensions.
Issues with parsing 3D data arrays with a single initial dimension (e.g., shape (1, N, 2)) by converting them to the expected 2D format (N, 2).

Both changes together ensure that:
JCAMP and ESI Mass files are parsed and displayed consistently in the ChemSpectra Viewer.
File parsing does not fail due to unexpected data structures.

Testing
Verify that _parse_xy_xy outputs the same structure for all valid inputs, regardless of the number of data points per line.
Confirm that related file types (e.g., JCAMP, ESI Mass) work correctly in the Spectra Viewer with the ChemSpectra backend changes applied.

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

@Nicolass67 Nicolass67 closed this Nov 25, 2024
@Nicolass67 Nicolass67 deleted the refactor-parse-xy-xy-standardize-output branch November 25, 2024 10:07
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.

3 participants