Skip to content

Fix docstring example to demonstrate get_drift_time_array_mv() method - #8425

Merged
timosachsenberg merged 2 commits into
feature/drift_time_os_specfrom
copilot/sub-pr-8423-again
Dec 4, 2025
Merged

timosachsenberg merged 2 commits into
feature/drift_time_os_specfrom
copilot/sub-pr-8423-again

Conversation

Copilot AI commented Dec 4, 2025 •

Copy link
Copy Markdown
Contributor

The docstring example for get_drift_time_array_mv() was showing direct FloatDataArray.get_data_mv() access instead of demonstrating the convenience method itself.

Changes

  • Updated example to call spectrum.get_drift_time_array_mv() instead of fdas[idx].get_data_mv()
  • Retained fdas reference to prevent GC and existing containsIMData()/getIMData() checks
# Before
drift_mv = fdas[idx].get_data_mv()  # Use FloatDataArray.get_data_mv()

# After
drift_mv = spectrum.get_drift_time_array_mv()

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@coderabbitai

coderabbitai Bot commented Dec 4, 2025

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI changed the title [WIP] Update example in drift time accessors docstring Fix docstring example to demonstrate get_drift_time_array_mv() method Dec 4, 2025
Copilot AI requested a review from timosachsenberg December 4, 2025 13:05
@timosachsenberg
timosachsenberg marked this pull request as ready for review December 4, 2025 13:15
@timosachsenberg
timosachsenberg merged commit 3de915b into feature/drift_time_os_spec Dec 4, 2025
@timosachsenberg
timosachsenberg deleted the copilot/sub-pr-8423-again branch December 4, 2025 13:15
timosachsenberg added a commit that referenced this pull request Dec 6, 2025
…8423)

* [FEATURE] also allow access to drift time

* [FEATURE] allow memory-view access to arrays

* [FEATURE] allow access to all data arrays

* [FEATURE] allow access to all data arrays

* [FEATURE] faster access to all data arrays

* [FEATURE] fast access to data in DataArrays

* [FIX] bugfix, actually copy the numpy data

* [FIX] get data arrays without copy

* [FEATURE] add setDataArrays() function

* [FEATURE] update pxd file

* [TEST] add tests

* [DOC] add performance tests

* add doc

* Address code review feedback for PR #6352

- Remove unnecessary semicolons from test file (lines 50, 63, 134)
- Add documentation for setDataArrays() methods in DataStructures.h
- Add docstrings for getData() and getData_mv() in OSBinaryDataArray.pyx

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Fix empty array handling in OSSpectrum/OSChromatogram

Handle the case where arrays are empty when creating memory views.
When data.size() is 0, data.data() returns NULL, and trying to
create a Cython memory view from NULL causes ValueError.

This fix:
- Returns np.empty(0) for copy methods (getMZArray, getIntensityArray, etc.)
- Returns None for memory view methods (*_mv) when array is empty
- Adds size check before creating memory view

Fixes test failure in test_ChromatogramExtractorAlgorithm.py

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Add MSSpectrum array accessors and improve pyOpenMS data array methods

- Add get_mz_array(), get_intensity_array(), get_drift_time_array() to MSSpectrum
- Add get_drift_time_array_mv() and get_drift_time_unit() for ion mobility data
- Optimize get_peaks() with direct indexing instead of iterator
- Standardize FloatDataArray: get_data() returns copy, get_data_mv() returns view
- Add docstrings to OSSpectrum, OSChromatogram, OSBinaryDataArray addon methods
- Use snake_case naming convention consistent with existing pyOpenMS style
- Fix empty array handling (copy methods return empty array, view methods return None)
- Update unit tests for new method signatures and semantics

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Rename test_MSSpectrumAndRichSpectrum to test_MSSpectrum

RichSpectrum class no longer exists in OpenMS - update test file name
to reflect that it only tests MSSpectrum.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* [WIP] Update benchmark snippets to use snake_case Python method names (#8424)

* Initial plan

* Update benchmark snippets to use snake_case Python method names

Co-authored-by: timosachsenberg <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: timosachsenberg <[email protected]>

* Fix docstring example to demonstrate get_drift_time_array_mv() method (#8425)

* Initial plan

* Update docstring example to use get_drift_time_array_mv() method

Co-authored-by: timosachsenberg <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: timosachsenberg <[email protected]>

* Remove unused setUp method from test_MSSpectrum.py (#8426)

* Initial plan

* Remove unused setUp method and os import from test_MSSpectrum.py

Co-authored-by: timosachsenberg <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: timosachsenberg <[email protected]>

* Fix Cython nogil syntax and update tests to use snake_case API

- Fix Cython `nogil` position in OpenSwathDataStructures.pxd (use `except + nogil` not `nogil except +`)
- Update pyOpenMS tests to use new snake_case method names:
  - getMZArray() → get_mz_array()
  - getIntensityArray() → get_intensity_array()
  - setMZArray() → set_mz_array()
  - setIntensityArray() → set_intensity_array()
  - getTimeArray() → get_time_array()

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

---------

Co-authored-by: Hannes Roest <[email protected]>
Co-authored-by: Samuel Wein <[email protected]>
Co-authored-by: Claude <[email protected]>
Co-authored-by: Copilot <[email protected]>
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