Skip to content
Snippets Groups Projects
Commit c2a79173 authored by Lan Dam's avatar Lan Dam
Browse files

Merge branch 'finalize_once_for_all' into 'master'

perform finalize only once after data loaded

See merge request !142
parents 93b79182 ae7ce4a2
No related branches found
No related tags found
1 merge request!142perform finalize only once after data loaded
Pipeline #2752 passed with stage
in 2 minutes and 51 seconds
...@@ -318,20 +318,6 @@ class GeneralData(): ...@@ -318,20 +318,6 @@ class GeneralData():
execute_db(f'UPDATE PersistentData SET FieldValue="{self.tmp_dir}" ' execute_db(f'UPDATE PersistentData SET FieldValue="{self.tmp_dir}" '
f'WHERE FieldName="tempDataDirectory"') f'WHERE FieldName="tempDataDirectory"')
def check_not_found_soh_channels(self):
# FROM data_type_model.Data_Type_Model.check_not_found_soh_channels
all_chans_meet_req = (
list(self.soh_data[self.selected_key].keys()) +
list(self.mass_pos_data[self.selected_key].keys()) +
list(self.log_data[self.selected_key].keys()))
not_found_chans = [c for c in self.req_soh_chans
if c not in all_chans_meet_req]
if not_found_chans != []:
msg = (f"No data found for the following channels: "
f"{', '.join( not_found_chans)}")
self.processing_log.append((msg, LogType.WARNING))
def sort_all_data(self): def sort_all_data(self):
""" """
FROM data_type_model.Data_Type_Model.sort_all_data FROM data_type_model.Data_Type_Model.sort_all_data
...@@ -341,51 +327,51 @@ class GeneralData(): ...@@ -341,51 +327,51 @@ class GeneralData():
because it is created from log data which is sorted in because it is created from log data which is sorted in
prepare_soh_data_from_log_data() prepare_soh_data_from_log_data()
""" """
sort_data(self.waveform_data[self.selected_key]) for key in self.keys:
sort_data(self.mass_pos_data[self.selected_key]) sort_data(self.waveform_data[key])
try: sort_data(self.mass_pos_data[key])
sort_data(self.soh_data[self.selected_key]) try:
except KeyError: sort_data(self.soh_data[key])
# Reftek's SOH trace doesn't have startTmEpoch and except KeyError:
# actually soh_data consists of only one trace # Reftek's SOH trace doesn't have startTmEpoch and
pass # actually soh_data consists of only one trace
pass
def combine_all_data(self): def combine_all_data(self):
combine_data(self.selected_key, self.waveform_data, self.gap_minimum) for key in self.keys:
combine_data(self.selected_key, self.mass_pos_data, self.gap_minimum) combine_data(key, self.waveform_data, self.gap_minimum)
try: combine_data(key, self.mass_pos_data, self.gap_minimum)
combine_data(self.selected_key, self.soh_data, self.gap_minimum) try:
except KeyError: combine_data(key, self.soh_data, self.gap_minimum)
# Reftek's SOH trace doesn't have startTmEpoch and except KeyError:
# actually soh_data consists of only one trace # Reftek's SOH trace doesn't have startTmEpoch and
pass # actually soh_data consists of only one trace
pass
def retrieve_gaps_from_data_dicts(self): def retrieve_gaps_from_data_dicts(self):
""" """
Getting gaps from each data_dicts then squash all related gaps Getting gaps from each data_dicts then squash all related gaps
""" """
self.gaps[self.selected_key] = [] for key in self.keys:
retrieve_gaps_from_data_dict( self.gaps[key] = []
self.selected_key, self.soh_data, self.gaps) retrieve_gaps_from_data_dict(key, self.soh_data, self.gaps)
retrieve_gaps_from_data_dict( retrieve_gaps_from_data_dict(key, self.mass_pos_data, self.gaps)
self.selected_key, self.mass_pos_data, self.gaps) retrieve_gaps_from_data_dict(key, self.waveform_data, self.gaps)
retrieve_gaps_from_data_dict(
self.selected_key, self.waveform_data, self.gaps)
self.gaps[self.selected_key] = squash_gaps( self.gaps[key] = squash_gaps(self.gaps[key])
self.gaps[self.selected_key])
def retrieve_data_time_from_data_dicts(self): def retrieve_data_time_from_data_dicts(self):
""" """
Going through each data_dict to update the data_time to be Going through each data_dict to update the data_time to be
[min of startTimeEpoch, max of endTimeEpoch] for each station. [min of startTimeEpoch, max of endTimeEpoch] for each station.
""" """
retrieve_data_time_from_data_dict( for key in self.keys:
self.selected_key, self.soh_data, self.data_time) retrieve_data_time_from_data_dict(
retrieve_data_time_from_data_dict( key, self.soh_data, self.data_time)
self.selected_key, self.mass_pos_data, self.data_time) retrieve_data_time_from_data_dict(
retrieve_data_time_from_data_dict( key, self.mass_pos_data, self.data_time)
self.selected_key, self.waveform_data, self.data_time) retrieve_data_time_from_data_dict(
key, self.waveform_data, self.data_time)
def fill_empty_data(self): def fill_empty_data(self):
""" """
...@@ -406,12 +392,13 @@ class GeneralData(): ...@@ -406,12 +392,13 @@ class GeneralData():
Applying convert_factor to avoid using flags to prevent double Applying convert_factor to avoid using flags to prevent double
applying convert factor when plotting applying convert factor when plotting
""" """
apply_convert_factor_to_data_dict( for key in self.keys:
self.selected_key, self.soh_data, self.data_type) apply_convert_factor_to_data_dict(
apply_convert_factor_to_data_dict( key, self.soh_data, self.data_type)
self.selected_key, self.mass_pos_data, self.data_type) apply_convert_factor_to_data_dict(
apply_convert_factor_to_data_dict( key, self.mass_pos_data, self.data_type)
self.selected_key, self.waveform_data, self.data_type) apply_convert_factor_to_data_dict(
key, self.waveform_data, self.data_type)
def reset_all_selected_data(self): def reset_all_selected_data(self):
""" """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment