127 implement mims#193
Conversation
* testing time values, adding test data from R. * testing values * changed interpolate test to correlation * doc strings * ruff error. * failing matrix test for older version of polars. * interpolation correction * testing values * review changes + added md file from old branch. * typo. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* step 1: find maxed out probabilities * All major steps before final interpolation. * minor renaming * working version, partially updated doc strings. * initial testing * Doc strings * further testing, doc strings changes. * Final testing, error checks in metrics. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Superfluous print statements, doc string edit. * minor parameter changes * scipy ruff error * removing.whl * github actions- ruff- scipy issue. * initial changes. * superfluous * formatting --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* step 1: find maxed out probabilities * All major steps before final interpolation. * minor renaming * working version, partially updated doc strings. * initial testing * Doc strings * further testing, doc strings changes. * Final testing, error checks in metrics. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Superfluous print statements, doc string edit. * minor parameter changes * scipy ruff error * removing.whl * github actions- ruff- scipy issue. * initial changes. * superfluous * formatting * butterworth_filter * aggregate+filter * basic test, test data. * further testing. * Final testing, doc strings. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * set sorted error * np.trapezoid error, imports error. * mypy errors * numpy timestamps normalization. * max value issue * max_value second fix. * Max value aggregatoin bug. * scipy trapezoid replacing numpy implementation * missed an instance of np.trapezoid. * variable name change. * doc string change. * tuple fix, other comments. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* independent mims module. * combined_mims * sample_data * overall test * paramertrize * documentation * note on extra timestamp * spacing. * documentation * test error * Update src/wristpy/processing/mims.py Co-authored-by: Adam Santorelli <148909356+Asanto32@users.noreply.github.com> * seperate mims testing. * moving fixtures, reorganized testing. * epochs are floats, truncation moved, new truncation argument. * doc change. * doc string, type hinting. * typing error. * updated markdown. * markdown capitalization. * doc string --------- Co-authored-by: Adam Santorelli <148909356+Asanto32@users.noreply.github.com>
…arch/wristpy into 127-implement-mims
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #193 +/- ##
==========================================
- Coverage 96.14% 95.96% -0.19%
==========================================
Files 13 14 +1
Lines 778 991 +213
==========================================
+ Hits 748 951 +203
- Misses 30 40 +10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| thresholds = thresholds or (0.029, 0.338, 0.604) | ||
| elif activity_metric == "ag_count": | ||
| thresholds = thresholds or (100, 3000, 5200) | ||
| elif activity_metric == "mims": |
There was a problem hiding this comment.
Can probably add a test for mims in test_orchestrator? To make sure it handles the dynamic range/thresholds properly?
Co-authored-by: Adam Santorelli <148909356+Asanto32@users.noreply.github.com>
…arch/wristpy into 127-implement-mims
|
|
||
| else: | ||
| right = right[1:] | ||
|
|
There was a problem hiding this comment.
should this have an elif abs(len(left) - len(right)) > 1 error handler?
There was a problem hiding this comment.
should be covered by the error handling at the top of the function right?
if np.abs(len(left) - len(right)) >= 2:
raise ValueError(
f"Mismatch in {sign} edges. # left: {len(left)}, # right: {len(right)}"
)
|
|
||
| Args: | ||
| marker_length: Length of marker array. | ||
| left: indices indicating the left edge of a potential maxed-out region. |
There was a problem hiding this comment.
Define that these are vectors (assuming that they are indeed 1-dimensional vectors)
| non_maxed_out_mask = np.abs(marker) < confidence_threshold | ||
| num_non_maxed = np.sum(non_maxed_out_mask) | ||
|
|
||
| if num_non_maxed / len(marker) < 0.3: |
There was a problem hiding this comment.
where does this 0.3 "magic" value come from
There was a problem hiding this comment.
https://github.com/mHealthGroup/MIMSunit/blob/master/R/extrapolate.R#L686-L689
That's the threshold they used for this here, didn't find any particular justification.
|
|
||
| dynamic_range = _extract_dynamic_range( | ||
| metadata=data["metadata"], | ||
| file_type=file_type, # type: ignore |
There was a problem hiding this comment.
make the type ignore specific
Uh oh!
There was an error while loading. Please reload this page.