def determine(datadate, numhead):
    Nloops = len(
        os.listdir('G:/data/watchman/' + datadate +
                   '_watchman_spe/d1/d1_50centered'))
    writename10 = 'G:/data/watchman/' + datadate + '_watchman_spe/d1/d1_histograms/10_jitter.txt'
    writename20 = 'G:/data/watchman/' + datadate + '_watchman_spe/d1/d1_histograms/20_jitter.txt'
    writename80 = 'G:/data/watchman/' + datadate + '_watchman_spe/d1/d1_histograms/80_jitter.txt'
    writename90 = 'G:/data/watchman/' + datadate + '_watchman_spe/d1/d1_histograms/90_jitter.txt'
    if not os.path.exists('G:/data/watchman/' + datadate +
                          '_watchman_spe/d1/d1_histograms/histogram_images'):
        os.makedirs('G:/data/watchman/' + datadate +
                    '_watchman_spe/d1/d1_histograms/histogram_images')
    #peak amplitude acquisition
    for i in range(Nloops):
        print(i)
        filename = 'G:/data/watchman/' + datadate + '_watchman_spe/d1/d1_50centered/D1--waveforms--%05d.txt' % i
        (t, y, _) = rw(filename, numhead)
        y_norm = y / min(y)
        check10 = y_norm <= .1  #determining where 10% and 90% are located
        check90 = y_norm >= .9
        index10 = np.asarray([k for k, x in enumerate(check10) if x])
        index90 = np.asarray([k for k, x in enumerate(check90) if x])
        index_90 = int(index90[0] + 0.5)  #turning 90% rising point into int
        index10_removed = index10[np.where(
            index10 < index_90)]  #removing all 10% points after 90% index
        index_10 = int(index10_removed[len(index10_removed) - 1] +
                       0.5)  #turning last 10% index before 90% index into int
        check20 = y_norm <= .2  #determining where 20% and 80% rising are located
        check80 = y_norm >= .8
        index20 = np.asarray([k for k, x in enumerate(check20) if x])
        index80 = np.asarray([k for k, x in enumerate(check80) if x])
        index_80 = int(index80[0] + 0.5)  #turning 80% rising point into int
        index20_removed = index20[np.where(
            index20 < index_80)]  #removing all 20% points after 80% index
        index_20 = int(index20_removed[len(index20_removed) - 1] +
                       0.5)  #turning last 20% index before 90% index into int
        #gathering times at rising 10,20,80,90% points
        t10 = str(t[index_10])
        t20 = str(t[index_20])
        t80 = str(t[index_80])
        t90 = str(t[index_90])
        #writing values to respective histogram files
        wh(t10, writename10)
        wh(t20, writename20)
        wh(t80, writename80)
        wh(t90, writename90)
    #create histograms from saved files
    (histo_mean10, histo_std10) = gh(writename10)
    (histo_mean20, histo_std20) = gh(writename20)
    (histo_mean80, histo_std80) = gh(writename80)
    (histo_mean90, histo_std90) = gh(writename90)
    rh(writename10, "Seconds", "Histogram of 10% Jitter", "10_Jitter",
       datadate, histo_mean10, histo_std10)
    rh(writename20, "Seconds", "Histogram of 20% Jitter", "20_Jitter",
       datadate, histo_mean20, histo_std20)
    rh(writename80, "Seconds", "Histogram of 80% Jitter", "80_Jitter",
       datadate, histo_mean80, histo_std80)
    rh(writename90, "Seconds", "Histogram of 90% Jitter", "90_Jitter",
       datadate, histo_mean90, histo_std90)
Пример #2
0
def determine(datadate, numhead):
    Nloops = len(
        os.listdir(
            'G:/data/watchman/' + datadate +
            '_watchman_spe/d1/d1_50centered'))  #determining size of directory
    writename = 'G:/data/watchman/' + datadate + '_watchman_spe/d1/d1_histograms/20_80_rise_time.txt'  #setting file name to write to
    if not os.path.exists('G:/data/watchman/' + datadate +
                          '_watchman_spe/d1/d1_histograms/histogram_images'
                          ):  #creating write directory if nonexistant
        os.makedirs('G:/data/watchman/' + datadate +
                    '_watchman_spe/d1/d1_histograms/histogram_images')
    #determine rise times
    for i in range(Nloops):
        print(i)
        filename = 'G:/data/watchman/' + datadate + '_watchman_spe/d1/d1_50centered/D1--waveforms--%05d.txt' % i  #setting file name to read from
        (t, y, _) = rw(filename, numhead)  #taking in waveform values
        y_norm = y / min(y)  #normalizing voltage values
        check20 = y_norm <= .2  #determining where 20% and 80% rising are located
        check80 = y_norm >= .8
        index20 = np.asarray([k for k, x in enumerate(check20) if x])
        index80 = np.asarray([k for k, x in enumerate(check80) if x])
        index_80 = int(index80[0] + 0.5)
        index20_removed = index20[np.where(
            index20 < index_80)]  #removing all values after 80% rise index
        index_20 = int(index20_removed[len(index20_removed) - 1] +
                       0.5)  #turning last 20% rise index into int
        rise_time = str(t[index_80] -
                        t[index_20])  #rise time is time at 80% - time at 10%
        wh(rise_time, writename)  #writing value to histogram txt file
    #create histogram from saved file
    (histo_mean, histo_std) = gh(writename)
    rh(writename, "Seconds", "Histogram of 20-80 Rise Times", "20_80_Rise",
       datadate, histo_mean, histo_std)
Пример #3
0
def determine(datadate, numhead):
    Nloops = len(
        os.listdir('G:/data/watchman/' + datadate +
                   '_watchman_spe/d1/d1_50centered'))
    writename = 'G:/data/watchman/' + datadate + '_watchman_spe/d1/d1_histograms/charge.txt'
    if not os.path.exists('G:/data/watchman/' + datadate +
                          '_watchman_spe/d1/d1_histograms/histogram_images'):
        os.makedirs('G:/data/watchman/' + datadate +
                    '_watchman_spe/d1/d1_histograms/histogram_images')
    #determining charge
    for i in range(Nloops):
        print(i)
        area = 0
        filename = 'G:/data/watchman/' + datadate + '_watchman_spe/d1/d1_50centered/D1--waveforms--%05d.txt' % i
        (t, y, _) = rw(filename, numhead)
        #determining area under curve
        for i in range(len(y) - 1):
            area += ((t[i + 1] - t[i]) * y[i])
        charge = str(
            -1 * area / 50
        )  #area under curve/resistance gives charge, made positive for graphical reasons
        wh(charge, writename)
    #create histogram from saved file
    (histo_mean, histo_std) = gh(writename)
    rh(writename, "Coulombs", "Histogram of Charges", "Charge", datadate,
       histo_mean, histo_std)
Пример #4
0
def determine(datadate, numhead):
    Nloops = len(
        os.listdir(
            'G:/data/watchman/' + datadate +
            '_watchman_spe/d1/d1_50centered'))  #determining size of directory
    writename = 'G:/data/watchman/' + datadate + '_watchman_spe/d1/d1_histograms/10_90_fall_time.txt'  #setting file name to write to
    if not os.path.exists('G:/data/watchman/' + datadate +
                          '_watchman_spe/d1/d1_histograms/histogram_images'
                          ):  #creating write directory if nonexistant
        os.makedirs('G:/data/watchman/' + datadate +
                    '_watchman_spe/d1/d1_histograms/histogram_images')
    #determine fall times
    for i in range(Nloops):
        print(i)
        filename = 'G:/data/watchman/' + datadate + '_watchman_spe/d1/d1_50centered/D1--waveforms--%05d.txt' % i  #setting file name to read from
        (t, y, _) = rw(filename, numhead)  #taking in waveform values
        y_norm = y / min(y)  #normalizing voltage values
        check10 = y_norm <= .1  #determining where 10% and 90% falling are located
        check90 = y_norm >= .9
        index10 = np.asarray([k for k, x in enumerate(check10) if x])
        index90 = np.asarray([k for k, x in enumerate(check90) if x])
        index_90 = int(index90[len(index90) - 1] + 0.5)
        index10_removed = index10[np.where(
            index10 > index_90)]  #removing all values before 90% fall index
        index_10 = int(index10_removed[0] +
                       0.5)  #turning first 10% fall index into int
        fall_time = str(t[index_10] -
                        t[index_90])  #fall time is time at 10% - time at 90%
        wh(fall_time, writename)  #writing value to histogram txt file
    #create histogram from saved file
    (histo_mean, histo_std) = gh(writename)
    rh(writename, "Seconds", "Histogram of 10-90 Fall Times", "10_90_Fall",
       datadate, histo_mean, histo_std)
Пример #5
0
def determine(datadate,numhead,directory):
    Nloops = len(os.listdir('G:/data/watchman/'+datadate+'_watchman_spe/d2/d2_'+directory))
    if directory == 'raw':
        Nloops -= 1
    writename = 'G:/data/watchman/'+datadate+'_watchman_spe/d2/d2_histograms/10_90_rise_time_'+directory+'.txt'
    if not os.path.exists('G:/data/watchman/'+datadate+'_watchman_spe/d2/d2_histograms/histogram_images/'):
        os.makedirs('G:/data/watchman/'+datadate+'_watchman_spe/d2/d2_histograms/histogram_images/')
    #determine rise times
    for i in range(Nloops):
        print(i)
        filename = 'G:/data/watchman/'+datadate+'_watchman_spe/d2/d2_'+directory+'/D2--waveforms--%05d.txt' % i
        (t,y,_) = rw(filename,numhead)
        y_norm = y/min(y)
        check10 = y_norm <= .1                                      #determining where 10% and 90% are located
        check90 = y_norm >= .9
        index10 = np.asarray([k for k, x in enumerate(check10) if x])
        index90 = np.asarray([k for k, x in enumerate(check90) if x])
        index_90 = int(index90[0] + 0.5)
        index10_removed = index10[np.where(index10 < index_90)]     #removing all values after 90% rise index
        index_10 = int(index10_removed[len(index10_removed)-1] + 0.5)   #turning last 10% rise index into int
        rise_time = str(t[index_90] - t[index_10])                  #rise time is time at 90% - time at 10%
        wh(rise_time,writename)                                     #writing value to histogram txt file
    #create histogram from saved file
    (histo_mean,histo_std) = gh(writename)
    rh(writename,"Seconds","Histogram of 10-90 Rise Times","10_90_Rise_"+directory,datadate,histo_mean,histo_std)
Пример #6
0
def determine(datadate,numhead):
    Nloops = len(os.listdir('G:/data/watchman/'+datadate+'_watchman_spe/d2/d2_raw')) - 1
    writename = 'G:/data/watchman/'+datadate+'_watchman_spe/d2/d2_histograms/raw_peak_amplitude.txt'
    if not os.path.exists('G:/data/watchman/'+datadate+'_watchman_spe/d2/d2_histograms/histogram_images'):
        os.makedirs('G:/data/watchman/'+datadate+'_watchman_spe/d2/d2_histograms/histogram_images')
    #peak amplitude acquisition
    for i in range(Nloops):
        print(i)
        filename = 'G:/data/watchman/'+datadate+'_watchman_spe/d2/d2_raw/D2--waveforms--%05d.txt' % i
        (_,y,_) = rw(filename,numhead)
        index_min = np.where(y == min(y))               #determining index of peak
        value = str((-1*y[index_min])[0])               #flipping peak to positive
        wh(value,writename)                             #writing value to histogram txt file
    #create histogram from saved file
    (histo_mean,histo_std) = gh(writename)
    rh(writename,"Volts","Histogram of Peak Amplitudes","Peak_Amplitude",datadate,histo_mean,histo_std)
Пример #7
0
def determine(datadate, numhead):
    Nloops = len(
        os.listdir('G:/data/watchman/' + datadate +
                   '_watchman_spe/d1/d1_50centered'))
    writename = 'G:/data/watchman/' + datadate + '_watchman_spe/d1/d1_histograms/FWHM.txt'
    if not os.path.exists('G:/data/watchman/' + datadate +
                          '_watchman_spe/d1/d1_histograms/histogram_images'):
        os.makedirs('G:/data/watchman/' + datadate +
                    '_watchman_spe/d1/d1_histograms/histogram_images')
    #determine rise times
    for i in range(Nloops):
        print(i)
        filename = 'G:/data/watchman/' + datadate + '_watchman_spe/d1/d1_50centered/D1--waveforms--%05d.txt' % i
        (t, y, _) = rw(filename, numhead)
        y_norm = y / min(y)
        check = y_norm <= .5  #determining where values under 50% are
        check_peak = y_norm == 1  #determining where peak is
        index_peak = np.asarray([k for k, x in enumerate(check_peak) if x])
        peak_index = int(index_peak[0] + 0.5)  #turning peak index into int
        index = np.asarray([k for k, x in enumerate(check) if x])
        index_low = index[np.where(
            index < peak_index)]  #removing all values after peak
        index_high = index[np.where(
            index > peak_index)]  #removing all values before peak
        index_first = int(index_low[len(index_low) - 1] +
                          0.5)  #turning last 50% point before peak into int
        index_last = int(index_high[0] +
                         0.5)  #turning first 50% point after peak into int
        FWHM = str(
            t[index_last] -
            t[index_first])  #FWHM is time at falling 50% - time at rising 50%
        wh(FWHM, writename)  #writing to histogram txt file
    #create histogram from saved file
    (histo_mean, histo_std) = gh(writename)
    rh(writename, "Seconds", "Histogram of Full Width Half Maximums", "FWHM",
       datadate, histo_mean, histo_std)