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

[python] Remove AxisName.getattr_from from ExperimentAxisQuery #3557

Merged
merged 6 commits into from
Jan 16, 2025

Conversation

jp-dark
Copy link
Collaborator

@jp-dark jp-dark commented Jan 10, 2025

The ExperimentAxisQuery used the AxisName enumeration to access attributes with either obs or var in the name. This PR directly calls the appropriate functions, primarily by pushing up the calls to one function higher (e.g. pass in self.indexer.by_obs/self.indexer.by_var instead of AxisName.OBS/AxisName.VAR).

This change allowed ExperimentAxisQuery._convert_to_ndarray and ExperimentAxisQuery._axism_inner_ndarray to be merged into a single non-member function, and ExperimentAxisQuery._axisp_inner_sparray to be replaced with a direct call to _read_as_csr.

@jp-dark jp-dark requested review from johnkerl and ryan-williams and removed request for johnkerl January 10, 2025 21:49
Base automatically changed from dark/merge_get_array to main January 16, 2025 19:58
Rather than deconstructing/reconstructing the choice to use obs or var,
just call `_read_as_csr` directly with the appropriate values.
Create a new function `_read_inner_ndarray` that is not a method of
`ExperimentAxisQuery`.

The new function `_read_inner_ndarray` directly takes `SparseNDArray`,
`joinids`, and `indexer` rather than trying to deconstruct and
reconstruct the functions for `AxisName` enum.
@jp-dark jp-dark force-pushed the dark/remove_getattr_from branch from 67da7bb to 7c934f8 Compare January 16, 2025 20:02
@jp-dark jp-dark merged commit 39d6d41 into main Jan 16, 2025
9 checks passed
@jp-dark jp-dark deleted the dark/remove_getattr_from branch January 16, 2025 21:05
github-actions bot pushed a commit that referenced this pull request Jan 16, 2025
…3557)

The `ExperimentAxisQuery` used the `AxisName` enumeration to access attributes with either `obs` or `var` in the name. This PR directly calls the appropriate functions, primarily by pushing up the calls to one function higher (e.g. pass in `self.indexer.by_obs`/`self.indexer.by_var` instead of `AxisName.OBS`/`AxisName.VAR`).

This change allowed `ExperimentAxisQuery._convert_to_ndarray` and `ExperimentAxisQuery._axism_inner_ndarray` to be merged into a single non-member function, and `ExperimentAxisQuery._axisp_inner_sparray` to be replaced with a direct call to `_read_as_csr`.
johnkerl pushed a commit that referenced this pull request Jan 16, 2025
…3557) (#3577)

The `ExperimentAxisQuery` used the `AxisName` enumeration to access attributes with either `obs` or `var` in the name. This PR directly calls the appropriate functions, primarily by pushing up the calls to one function higher (e.g. pass in `self.indexer.by_obs`/`self.indexer.by_var` instead of `AxisName.OBS`/`AxisName.VAR`).

This change allowed `ExperimentAxisQuery._convert_to_ndarray` and `ExperimentAxisQuery._axism_inner_ndarray` to be merged into a single non-member function, and `ExperimentAxisQuery._axisp_inner_sparray` to be replaced with a direct call to `_read_as_csr`.

Co-authored-by: Julia Dark <[email protected]>
Copy link

codecov bot commented Jan 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.27%. Comparing base (ec90ec7) to head (7c934f8).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3557      +/-   ##
==========================================
+ Coverage   86.23%   86.27%   +0.04%     
==========================================
  Files          55       55              
  Lines        6398     6375      -23     
==========================================
- Hits         5517     5500      -17     
+ Misses        881      875       -6     
Flag Coverage Δ
python 86.27% <100.00%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
python_api 86.27% <100.00%> (+0.04%) ⬆️
libtiledbsoma ∅ <ø> (∅)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants