@@ -2401,11 +2401,6 @@ def _save_temp_and_render(signal, file, data_type, fs, beats_ix,
24012401 data_edited .insert (artifact_col_pos , 'Artifact' , None )
24022402 data_edited .loc [artifacts_edited , 'Artifact' ] = 1
24032403
2404- # Save edited data
2405- data_edited .to_csv (
2406- str (temp_path / f'{ file } _edited.csv' ),
2407- index = False )
2408-
24092404 # Recompute IBIs with edited beats for rendering
24102405 ibi_edited = physioview .compute_ibis (
24112406 data_edited , fs , data_edited_beats_ix , ts_col )
@@ -2419,7 +2414,7 @@ def _save_temp_and_render(signal, file, data_type, fs, beats_ix,
24192414 ends = [unusable_ix [- 1 ]]
24202415 else :
24212416 starts = np .insert (unusable_ix [breaks + 1 ], 0 , unusable_ix [0 ])
2422- ends = np .insert (unusable_ix [breaks ], 0 , unusable_ix [- 1 ])
2417+ ends = np .append (unusable_ix [breaks ], unusable_ix [- 1 ])
24232418
24242419 unusable_bounds = list (zip (starts , ends ))
24252420 for s , e in unusable_bounds :
@@ -2440,11 +2435,15 @@ def _save_temp_and_render(signal, file, data_type, fs, beats_ix,
24402435 if artif_post_ix is not None :
24412436 data_edited .loc [artif_post_ix , 'Artifact' ] = np .nan
24422437
2438+ # Save edited data
2439+ data_edited .to_csv (
2440+ str (temp_path / f'{ file } _edited.csv' ), index = False )
2441+
24432442 # Render updated signal plots
24442443 signal_plots = physioview .plot_signal (
24452444 signal = data_edited , signal_type = data_type ,
24462445 axes = (x_axis_label , 'Signal' ), fs = fs ,
2447- peaks_map = {data_type : 'Edited Beat ' },
2446+ peaks_map = {data_type : 'Edited' },
24482447 peaks_label = 'Edited Beat' ,
24492448 peaks_color = '#71b4eb' ,
24502449 edits_map = {data_type : {'Add' : 'Added Beat' ,
@@ -2944,8 +2943,8 @@ def toggle_beat_editor(beat_editor_clicked, apply_beats_clicked,
29442943 [Output ('postprocess-modal' , 'is_open' , allow_duplicate = True ),
29452944 Output ('postprocess-options' , 'options' )],
29462945 [Input ('postprocess-data' , 'n_clicks' ),
2947- Input ('cancel-postprocess' , 'n_clicks' )] ,
2948- [ State ('data-dropdown' , 'value' ),
2946+ Input ('cancel-postprocess' , 'n_clicks' ),
2947+ State ('data-dropdown' , 'value' ),
29492948 State ('postprocess-modal' , 'is_open' ),
29502949 State ('memory-db' , 'data' )],
29512950 prevent_initial_call = True
0 commit comments