Skip to content

Commit

Permalink
Merge pull request #852 from anarkiwi/config
Browse files Browse the repository at this point in the history
title metadata.
  • Loading branch information
anarkiwi authored Sep 6, 2023
2 parents 679e3d6 + ad5c385 commit 70483e8
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
32 changes: 27 additions & 5 deletions gamutrf/waterfall.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,27 @@ def safe_savefig(path):


def draw_title(
ax, title, scan_duration, tune_rate_hz, tune_dwell_ms, sample_rate, freq_resolution
ax,
title,
scan_duration,
tune_step_hz,
tune_step_fft,
tune_rate_hz,
tune_dwell_ms,
sample_rate,
freq_resolution,
):
title_text = {
"Time": str(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")),
"Scan duration": "%.2fs" % scan_duration,
"Retuning rate": "%.2fHz" % tune_rate_hz,
"Tuning dwell time": "%.2fms" % tune_dwell_ms,
"Scan time": "%.2fs" % scan_duration,
"Step FFTs": "%u" % tune_step_fft,
"Step size": "%.2fMHz" % (tune_step_hz / 1e6),
"Sample rate": "%.2fMsps" % (sample_rate / 1e6),
"Resolution": "%.2fMHz" % freq_resolution,
"Tune rate": "%.2fHz" % tune_rate_hz,
"Tune dwell time": "%.2fms" % tune_dwell_ms,
}
title.set_fontsize(8)
title.set_text(str(title_text))
ax.draw_artist(title)

Expand Down Expand Up @@ -295,7 +306,12 @@ def reset_fig(
state.ax_psd = state.fig.add_subplot(3, 1, 1)
state.ax = state.fig.add_subplot(3, 1, (2, 3))
state.psd_title = state.ax_psd.text(
0.5, 1.05, "", transform=state.ax_psd.transAxes, va="center", ha="center"
0.5,
1.05,
"",
transform=state.ax_psd.transAxes,
va="center",
ha="center",
)
default_data = state.db_min * np.ones(state.freq_data.shape[1])

Expand Down Expand Up @@ -553,6 +569,10 @@ def update_fig(config, state, results):
scan_duration = 0

for scan_configs, scan_df in results:
tune_step_hz = min(scan_config["tune_step_hz"] for scan_config in scan_configs)
tune_step_fft = min(
scan_config["tune_step_fft"] for scan_config in scan_configs
)
scan_duration = scan_df.ts.max() - scan_df.ts.min()
tune_count = scan_df.tune_count.max()
tune_rate_hz = tune_count / scan_duration
Expand Down Expand Up @@ -670,6 +690,8 @@ def update_fig(config, state, results):
state.ax_psd,
state.psd_title,
scan_duration,
tune_step_hz,
tune_step_fft,
tune_rate_hz,
tune_dwell_ms,
config.sampling_rate,
Expand Down
2 changes: 2 additions & 0 deletions tests/test_waterfall.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ def read_buff(self, scan_fres):
"nfft": 256,
"freq_start": df.freq.min(),
"freq_end": df.freq.max(),
"tune_step_hz": scan_fres,
"tune_step_fft": 256,
}
],
df,
Expand Down

0 comments on commit 70483e8

Please sign in to comment.