Skip to content

Commit

Permalink
Try fix issue #323
Browse files Browse the repository at this point in the history
- modify some functions decorated with path_or_mth5 so that
they operate in read-only mode, so that the channel summary is not
recomputed when the file is closed
  • Loading branch information
kkappler committed Apr 27, 2024
1 parent b4bc5d6 commit 7fb1fff
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion aurora/pipelines/fourier_coefficients.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def add_fcs_to_mth5(m, fc_decimations=None):


@path_or_mth5_object
def read_back_fcs(m):
def read_back_fcs(m, mode="r"):
"""
This is mostly a helper function for tests. It was used as a sanity check while debugging the FC files, and
also is a good example for how to access the data at each level for each channel.
Expand Down
12 changes: 10 additions & 2 deletions aurora/pipelines/transfer_function_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,13 @@ def check_if_fcs_already_exist(self):
remote = run_sub_df.remote.iloc[0]
mth5_path = run_sub_df.mth5_path.iloc[0]
fcs_present = mth5_has_fcs(
mth5_path, survey_id, station_id, run_id, remote, self.processing_config
mth5_path,
survey_id,
station_id,
run_id,
remote,
self.processing_config,
mode="r",
)
self.dataset_df.loc[dataset_df_indices, "fc"] = fcs_present

Expand Down Expand Up @@ -618,14 +624,16 @@ def memory_warning(self):


@path_or_mth5_object
def mth5_has_fcs(m, survey_id, station_id, run_id, remote, processing_config):
def mth5_has_fcs(m, survey_id, station_id, run_id, remote, processing_config, **kwargs):
"""
Checks if all needed fc-levels for survey-station-run are present under processing_config
Note #1: At this point in the logic, it is established that there are FCs associated with run_id and there are
at least as many FC decimation levels as we require as per the processing config. The next step is to
assert whether it is True that the existing FCs conform to the recipe in the processing config.
kwargs are here as a pass through to the decorator ... we pass mode="r","a","w"
Parameters
----------
m
Expand Down

0 comments on commit 7fb1fff

Please sign in to comment.