Data format » History » Version 2
Anonymous, 03/05/2020 03:23 PM
1 | 1 | Anonymous | h1. Data format |
---|---|---|---|
2 | |||
3 | <pre><code class="python"> |
||
4 | def readFileADLINKCh0( filename, samplesPerFile, timeSerie_A ): |
||
5 | fd = open(filename,'rb') |
||
6 | |||
7 | dum = np.fromfile(fd, dtype = np.uint16) |
||
8 | |||
9 | timeSerie_A[:] = dum[:] |
||
10 | |||
11 | fd.close() |
||
12 | </code></pre> |
||
13 | |||
14 | <pre><code class="python"> |
||
15 | lastBuffer = (nbFiles-1) * buffersPerFile + firstBuffer |
||
16 | for k in range( nbFiles ): |
||
17 | |||
18 | # read the data |
||
19 | nb = str( int( k * buffersPerFile + firstBuffer) ) |
||
20 | filename = data_dir + "/record" + nb + ".bin" |
||
21 | readFileADLINKCh0( filename, samplesPerFile, timeSerie_A ) |
||
22 | |||
23 | print("k = {}, block = {} / {}".format(k, nb, lastBuffer)) |
||
24 | |||
25 | adc_A[ k, : ] = (timeSerie_A + offset) * scalingFactor |
||
26 | </code></pre> |
||
27 | 2 | Anonymous | |
28 | Les données étant lues, on remet en forme le vecteur pour ne garder que le signal correspondant aux rampes montantes: |
||
29 | |||
30 | <pre><code class="python"> |
||
31 | A_reshaped = adc_A.reshape(nbFiles * rampsPerFile, samplesPerRamp) |
||
32 | </code></pre> |