Exemplo n.º 1
0
        T = re.search('_(.*)C.bin', file)
        print T.group(1)
        Temperature.append(T.group(1))
    print "Files to read: ", DataList
    print "Temperatures:  ", Temperature

    #	NormalizeTimeAlignedWaveforms = np.empty([len(DataList), NoOfWaveforms])
    for F, file in enumerate(DataList):
        print "Reading ", file
        ## Read in N waveforms from bin file.
        ## For each waveform with a peak above PeakThreshold,
        ## do a baseline correction and time alignment of the sample at which
        ## the signal crosses 'Threshold'.
        ## Normalise each signal
        ## Add signals together and divide by NoOfWaveforms to get the average signal.
        FID, cols, rows = PSD.OpenFile(file)
        #print cols, rows
        ## ReadBinary(..) returns a NxM matrix of waveforms. FID = fileID, NoOfWaveforms.
        AllWaveforms = np.array(
            PSD.ReadBinaryFile(FID, ReadWaveforms, cols, rows))

        # Remove waveforms that show saturation. i.e. Ones in which the maximum value is 100mV
        AllWaveforms = RemoveSaturation(AllWaveforms, SatLimit)
        if (RandomSample):
            # Randomly select NoOfWaveforms from all the waveforms.
            Selection = random.sample(AllWaveforms, np.shape(AllWaveforms)[0])
        if (not RandomSample):
            ## Or... find the NoOfWaveforms that have the greatest sum (Largest Signals)
            SumAllWaveforms = PSD.GetFullIntegral(AllWaveforms)
            ## Get NoOfWaveforms indices of the AllWaveforms
            N_Max = SumAllWaveforms.argsort()[-NoOfWaveforms:]