Skip to content

Commit 3a39b0c

Browse files
authored
feature: improvements from testing (#136)
* feature: improvements from testing * feature: improvements from testing * feature: improvements from testing * feature: improvements from testing * Jack up the buffers * tuning things * tuning things * Fix plotter * Add obvious plotting * Add obvious plotting
1 parent d6a34b6 commit 3a39b0c

5 files changed

Lines changed: 532 additions & 197 deletions

File tree

synapse/cli/offline_hdf5_plotter.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,11 @@ def plot(plot_data, console):
242242
plot_single.showGrid(x=True, y=True)
243243

244244
# Create a curve for the single channel
245+
initial_data = plot_data.data.iloc[:, 0].to_numpy()
246+
initial_data_centered = initial_data - np.mean(initial_data)
245247
curve_single = plot_single.plot(
246248
time_arr,
247-
plot_data.data.iloc[:, 0].to_numpy(),
249+
initial_data_centered,
248250
pen=pg.intColor(0, hues=plot_data.num_channels),
249251
name=f"Ch {plot_data.channel_ids[0]}",
250252
)
@@ -280,13 +282,15 @@ def update_single_channel(channel_id):
280282
return
281283

282284
# Update time domain plot
283-
curve_single.setData(time_arr, plot_data.data.iloc[:, channel_index].to_numpy())
285+
channel_data = plot_data.data.iloc[:, channel_index].to_numpy()
286+
channel_data_centered = channel_data - np.mean(channel_data)
287+
curve_single.setData(time_arr, channel_data_centered)
284288
curve_single.setPen(pg.intColor(channel_index, hues=plot_data.num_channels))
285289

286290
# Update FFT plot
287291
fft_plot.clear()
288292
fft_freq, fft_magnitude = compute_fft(
289-
plot_data.data.iloc[:, channel_index].to_numpy(), plot_data.sample_rate
293+
channel_data_centered, plot_data.sample_rate
290294
)
291295

292296
# Plot FFT with improved visibility

synapse/cli/offline_plot.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,9 @@ def plot(args):
172172
console.print(
173173
"[yellow bold]Legacy plotting is deprecated, please use the hdf5 files going forward[/yellow bold]"
174174
)
175+
console.print(
176+
"[yellow bold]Use --data <path_to_hdf5_file> to plot hdf5 files[/yellow bold]"
177+
)
175178

176179
app = QtWidgets.QApplication.instance()
177180
if not app:

0 commit comments

Comments
 (0)