Project

General

Profile

Data format » History » Revision 2

Revision 1 (Anonymous, 03/05/2020 03:22 PM) → Revision 2/21 (Anonymous, 03/05/2020 03:23 PM)

h1. Data format 

 <pre><code class="python"> 
 def readFileADLINKCh0( filename, samplesPerFile, timeSerie_A ): 
     fd = open(filename,'rb') 
    
     dum = np.fromfile(fd, dtype = np.uint16) 

     timeSerie_A[:] = dum[:] 
    
     fd.close() 
 </code></pre> 

 <pre><code class="python"> 
 lastBuffer = (nbFiles-1) * buffersPerFile + firstBuffer 
 for k in range( nbFiles ): 
    
     # read the data 
     nb = str( int( k * buffersPerFile + firstBuffer) ) 
     filename = data_dir + "/record" + nb + ".bin" 
     readFileADLINKCh0( filename, samplesPerFile, timeSerie_A ) 
    
     print("k = {}, block = {} / {}".format(k, nb, lastBuffer)) 
    
     adc_A[ k, : ] = (timeSerie_A + offset) * scalingFactor 
 </code></pre> 

 Les données étant lues, on remet en forme le vecteur pour ne garder que le signal correspondant aux rampes montantes: 

 <pre><code class="python"> 
 A_reshaped = adc_A.reshape(nbFiles * rampsPerFile, samplesPerRamp) 
 </code></pre>