-
Notifications
You must be signed in to change notification settings - Fork 12
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
Fix "sampling_rate" not updating along with "dt" #568
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #568 +/- ##
==========================================
+ Coverage 55.75% 55.82% +0.07%
==========================================
Files 149 149
Lines 23171 23227 +56
Branches 1340 1340
==========================================
+ Hits 12918 12966 +48
- Misses 9912 9920 +8
Partials 341 341 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great! Thanks for fixing it! I only have two minor comments. We can merge it after you address it. Thank you!
message = "sampling_rate inconsistent with 1/dt; updating to 1/dt" | ||
mspass_object.elog.log_error("TimeSeries2Trace", | ||
message, | ||
ErrorSeverity.Invalid) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ErrorSeverity
should be Complaint
instead of Invalid
. Also, the algorithm name here is wrong. This is inside resample
not TimeSeries2Trace
. There are similar issues to the rest of the changes here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed it and have pushed it.
ErrorSeverity.Invalid) | ||
# Update sampling_rate to 1/dt | ||
mspass_object["sampling_rate"] = 1.0 / mspass_object.dt | ||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The else branch here is not covered by test. Also, I think we need to add tests for the converter, too. We also need to test for the elog here. I am actually not sure whether elog is correctly retained after the conversion to Trace and back.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed it and pushed it. I think elog is correctly retained during my tests.
btw, I see the python builds failed due to |
I fixed this and now it works well. |
1363ab8
to
334cb51
Compare
I fixed the issue of the attribute "sampling_rate" not updating when "dt" changes.
This happens in resample in resample.py and TimeSeries2Trace in converter.py.
I also edited the test code for the resample and it passed all the cases.