Пример #1
0
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)

#The below are not ALL pulser points, but a set that has been precalculated and can be used
#if you wish to skip the calculation finding them.
template_dirs = {
    'run793':{  'dir':'/home/dsouthall/Projects/Beacon/beacon/analysis/templates/run793_4',
                'resample_factor' : 200,
                'crit_freq_low_pass_MHz' : 75,
                'crit_freq_high_pass_MHz' : 15,
                'filter_order' : 6,
    }
}

known_pulser_ids = info.loadPulserEventids()
ignorable_pulser_ids = info.loadPulserIgnorableEventids()

def rfftWrapper(waveform_times, *args, **kwargs):
    spec = numpy.fft.rfft(*args, **kwargs)
    real_power_multiplier = 2.0*numpy.ones_like(spec) #The factor of 2 because rfft lost half of the power except for dc and Nyquist bins (handled below).
    if len(numpy.shape(spec)) != 1:
        real_power_multiplier[:,[0,-1]] = 1.0
    else:
        real_power_multiplier[[0,-1]] = 1.0
    spec_dbish = 10.0*numpy.log10( real_power_multiplier*spec * numpy.conj(spec) / len(waveform_times)) #10 because doing power in log.  Dividing by N to match monutau. 
    freqs = numpy.fft.rfftfreq(len(waveform_times), d=(waveform_times[1] - waveform_times[0])/1.0e9)
    return freqs, spec_dbish

def loadTemplates(template_path):
    waveforms = {}
Пример #2
0
        crit_freq_high_pass_MHz = None  #30#None#50
        high_pass_filter_order = None  #8#None#8

        apply_phase_response = True
        use_filter = True

        plot_filters = True
        plot_multiple = True

        hilbert = False  #Apply hilbert envelope to wf before correlating
        #align_method = 8

        plot_filters = True

        known_pulser_ids = info.loadPulserEventids(remove_ignored=True)

        #Prepare eventids

        eventids = {}
        eventids['hpol'] = numpy.sort(known_pulser_ids['run%i' % run]['hpol'])
        eventids['vpol'] = numpy.sort(known_pulser_ids['run%i' % run]['vpol'])
        all_eventids = numpy.sort(
            numpy.append(eventids['hpol'], eventids['vpol']))

        hpol_eventids_cut = numpy.isin(all_eventids, eventids['hpol'])
        vpol_eventids_cut = numpy.isin(all_eventids, eventids['vpol'])

        #Set up tempalte compare tool used for making averaged waveforms for first pass alignment.
        reader = Reader(datapath, run)
        tct = TemplateCompareTool(
Пример #3
0
may be tabbed over behind a "if True" or "if False" statement.  This is simply intended to allow the user to
"turn off" certain portions of the code easily.  The code in that black will run if it is under "if True" and
will not run if it is under "if False".
'''

if __name__ == '__main__':
    #plt.close('all') #Uncomment this if you want figures to be closed before this is run (helps if running multiple times in a row to avoid plot congestion).
    '''
    Loading pulsing events from site 1, plotting them with no filters applied, then plotting them with a different
    filter applied to each of the antennas.  Finally the time delays will be calculated and printed, with the signals
    being plotted and aligned based on the calculated time delays.
    '''
    if True:
        #Get run and events you want to look at.
        run = 1507
        eventids = info.loadPulserEventids()['run%i' % run][
            'hpol']  #produces a dictionary with all runs, and events seperated into polarization.  For simplicity I am specifying that I want only the eventids of hpol events from run1507.

        #Below are a common set of input variables that are used across multiple tools.
        #As this script is set up, the filter parameters are only used on the second Time Delay Calculator.
        #This is just to demonstrate the difference.
        final_corr_length = 2**17

        crit_freq_low_pass_MHz = [
            80, 70, 70, 70, 70, 70, 60, 70
        ]  #Filters here are attempting to correct for differences in signals from pulsers.
        low_pass_filter_order = [0, 8, 8, 8, 10, 8, 3, 8]

        crit_freq_high_pass_MHz = 65
        high_pass_filter_order = 12

        apply_phase_response = True