DASDAE / dascore

A python library for distributed fiber optic sensing
Other
80 stars 17 forks source link

add_distance_to #430

Closed d-chambers closed 1 month ago

d-chambers commented 2 months ago

Description

This PR adds a add_distance_to patch method for calculating the distance to a point specified by a series. It can then be used to sort the channels of the patch. See #429.

Checklist

I have (if applicable):

codecov[bot] commented 2 months ago

Codecov Report

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

Project coverage is 99.84%. Comparing base (8fa6680) to head (620f844). Report is 2 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #430 +/- ## ======================================= Coverage 99.84% 99.84% ======================================= Files 112 112 Lines 9037 9065 +28 ======================================= + Hits 9023 9051 +28 Misses 14 14 ``` | [Flag](https://app.codecov.io/gh/DASDAE/dascore/pull/430/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/430/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DASDAE) | `99.84% <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 1 month ago

Thanks @ahmadtourei. I implemented your suggestion. I also got thinking and decided to store the origin location as coordinates (not associated with any dimension) rather than attributes. My thinking here is that we may want to support origin being a dataframe in the future, in which case the distance would be the shortest distance to any point in that dataframe. In such a case we would need to store arrays rather than single floats for each coordinate of the origin so this change helps future proof this method.