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

FC group metadata not being stored with correct window information #310

Open
1 task
kkappler opened this issue Nov 19, 2023 · 0 comments
Open
1 task

FC group metadata not being stored with correct window information #310

kkappler opened this issue Nov 19, 2023 · 0 comments

Comments

@kkappler
Copy link
Collaborator

In tests/synthetic/test_fourier_coefficients.py FCs are added to an mth5 file, the file is written, and later those fcs are to be accessed.

This test passed when there was a boxcar window, but is not running as intended with a hamming window.

Fixes needed:

  • The file written should have "hamming" and not "boxcar"
    The freshly minted mth5
    ls -l
    -rw-rw-r-- 1 kkappler kkappler 537852 Nov 18 17:05 test2.h5
    Around line 376 of process_mth5.py is called
save_fourier_coefficients(
                dec_level_config, i_dec_level, row, run_obj, stft_obj
            )

Within save_fourier_coefficients, the critical lines are:

fc_group = station_obj.fourier_coefficients_group.add_fc_group(
            run_obj.metadata.id
        )
decimation_level_metadata = dec_level_config.to_fc_decimation()
fc_decimation_level = fc_group.add_decimation_level(
            f"{i_dec_level}",
            decimation_level_metadata=decimation_level_metadata,
        )
fc_decimation_level.from_xarray(stft_obj)
fc_decimation_level.update_metadata()
fc_group.update_metadata()

After this exectutes, the metadata looks correct:

fc_decimation_level.metadata
Out[2]:
{
"decimation": {
"anti_alias_filter": "default",
"channels_estimated": [
"ex",
"ey",
"hx",
"hy",
"hz"
],
"decimation_factor": 1,
"decimation_level": 0,
"harmonic_indices": [
-1
],
"hdf5_reference": "",
"id": "0",
"method": "fft",
"min_num_stft_windows": 2,
"mth5_type": "FCDecimation",
"pre_fft_detrend_type": "linear",
"prewhitening_type": "first difference",
"recoloring": true,
"sample_rate_decimation": 1.0,
"time_period.end": "1980-01-01T11:04:00+00:00",
"time_period.start": "1980-01-01T00:00:00+00:00",
"window.clock_zero_type": "ignore",
"window.num_samples": 128,
"window.overlap": 32,
"window.type": "hamming"
}
}

The window .type is "hamming"

However, if I call
tmp = fc_group.get_decimation_level("0")

The window is boxcar:

tmp.metadata
Out[6]:
{
"decimation": {
"anti_alias_filter": "default",
"channels_estimated": [
"ex",
"ey",
"hx",
"hy",
"hz"
],
"decimation_factor": 1,
"decimation_level": 0,
"harmonic_indices": [
-1
],
"hdf5_reference": "",
"id": null,
"method": "fft",
"min_num_stft_windows": 2,
"mth5_type": "FCDecimation",
"pre_fft_detrend_type": "linear",
"prewhitening_type": "first difference",
"recoloring": true,
"sample_rate_decimation": 1.0,
"time_period.end": "1980-01-01T00:00:00+00:00",
"time_period.start": "1980-01-01T00:00:00+00:00",
"window.clock_zero_type": "ignore",
"window.num_samples": 128,
"window.overlap": 32,
"window.type": "boxcar"
}
}

  • [ ]

The FCs are being w

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

No branches or pull requests

1 participant