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

Add single_freq parameter, bug fixes #164

Merged
merged 1 commit into from
Aug 1, 2023
Merged

Add single_freq parameter, bug fixes #164

merged 1 commit into from
Aug 1, 2023

Conversation

carlosgjs
Copy link
Collaborator

@carlosgjs carlosgjs commented Aug 1, 2023

In some datasets (e.g. SCEDC S3 bucket) the data comes in multiple sampling rates and we need a way of selecting one. So the desired sampling rate is passed as a config parameter and we find the sampling rate available in the data that is the closest (but equal or greater) than the config. Then we use only the data at that exact frequency.

However, in other scenarios we want to use all the data, as long as its above the desired sampling rate. This PR adds a configuration parameter to control this.

It also adds a couple of checks to avoid crashing when there's missing data.

@carlosgjs carlosgjs temporarily deployed to github-pages August 1, 2023 18:15 — with GitHub Actions Inactive
) -> List[Tuple[Channel, ChannelData]]:
ch_data_refs = [executor.submit(store.read_data, ts, ch) for ch in channels]
ch_data = _get_results(ch_data_refs)
tuples = list(zip(channels, ch_data))
return _filter_channel_data(tuples, samp_freq)
return _filter_channel_data(tuples, samp_freq, single_freq)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Carlos,

If I understand this this function right, it returns the channels at the frequency closest to samp_freq when single_freq = True. While single_freq = False, it returns all channels with frequency greater than samp_freq. By default, the fft_param set this switch as True.

Is there any test needs to be added accordingly?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ha I see the tests below now. Looks great!

@carlosgjs carlosgjs merged commit 4a3586b into master Aug 1, 2023
23 checks passed
@carlosgjs carlosgjs deleted the carlosg/fixes2 branch August 1, 2023 19:06
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.

2 participants