#!/usr/bin/env python3 from perseus.client import ModuleClient import sys, time, numpy, scipy.signal import os import sys # # This is the de-test version of waveform-stats.py 23-Dec-2025 # ------------------ # # Run in a pylab environment. Does not save plots, but will show them. # Run e.g. as ipython --pylab -i waveform-stats.py discokraken_XXXXXX.local # # Shows a snapshot of the waveforms, power spectra, cross-correlation, and # noise statistics. The trigger rates shown probe non-Gaussianity beyond # the quoted noise levels. # # An optional set of channels to plot can follow the hostname, e.g. # ipython --pylab -i waveform-stats.py discokraken_XXXXXX.local 0 3 6 # will show data for channels 0, 3, and 6 only m = ModuleClient(sys.argv[1]) m.tuber_resolve() channels = list(range(16)) if len(sys.argv) > 2: channels = [int(i) for i in sys.argv[2:]] t = m.trigger print('Running for %.2f seconds' % (t.current_sample()/208.3333333e6)) print('Mean: ', t.channel_means(100)) print('RMS: ', t.channel_rms(100)) print(t.timecode_sync_data()) t.set_thresholds([int(i + 3) for i in t.channel_means()]) t.enable_scalers() print('Rates at +3 counts trigger (Hz): ', [('%.1f' % i) for i in t.trigger_rates(3)]) t.set_thresholds([int(i + 5) for i in t.channel_means()]) t.enable_scalers() print('Rates at +5 counts trigger (Hz): ', [('%.1f' % i) for i in t.trigger_rates(3)]) wf = numpy.asarray(m.trigger.get_waveforms(2048)) fig, p = pylab.subplots(1, 1) for i in channels: p.plot(wf[i], label='Channel %d' % i) p.set_xlabel('Sample Index (4.8 ns)') p.set_ylabel('ADC Counts') p.set_title('Sample Waveforms') p.legend(ncols=4) fig.show()