def getENUTrackDict(start,stop,hour_window = 12,flights_of_interest=[]):
    '''
    This will return a dict with the trajectories of each plane observed in the 
    period of time specified (given in UTC timestamps).
    '''
    unique_flights,all_vals = getTracks(start,stop,hour_window=hour_window)

    if numpy.size(flights_of_interest) != 0:
        unique_flights = [u.replace(' ','') for u in unique_flights]
        all_vals[:,0] = [u.replace(' ','') for u in all_vals[:,0]]
        unique_flights = unique_flights[numpy.isin(unique_flights,flights_of_interest)]
        all_vals = all_vals[numpy.isin(all_vals[:,0],flights_of_interest),:]

    if numpy.size(all_vals) != 0:
    
        lat = all_vals[:,2].astype(float)
        lon = all_vals[:,3].astype(float)
        alt = all_vals[:,4].astype(float)*0.3048 #Expressing alt in meters now. 
        timestamps = all_vals[:,1].astype(float)

        flight_tracks_ENU = {}
        origin = info.loadAntennaZeroLocation(deploy_index = 1) #Antenna 0

        for unique_flight in unique_flights:
            flight_cut = all_vals[:,0] == unique_flight
            enu = pm.geodetic2enu(lat[flight_cut],lon[flight_cut],alt[flight_cut],origin[0],origin[1],origin[2])  #converts to ENU
            ts = timestamps[flight_cut]
            # x, y, z, t
            flight_tracks_ENU[unique_flight.replace(' ','')] = numpy.vstack((numpy.asarray(enu),ts[None,:])).T

        return flight_tracks_ENU, all_vals
    else:
        return [], []
Пример #2
0
def getENUTrackDict(start,
                    stop,
                    min_approach_cut_km,
                    hour_window=12,
                    flights_of_interest=[],
                    origin=None,
                    deploy_index=None):
    '''
    This will return a dict with the trajectories of each plane observed in the 
    period of time specified (given in UTC timestamps).

    origin should be a tuple in the same format as returned by loadAntennaZeroLocation (latitude,longtidue,elevation)
    '''
    try:
        if deploy_index is None:
            deploy_index = info.returnDefaultDeploy()

        unique_flights, all_vals = getTracks(start,
                                             stop,
                                             min_approach_cut_km,
                                             hour_window=hour_window)
        if numpy.size(flights_of_interest) != 0:
            unique_flights = unique_flights[numpy.isin(unique_flights,
                                                       flights_of_interest)]
            all_vals = all_vals[numpy.isin(all_vals['names'],
                                           flights_of_interest)]

        if numpy.size(all_vals) != 0:
            flight_tracks_ENU = {}
            if origin is None:
                origin = info.loadAntennaZeroLocation(
                    deploy_index=deploy_index)  #Antenna 0

            for unique_flight in unique_flights:
                flight_cut = numpy.where(all_vals['names'] == unique_flight)[0]
                flight_cut = flight_cut[numpy.unique(
                    all_vals['timestamps'][flight_cut], return_index=True
                )[1]]  #Removing repeated timestamps per flight
                ts = all_vals['timestamps'][flight_cut]

                #cut = numpy.logical_and(cut,numpy.isin(numpy.arange(len(cut)),numpy.unique(file['timestamps'][...],return_index=True)[1])) #bool cut of first occurance of each timestamp to remove repeated.

                enu = pm.geodetic2enu(all_vals['lat'][flight_cut],
                                      all_vals['lon'][flight_cut],
                                      all_vals['alt'][flight_cut], origin[0],
                                      origin[1], origin[2])  #converts to ENU
                sorted_track_indices = numpy.argsort(ts)
                # x, y, z, t
                flight_tracks_ENU[unique_flight] = numpy.vstack(
                    (numpy.asarray(enu), ts[None, :])).T[sorted_track_indices]

            return flight_tracks_ENU, all_vals
        else:
            return {}, []
    except Exception as e:
        print('Error in getENUTrackDict.')
        print(e)
        exc_type, exc_obj, exc_tb = sys.exc_info()
        fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
        print(exc_type, fname, exc_tb.tb_lineno)
Пример #3
0
    sine_subtract_min_freq_GHz = 0.03
    sine_subtract_max_freq_GHz = 0.09
    sine_subtract_percent = 0.03

    hilbert=False
    final_corr_length = 2**10

    trigger_types = [1,3]#[2]
    plot_maps = True

    sum_events = False #If true will add all plots together, if False will loop over runs in runs.
    lognorm = True
    cmap = 'YlOrRd'#'binary'#'coolwarm'
    subset_cm = plt.cm.get_cmap('autumn', 10)

    origin = info.loadAntennaZeroLocation(deploy_index=deploy_index)
    latlonel_khsv = numpy.array([36.008611, -115.005556, 3316*0.3048 + 10]) #Height on google maps is ~ 3316 feet, which I convert to meters and add additional height for the tower it is on.
    enu_khsv = numpy.array(pm.geodetic2enu(latlonel_khsv[0],latlonel_khsv[1],latlonel_khsv[2],origin[0],origin[1],origin[2]))
    distance_m = numpy.linalg.norm(enu_khsv)
    zenith_deg = numpy.rad2deg(numpy.arccos(enu_khsv[2]/distance_m))
    elevation_deg = 90.0 - numpy.rad2deg(numpy.arccos(enu_khsv[2]/distance_m))
    azimuth_deg = numpy.rad2deg(numpy.arctan2(enu_khsv[1],enu_khsv[0]))

    try:
        if True:
            center_dir = 'E'
            apply_phase_response = True
            reader = Reader(datapath,run)
            cor = Correlator(reader,  upsample=2**16, n_phi=720, n_theta=720, waveform_index_range=(None,None),crit_freq_low_pass_MHz=crit_freq_low_pass_MHz, crit_freq_high_pass_MHz=crit_freq_high_pass_MHz, low_pass_filter_order=low_pass_filter_order, high_pass_filter_order=high_pass_filter_order, plot_filter=False,apply_phase_response=apply_phase_response, tukey=False, sine_subtract=True)
            # mean_corr_values, fig, ax = cor.map(eventid, 'hpol', include_baselines=numpy.array([0,1,2,3,4,5]), plot_map=True, plot_corr=False, hilbert=False, interactive=False, max_method=None, waveforms=None, verbose=True, mollweide=True, center_dir=center_dir, circle_zenith=None, circle_az=None, radius=1.0, time_delay_dict={},window_title=None,add_airplanes=False)
            ds = dataSlicerSingleRun(reader, impulsivity_dset_key, time_delays_dset_key, map_direction_dset_key,\
Пример #4
0
    plot_freq_classification_colors = True  #PLF,LF,HF,PHF,BB

    freq_classications = ['PLF', 'LF', 'HF', 'PHF', 'BB']
    freq_colors_cm = plt.cm.get_cmap('Set3', len(freq_classications))
    freq_colors = freq_colors_cm(numpy.linspace(0, 1, len(freq_classications)))
    freq_color_dict = {}
    for i, key in enumerate(freq_classications):
        freq_color_dict[key] = {}
        freq_color_dict[key]['c'] = numpy.array([freq_colors[i]])
        freq_color_dict[key]['labeled_yet'] = False

    # freq_colors = plt.cm.get_cmap('plasma',len(freq_classications)-1)#-1 because BB will be black

    known_planes, calibrated_trigtime, output_tracks = pt.getKnownPlaneTracks()

    origin = info.loadAntennaZeroLocation(
        deploy_index=1)  #This is what ENU is with respect to.
    antennas_physical, antennas_phase_hpol, antennas_phase_vpol = info.loadAntennaLocationsENU(
    )
    antennas_phase_start = antennas_phase_hpol

    print('Loading in cable delays.')
    cable_delays = info.loadCableDelays()[mode]

    if plot_planes == True:
        plane_fig = plt.figure()
        plane_fig.canvas.set_window_title('3D Plane Tracks')
        plane_ax = plane_fig.add_subplot(111, projection='3d')
        plane_ax.scatter(0, 0, 0, label='Antenna 0', c='k')

    plane_polys = {}
    interpolated_plane_locations = {}
Пример #5
0
        #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
        hilbert = False

        #Load antenna position information from the info.py script
        origin = info.loadAntennaZeroLocation()  #Assuming default_deploy
        antennas_physical, antennas_phase_hpol, antennas_phase_vpol = info.loadAntennaLocationsENU(
        )  #Assuming default_deploy

        #Create a Reader object for the specific run.
        reader = Reader(datapath, run)
        print('The run associated with this reader is:')
        print(reader.run)
        print('This run has %i events' % (reader.N()))

        #Create a TimeDelayCalculator object for the specified run. Note that if the above parameters haven't been change
        tdc_raw = TimeDelayCalculator(reader,
                                      final_corr_length=final_corr_length,
                                      crit_freq_low_pass_MHz=None,
                                      crit_freq_high_pass_MHz=None,
                                      low_pass_filter_order=None,