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

Add apply_ to dataclasses #489

Closed

Conversation

fzimmermann89
Copy link
Member

@fzimmermann89 fzimmermann89 commented Oct 28, 2024

We will need an apply on our dataclasses, both for @ckolbPTB's work as well, and for the rearrangeind und indexing.
As the _to already basically does an recursive apply with memorization, this refactors it such that the _apply can also be used with different functions.

[ghstack-poisoned]
[ghstack-poisoned]
@fzimmermann89
Copy link
Member Author

fzimmermann89 commented Oct 28, 2024

@fzimmermann89 fzimmermann89 mentioned this pull request Oct 28, 2024
fzimmermann89 added a commit that referenced this pull request Oct 28, 2024
ghstack-source-id: 3d530a5c1136c4475a446b28a70b8ee716e8bdf5
ghstack-comment-id: 2441645633
Pull Request resolved: #489
@fzimmermann89 fzimmermann89 marked this pull request as draft October 28, 2024 13:51
[ghstack-poisoned]
fzimmermann89 added a commit that referenced this pull request Oct 28, 2024
ghstack-source-id: 6a610528822a5f8e0b819e3f1aff19567ab5484f
ghstack-comment-id: 2441645633
Pull Request resolved: #489
Copy link
Contributor

github-actions bot commented Oct 28, 2024

Coverage

Coverage Report
FileStmtsMissCoverMissing
src/mrpro/algorithms/csm
   inati.py24196%44
   walsh.py16194%34
src/mrpro/algorithms/dcf
   dcf_voronoi.py53492%15, 48–49, 76
src/mrpro/algorithms/optimizers
   adam.py20195%69
src/mrpro/algorithms/reconstruction
   DirectReconstruction.py281643%51–71, 85
   IterativeSENSEReconstruction.py13192%76
   Reconstruction.py502256%42, 54–56, 80–87, 104–113
   RegularizedIterativeSENSEReconstruction.py411759%96–100, 114–139
src/mrpro/data
   AcqInfo.py161299%224, 262
   CsmData.py29390%15, 82–84
   DcfData.py45882%18, 66, 78–83
   IData.py67987%119, 125, 129, 159–167
   IHeader.py75791%75, 109, 127–131
   KHeader.py1651790%25, 127–131, 158, 210, 221, 228–229, 232, 239, 278–289
   KNoise.py311552%39–52, 56–61
   KTrajectory.py69593%178–182
   MoveDataMixin.py1371986%15, 113, 129, 143–145, 207, 273, 303–305, 318, 397, 417–418, 420, 435–436, 438
   QData.py39782%42, 65–73
   Rotation.py6743695%100, 198, 335, 433, 477, 495, 581, 583, 592, 626, 628, 691, 768, 773, 776, 791, 808, 813, 889, 1077, 1082, 1085, 1109, 1113, 1240, 1242, 1250–1251, 1315, 1397, 1608, 1690, 1846, 1881, 1885, 1996
   SpatialDimension.py2402390%34, 104, 119, 126, 132, 152, 162, 279–281, 294–296, 330, 348, 361, 374, 387, 400, 409–410, 425, 434
   TrajectoryDescription.py14193%23
   acq_filters.py10190%47
src/mrpro/data/_kdata
   KData.py1051685%108–109, 118, 126, 180–181, 216, 221–222, 241–252
   KDataRemoveOsMixin.py29293%44, 46
   KDataSelectMixin.py21290%48, 64
   KDataSplitMixin.py49394%51, 81, 90
src/mrpro/data/traj_calculators
   KTrajectoryCalculator.py25292%23, 45
   KTrajectoryIsmrmrd.py13285%41, 50
   KTrajectoryPulseq.py29197%54
src/mrpro/operators
   CartesianSamplingOp.py50982%49–50, 55–56, 61–62, 88, 91, 114
   ConstraintsOp.py60297%46, 48
   EndomorphOperator.py65297%228, 234
   FiniteDifferenceOp.py27293%40, 105
   FourierOp.py77199%131
   Functional.py71593%20–22, 117, 119
   GridSamplingOp.py136993%72–73, 82–83, 90–91, 94, 96, 98
   LinearOperator.py1611293%55, 91, 190, 220, 261, 270, 278, 287, 295, 306, 404, 409
   MultiIdentityOp.py13285%43, 48
   Operator.py78297%25, 74
   ProximableFunctionalSeparableSum.py39392%50, 103, 110
   SliceProjectionOp.py173895%44, 61, 63, 69, 206, 227, 260, 300
   WaveletOp.py120596%152, 170, 205, 210, 233
   ZeroPadOp.py16194%30
src/mrpro/utils
   filters.py62297%44, 49
   modify_acq_info.py17194%12
   slice_profiles.py46687%20, 36, 113–116, 149
   sliding_window.py34197%34
   split_idx.py10280%43, 47
   summarize_tensorvalues.py11918%20–29
   typing.py181139%8–23
   zero_pad_or_crop.py31681%26, 30, 54, 57, 60, 63
TOTAL457834592% 

Tests Skipped Failures Errors Time
1916 0 💤 0 ❌ 0 🔥 1m 38s ⏱️

Copy link
Contributor

github-actions bot commented Oct 28, 2024

📚 Documentation

📁 Download as zip
🔍 View online

[ghstack-poisoned]
fzimmermann89 added a commit that referenced this pull request Oct 28, 2024
ghstack-source-id: 06c8bdf0d3fb0f85bce9f74f0229528c6d8c18cc
ghstack-comment-id: 2441645633
Pull Request resolved: #489
[ghstack-poisoned]
fzimmermann89 added a commit that referenced this pull request Oct 28, 2024
ghstack-source-id: 161e1065f9d323c86455307700301cb30f619825
ghstack-comment-id: 2441645633
Pull Request resolved: #489
[ghstack-poisoned]
fzimmermann89 added a commit that referenced this pull request Oct 28, 2024
ghstack-source-id: ece2c18bcaf513233da227f1cd8640fdae3b1b29
ghstack-comment-id: 2441645633
Pull Request resolved: #489
@fzimmermann89 fzimmermann89 mentioned this pull request Oct 28, 2024
@fzimmermann89 fzimmermann89 marked this pull request as ready for review October 28, 2024 23:44
@fzimmermann89 fzimmermann89 mentioned this pull request Oct 31, 2024
@fzimmermann89
Copy link
Member Author

This might be moved outside the movedatamixin at some point, or the mixin will just become a baseclass for our datastuff.
But for now, please already review as-if going int main as is.

@fzimmermann89 fzimmermann89 changed the title _apply Add apply_ to dataclasses Nov 9, 2024
@ckolbPTB
Copy link
Collaborator

ckolbPTB commented Nov 9, 2024

I think it would be a good idea to add a test which especially verifies the memo-functionality

@fzimmermann89 fzimmermann89 changed the base branch from gh/fzimmermann89/27/head to main November 9, 2024 17:49
@fzimmermann89 fzimmermann89 changed the base branch from main to gh/fzimmermann89/27/orig November 9, 2024 17:51
@fzimmermann89 fzimmermann89 changed the base branch from gh/fzimmermann89/27/orig to gh/fzimmermann89/28/orig November 9, 2024 17:51
@ckolbPTB ckolbPTB mentioned this pull request Nov 9, 2024
fzimmermann89 added a commit that referenced this pull request Nov 10, 2024
ghstack-source-id: ece2c18bcaf513233da227f1cd8640fdae3b1b29
ghstack-comment-id: 2441645633
Pull Request resolved: #489
fzimmermann89 added a commit that referenced this pull request Nov 10, 2024
ghstack-source-id: ece2c18bcaf513233da227f1cd8640fdae3b1b29
ghstack-comment-id: 2441645633
Pull Request resolved: #489
@fzimmermann89
Copy link
Member Author

fzimmermann89 commented Nov 11, 2024

moved to #505

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