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

Align Channels in RunTS #141

Merged
merged 23 commits into from Apr 6, 2023
Merged

Align Channels in RunTS #141

merged 23 commits into from Apr 6, 2023

Conversation

kujaku11
Copy link
Owner

@kujaku11 kujaku11 commented Mar 30, 2023

This PR addresses #140 when input channels are slightly off from each other, one maybe have a few more samples.

Update RunTS to locate the differences, estimate the earliest start time, the latest end time and reindex each channel onto a common time index. Xarray tools do not seem to work when the time indexes are slightly off from one another when combining into a dataset. It combines any unique time index and places a NaN on any sample that doesn't have that same time index (using align, merge). If you try to resample/reindex/interpolate a combined dataset it gets FUBARed with misplaced NaN's. Therefore, we need to reindex each channel separately before combining into a dataset.

  • Add check for common start, if not get earliest start time
  • Add check for common end, if not get latest end time
  • Add check for common sample rate, can only be one sample rate.
  • Add method to create a common time index
  • Add method to reindex each channel to align.
  • Update input list to use these tools.
  • Update tests
  • Update documentation

@codecov-commenter
Copy link

codecov-commenter commented Mar 30, 2023

Codecov Report

Patch coverage: 88.81% and project coverage change: +0.74 🎉

Comparison is base (69a1fa2) 58.76% compared to head (eccfc44) 59.50%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #141      +/-   ##
==========================================
+ Coverage   58.76%   59.50%   +0.74%     
==========================================
  Files         120      122       +2     
  Lines       12500    12728     +228     
==========================================
+ Hits         7345     7574     +229     
+ Misses       5155     5154       -1     
Impacted Files Coverage Δ
mth5/io/zen/zen.py 19.70% <0.00%> (-0.13%) ⬇️
setup.py 0.00% <ø> (ø)
tests/timeseries/test_channel_ts.py 99.73% <ø> (ø)
mth5/groups/master_station_run_channel.py 59.23% <16.66%> (+0.05%) ⬆️
mth5/timeseries/scipy_filters.py 55.86% <70.58%> (+0.93%) ⬆️
mth5/timeseries/channel_ts.py 83.77% <84.61%> (+1.71%) ⬆️
mth5/timeseries/run_ts.py 75.24% <89.55%> (+1.54%) ⬆️
mth5/timeseries/ts_helpers.py 93.47% <93.47%> (ø)
tests/timeseries/test_ts_helpers.py 98.70% <98.70%> (ø)
mth5/__init__.py 100.00% <100.00%> (ø)
... and 1 more

... and 2 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@kujaku11 kujaku11 linked an issue Mar 30, 2023 that may be closed by this pull request
@kujaku11 kujaku11 self-assigned this Mar 30, 2023
@kujaku11 kujaku11 added bug Something isn't working enhancement New feature or request labels Mar 30, 2023
@kujaku11 kujaku11 merged commit 9f6fbd2 into master Apr 6, 2023
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Making a RunTS with channels that have different lengths
2 participants