Example #1
0
else:
    run, part, path, numwaves, startrow = sys.argv[1:6]
if not path.endswith('/'):
    path += '/'
numwaves = int(numwaves)
startrow = int(startrow)
length = 3500

#for i in range(4,len(sys.argv[4:])):        #PARSE ARGS LIKE IN ca_analysis.py

name = 'Run_' + str(run) + '_' + str(part) + '.bin'

data = fr.raw(path + name, length=length, numwaves=numwaves, row=startrow)
bd, ch = 4, 3
data = pd.single_pixel(data, bd, ch)
wo.baseline_restore(data, pretrigger=600)

tbins = np.linspace(0, length - 1, length)

#Making trap to plot on top of Waveform
rise, top, fall = 400, 70, 1050
trapar = np.zeros(len(tbins))
wo.trap(trapar, rise, top, fall)
#

emin, emax = 100., 10000.

fs = 15

for i in range(len(data)):
    convolution = signal.fftconvolve(data[i]['wave'],
    if rank > 0:
        print('Starting on ' + name)
        chunk = int((os.stat(run).st_size - 8) / 7033)
        chunk = int(chunk / (size - 1))
        row = (rank - 1) * chunk

        numwaves = chunk
        if rank == size - 1:
            numwaves = chunk + int(
                (os.stat(run).st_size - 8) / 7033) % (size - 1)

        data = fr.raw(run, length=3500, row=row, numwaves=numwaves)
        numwaves = len(data)

        wo.baseline_restore(data, 600)
        length = 3500

        t = np.arange(length)
        out = np.zeros(length)
        trap = np.zeros(length)
        fall = 0
        maxouts = 0
        omega = 2 * np.pi / length
        pars = []
        beg = time.time()
        sys.stdout.flush()
        for i in range(numwaves):
            if i % int(numwaves / 100) == 0 and rank == 1:
                string = 'Done with {:0.2f}%'.format(100 * i / numwaves)
                sys.stdout.write(string)
Example #3
0
                                          row=row + i * piece)
                            writebuffer[0:piece + rem]['result'], writebuffer[
                                0:piece +
                                rem]['evID'], writebuffer[0:piece + rem][
                                    'board'], writebuffer[0:piece + rem][
                                        'channel'], writebuffer[0:piece + rem][
                                            'timestamp'], writebuffer[
                                                0:piece +
                                                rem]['requesttime'] = data[
                                                    'result'], data['evID'], data[
                                                        'board'], data[
                                                            'channel'], data[
                                                                'timestamp'], data[
                                                                    'requesttime']
                            wo.baseline_restore(
                                data, 600
                            )  #restores baseline and performs necessary preformatting of the data (data & 16383...)
                            #smooth_wave= signal.filtfilt(b,a,data['wave'])
                            wo.maxes(waves=data['wave'],
                                     startpoint=500,
                                     wavelength=length,
                                     maxamps=maxamps[0:piece + rem],
                                     maxlocs=maxamps[0:piece + rem])
                            wo.rises(data['wave'], maxamps[0:piece + rem],
                                     maxamps[0:piece + rem],
                                     risetimes[0:piece + rem])
                            writebuffer[0:piece +
                                        rem]['risetime'] = risetimes[0:piece +
                                                                     rem]

                            if fitting == 1:
Example #4
0
        tot = chunk + rem
        data = fr.raw(inpath + name,
                      length=length,
                      numwaves=tot,
                      row=i * chunk)
        for j in range(len(timestamps)):
            x = data[pd.land(
                pd.land(data['timestamp'] == timestamps[j]['timestamp'],
                        data['board'] == timestamps[j]['board']),
                data['channel'] == timestamps[j]['channel'])]
            count += len(x)
            if len(x) > 0:
                #                print x['board'],x['channel'],x['timestamp']
                temp[count - 1] = x
print(temp['board'])
wo.baseline_restore(temp, 600)
tbins = np.arange(3500)
#for i in range(len(temp)):
with PdfPages('fallwaves.pdf') as pdf:
    for j in range(int(portion), len(timestamps)):
        #        print temp[temp['timestamp']==timestamps[j]['timestamp']]['wave'][0]
        if timestamps[j]['board'] > 2:
            plt.plot(
                tbins,
                temp[temp['timestamp'] == timestamps[j]
                     ['timestamp']]['wave'][0],
                label='falltime = ' + str(timestamps[j]['falltime']) + '\n ' +
                pd.pixel(timestamps[j]['board'], timestamps[j]['channel']))
            plt.legend(fontsize=20)
            plt.tight_layout()
            pdf.savefig()