Moved figure legends to be display on y axis labels, and turned the legends off.

This commit is contained in:
2024-11-15 16:28:59 +01:00
parent a414f6217d
commit 54f13ea880

View File

@ -80,7 +80,7 @@ def create_loaded_file_figure(file_path, instfolder):
y = dataset[target_channels[i]][:], y = dataset[target_channels[i]][:],
mode = 'lines', mode = 'lines',
name = target_channels[i]), row=trace_idx, col=1) name = target_channels[i]), row=trace_idx, col=1)
fig.update_yaxes(row=trace_idx, col=1) fig.update_yaxes(title_text= target_channels[i], row=trace_idx, col=1)
trace_idx = trace_idx + 1 trace_idx = trace_idx + 1
dataset = DataOpsAPI.file_obj[diagnostic_loc] dataset = DataOpsAPI.file_obj[diagnostic_loc]
@ -91,10 +91,10 @@ def create_loaded_file_figure(file_path, instfolder):
y = dataset[diagnostic_channels[i]][:], y = dataset[diagnostic_channels[i]][:],
mode = 'lines', mode = 'lines',
name = diagnostic_channels[i]), row=trace_idx, col=1) name = diagnostic_channels[i]), row=trace_idx, col=1)
fig.update_yaxes(row=trace_idx, col=1, type="log") fig.update_yaxes(title_text= diagnostic_channels[i], row=trace_idx, col=1, type="log")
trace_idx = trace_idx + 1 trace_idx = trace_idx + 1
fig.update_layout(height=1200, title_text=f"{instfolder} : Target and Diagnostic Channels") fig.update_layout(height=1200, title_text=f"{instfolder} : Target and Diagnostic Channels", showlegend=False)
DataOpsAPI.unload_file_obj() DataOpsAPI.unload_file_obj()
@ -146,6 +146,9 @@ class FlaggingAppDataManager():
if not instFolder in file_obj: if not instFolder in file_obj:
raise ValueError(f'Invalid instrument name. Instrument folder {instFolder} was not found in file {self.file_path}.') raise ValueError(f'Invalid instrument name. Instrument folder {instFolder} was not found in file {self.file_path}.')
if '_'.join([instFolder,'flags']) not in flag_obj:
raise RuntimeWarning(f'There is no flags to apply. ')
if not ('diagnostic_channels' in file_obj[instFolder].attrs and 'target_channels' in file_obj[instFolder].attrs): if not ('diagnostic_channels' in file_obj[instFolder].attrs and 'target_channels' in file_obj[instFolder].attrs):
raise ValueError( raise ValueError(
f'Required attributes missing. Instrument folder {instFolder} in file {self.file_path} has to be annotated with ' f'Required attributes missing. Instrument folder {instFolder} in file {self.file_path} has to be annotated with '
@ -201,14 +204,14 @@ class FlaggingAppDataManager():
) )
#dt.strftime(ref_datetime_format).apply(lambda x: x.tobytes() if pd.notnull(x) else b'') # Split full datasetname instFolder/fileName/datatable --> [instFolder, filename, datatable]
dataset_name_parts = dataset_name.split('/') dataset_name_parts = dataset_name.split('/')
# Create new instFolder name to store dataset after applying flags
newInstFolder = '_'.join([dataset_name_parts[0],'cleaned']) newInstFolder = '_'.join([dataset_name_parts[0],'cleaned'])
dataset_name_parts.remove(dataset_name_parts[0]) dataset_name_parts.remove(dataset_name_parts[0])
# Put together relative datasetname. Note that instFolder is now missing.
flagged_dataset_name = '/'.join(dataset_name_parts) flagged_dataset_name = '/'.join(dataset_name_parts)
dataset_dict = {'attributes':{}, dataset_dict = {'attributes':{},
'name':flagged_dataset_name, 'name':flagged_dataset_name,
'data': utils.convert_dataframe_to_np_structured_array(dataset_df)} 'data': utils.convert_dataframe_to_np_structured_array(dataset_df)}