Skip to content

Commit

Permalink
add replace nan to zero in visualize tick in main window
Browse files Browse the repository at this point in the history
  • Loading branch information
ApocalyVec committed Sep 16, 2021
1 parent 7d0506e commit 1892f6b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions MainWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,12 @@ def add_preset_experiment_clicked(self):
if selected_text in self.experiment_presets_dict.keys():
streams_for_experiment = self.experiment_presets_dict[selected_text]
try:
assert np.all([x in self.lslStream_presets_dict.keys() or x in self.device_presets_dict.keys() for x in streams_for_experiment])
assert np.all([x in self.lslStream_presets_dict.keys() or x in self.device_presets_dict.keys() for x in
streams_for_experiment])
except AssertionError:
dialog_popup(msg="One or more stream name(s) in the experiment preset is not defined in LSLPreset or DevicePreset", title="Error")
dialog_popup(
msg="One or more stream name(s) in the experiment preset is not defined in LSLPreset or DevicePreset",
title="Error")
return
loading_dlg = dialog_popup(
msg="Please wait while streams are being added...",
Expand All @@ -239,6 +242,7 @@ def add_preset_experiment_clicked(self):
self.device_combo_box.setCurrentIndex(index)
self.add_preset_device_clicked()
loading_dlg.close()

def init_lsl(self, preset):
lsl_stream_name = preset['StreamName']
if lsl_stream_name not in self.lsl_workers.keys(): # if this inlet hasn't been already added
Expand Down Expand Up @@ -517,6 +521,7 @@ def visualize_LSLStream_data(self):

# reduce the number of points to plot to the number of pixels in the corresponding plot widget
if data_to_plot.shape[-1] > config.DOWNSAMPLE_MULTIPLY_THRESHOLD * max_display_datapoint_num:
data_to_plot = np.nan_to_num(data_to_plot, nan=0)
data_to_plot = decimate(data_to_plot, q=int(data_to_plot.shape[-1] / max_display_datapoint_num),
axis=1) # resample to 100 hz with retain history of 10 sec
time_vector = np.linspace(0., config.PLOT_RETAIN_HISTORY, num=data_to_plot.shape[-1])
Expand Down Expand Up @@ -548,7 +553,6 @@ def init_eeg_buffer(self):
def init_unityLSL_buffer(self):
self.unityLSL_data_buffer = np.empty(shape=(config.UNITY_LSL_CHANNEL_SIZE, 0))


def relaod_all_presets_btn_clicked(self):
if self.reload_all_presets():
self.update_presets_combo_box()
Expand Down

0 comments on commit 1892f6b

Please sign in to comment.