Skip to content

Commit 49a620b

Browse files
committed
New file
1 parent 1c1bf29 commit 49a620b

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

docs/source/plot_quadem.pro

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
; Program to read HDF5 file for streamed quadEM data, plot it
2+
data = h5_getdata('J:\epics\scratch\quadEM_HDF5_001.h5', '/entry/data/data')
3+
help, data
4+
; Convert from a 3-D array [11, 2000, 200] to a 2-D array [11, 400000]
5+
data = reform(data, 11, 400000)
6+
; Extract the SumAll data
7+
sum_all = data[6, *]
8+
; Compute the time axis, 50 microseconds/sample
9+
time = findgen(400000) * 50e-6
10+
; Plot the first 0.5 second of data
11+
p1 = plot(time[0:9999], sum_all[0:9999], xtitle='Time (s)', ytitle='Sum of all diodes (nA)', $
12+
title='Time Series', color='blue')
13+
p1.save, 'IDL_HDF5_time_plot.png'
14+
; Compute the FFT
15+
f = fft(sum_all)
16+
; Take the absolute value, first half of array
17+
f_abs = (abs(f))[0:199999]
18+
; Set the DC offset to 0
19+
f_abs[0] = 0
20+
; Compute the frequency axis. The sampling rate is 20 kHz so the Nyquist frequency is 10 kHz
21+
freq = findgen(200000)/199999. * 10000.
22+
; Plot the data out to 1 kHz
23+
p2 = plot(freq[0:19999], f_abs[0:199999], xtitle='Frequency (Hz)', ytitle='SumAll Intensity', $
24+
title='Power Spectrum', color='red', /ylog, yrange=[.01,100])
25+
p2.save, 'IDL_HDF5_frequency_plot.png'
26+
end

0 commit comments

Comments
 (0)