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

Merged Runs in Frequency Domain #184

Merged
merged 48 commits into from
Jul 3, 2022
Merged

Merged Runs in Frequency Domain #184

merged 48 commits into from
Jul 3, 2022

Conversation

kkappler
Copy link
Collaborator

@kkappler kkappler commented Jun 6, 2022

This relates to issues #80, #118 , #132.

Using CAS04 as a test to demonstrate can combine data from multiple runs

Tasks

  • Add argument to config_creator to specify estimation engine, or make so that if there is no RR station, default is RME, not RME_RR
  • review process_transfer_functions() method in transfer_function_helpers. Outline what is needed to make this a class method
    This would not be too hard to to, but it is unclear if that this would improve readability. Better probably to deal first with issue Deprecate TransferFunctionHeader Class #109, and consider replacing the TF container class with that in mt_metadata.
  • report issue that tf xml is not showing all runs, only the first run
    Reported as issue Review Role of local_run_obj in export_tf #181
  • debug wildly different values for Zxy for runs "b" & "c" in CAS04
    This is because runs c and d are missing filters for electric channels. In particular, run c has no filters for ey, and run d has no filters for ex, or ey. Added a note about this on issue CAS04 Dataset reconciliation #31. Ultimately, this was a consequence of a bug in make_mth5. This is addressed in issue Earthscope Dataset PAL59 #105 https://github.com/kujaku11/mth5/issues/105 in mth5.
  • Get updated metadata for CAS04 archived -- This was not needed, the currently archived metadata seems to be functioning OK as of June 18, 2022
  • Refactor synthetic test_utils to make multi-run synthetics possible
  • Add more runs to the synthetic data
  • Set runs to have different start, end times
    This task not completed, but issue How to set start/end time for run #188 was created, and as a substitute test, CAS04 was processed with RR
  • Add tests to synthetic data covering merging of runs
  • Implement new KernelDataset class
    • move KernelDataset into transfer_function folder
    • Running on test_synthetic_driver
    • running on test_compare_aurora_vs_archived_emtf.py
    • running on operate_aurora.ipynb
    • running on test_process_parkfield_run.py
    • running on test_process_parkfield_run_rr.py
  • Add remote reference "trimming" method for non-overlapping data from local and remote
  • test "trimming" method on CAS04
  • fix issue 181
  • Choose "remote_station_id" over "reference_station_id" and be consistent

@codecov
Copy link

codecov bot commented Jun 6, 2022

Codecov Report

Merging #184 (9671db8) into main (b9f535a) will increase coverage by 0.92%.
The diff coverage is 78.58%.

@@            Coverage Diff             @@
##             main     #184      +/-   ##
==========================================
+ Coverage   69.50%   70.42%   +0.92%     
==========================================
  Files          97       98       +1     
  Lines        5289     5535     +246     
==========================================
+ Hits         3676     3898     +222     
- Misses       1613     1637      +24     
Impacted Files Coverage Δ
aurora/config/metadata/processing.py 69.07% <ø> (-2.67%) ⬇️
aurora/config/metadata/stations.py 60.27% <ø> (ø)
aurora/sandbox/debug_mt_metadata_issue_85.py 0.00% <0.00%> (ø)
aurora/sandbox/mth5_channel_summary_helpers.py 0.00% <0.00%> (ø)
aurora/transfer_function/plot/rho_plot.py 0.00% <ø> (ø)
aurora/transfer_function/weights/edf_weights.py 97.22% <ø> (ø)
aurora/pipelines/transfer_function_helpers.py 88.50% <50.00%> (+4.59%) ⬆️
aurora/transfer_function/kernel_dataset.py 55.97% <55.97%> (ø)
aurora/pipelines/process_mth5.py 96.45% <76.92%> (-0.73%) ⬇️
aurora/pipelines/run_summary.py 78.84% <78.84%> (ø)
... and 26 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b9f535a...9671db8. Read the comment docs.

While working on issue#80, and PR184, have noticed that processing
config defaults to estimator.engine = "RME_RR".  This is fine, but
I find I need to specify to use "RME" explicitly when there is only one
station.  So a couple fixes were added:
1. Processing class now has a validate() method.  If there is no RR
station, _and_ the estimator.engine is "RME_RR", it gets reset to
"RME".  Also added the ability to pass a kwarg to ConfigCreator instance
called estimator.  The kwarg is a dict and if "engine" is a key, it will
overwrite the estimator with the corresponding value.

The parkfield SS run test was updated to use the config_creator method.
cas04 test is usign validate()

[Issue(s): #80]
Tested clock zero works when it comes from data, but only on a single
run.

[Issue(s): #42]
-Added windowing_scheme as a property of decimation_level metadata object, and r
eplaced initializations of WindowingScheme() in time_series_helpers, with this p
roperty
-cleaned up an errant print statement and tidied some docstrings

[Issue(s): #42]
Fixed a few docstrings, but main change was to review the math in
squared coherence calculation.  It turns out this is not as inefficient
as I had thought, but it can be done a little cleaner.  Removed an
unneeded conjugation.

[Issue(s): #78]
See notes in issue #78 about einsum motiation.
Also set show_response_curves to false, getting some matplotlib errors
in the CI tests

[Issue(s):  #78]
Using the updated method in mth5 locally (see mth5 issue #105),
am now able to process runs c and d for CAS04 as single station.

Working on getting a similar h5 built in tests/cas04

[Issue(s): #31, #80]
Allow request list to have mulitple stations and modify
channel_summary_to_make_mth5 to groupby station,run rather
than just run.  Add tests of make multistation mth5 to cas04 tests.

[Issue(s): #80]
-replace DatasetDefintion by Dataset
and import as TFKDataset,
-replace dataset_definition with tfk_dataset

[Issue(s): #80, #132]
This is just a stage commit because all tests are passing currently.
operate_aurora is not yet working.

Need to decide where to put the RunSummary wrangling.

[Issue(s): #80, #118, #132]
Add a method to KernelDataset to extract run info, looping over runs.
Also, noticed that some synthetic tests were commented out, fixed this.
Also, tidied some code in process_mth5.

[Issue(s): #181]
Multiple runs now entered into TF XML
Replaced dict with classes.  Now have a SyntheticRun and a
SyntheticStation.
This will be used to create an example synthetic case with many runs

[Issue(s): #80]
Change from timedelta.seconds to timedelta.total_seconds()
Remove run_id from sort_by, it should be only station, starttime

[Issue(s): #80]
@kkappler
Copy link
Collaborator Author

kkappler commented Jul 3, 2022

aurora_vs_emtf_SS
aurora_vs_emtf_RR

The attached figures indicate that an integrated test using the RR mulitrun clipping to process cas04 with aurora is giving results that are consistent with EMTF in both amplitude and phase outside of the very noisy band of periods shorter than ~30s, which should be processed with coherence sorting.

The good agreement at long period suggests that the management of time intervals is being handled correctly. The casor test will be revisited in issue #31 but these results are enough to justify merging this PR.

@kkappler kkappler merged commit 27cdc59 into main Jul 3, 2022
@kkappler kkappler deleted the fix_issue_80 branch July 3, 2022 22:13
@kkappler kkappler restored the fix_issue_80 branch July 3, 2022 22:15
@kkappler kkappler deleted the fix_issue_80 branch August 28, 2022 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant