DASDAE / dascore

A python library for distributed fiber optic sensing
Other
71 stars 16 forks source link

Adding roll function for patches #382

Closed Nik-P2 closed 3 months ago

Nik-P2 commented 3 months ago

Description

Adding in roll function for patches based on numpy roll function an example of this function

import dascore as dc
patch = dc.get_example_patch()
# roll time dimension 5 elements
rolled_patch = patch.roll(time=5, samples=True)

Checklist

I have (if applicable):

codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 99.54%. Comparing base (c2f6ca7) to head (82e143c).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #382 +/- ## ======================================= Coverage 99.54% 99.54% ======================================= Files 97 97 Lines 7633 7647 +14 ======================================= + Hits 7598 7612 +14 Misses 35 35 ``` | [Flag](https://app.codecov.io/gh/DASDAE/dascore/pull/382/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DASDAE) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/DASDAE/dascore/pull/382/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DASDAE) | `99.54% <100.00%> (+<0.01%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DASDAE#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

d-chambers commented 3 months ago

Hey @Nik-P2, If you look at the CI that failed (by clicking on the details button above) I see this error message when running the docstests. I think I told you wrong above, the dimensional coordinates are always 1D, so you might try replacing this line:

np.roll(coord.values, value, axis=axis)

with this one:

np.roll(coord.values, value, axis=0)

and see if it works.

d-chambers commented 3 months ago

All green, feel free to press the squash and merge button.