예제 #1
0
 def collection():
     global gps_times,lats,lons,alts
     global lati,loni,alti
     global lastlen
     global tmin,tmax,dt
     global counts,tbins#,weights
     global yourThread
     with dataLock: # Wait for lock on current thread
         gps_times,lats,lons,alts = get_data(opts.gps_file,filetype='gps')
         lati,loni,alti = interp_pos(gps_times.gps[:,0],lats,lons,alts)
         currlen = gps_times.shape[0]
         if currlen == lastlen:
             sleep(POOL_TIME)
         elif currlen > lastlen:
             lastlen = currlen
             tmin,tmax = gps_times.gps.min(),gps_times.gps.max()
             # Create weights array for check of GPS data when user queries server
             counts,tbins = np.histogram(gps_times.gps,bins=int((tmax-tmin)/dt))
     # Start the next thread
     yourThread = threading.Timer(POOL_TIME, collection, ())
     yourThread.start()
예제 #2
0
 def collection():
     global gps_times, lats, lons, alts
     global lati, loni, alti
     global lastlen
     global tmin, tmax, dt
     global counts, tbins  #,weights
     global yourThread
     with dataLock:  # Wait for lock on current thread
         gps_times, lats, lons, alts = get_data(opts.gps_file,
                                                filetype='gps')
         lati, loni, alti = interp_pos(gps_times.gps[:, 0], lats, lons,
                                       alts)
         currlen = gps_times.shape[0]
         if currlen == lastlen:
             sleep(POOL_TIME)
         elif currlen > lastlen:
             lastlen = currlen
             tmin, tmax = gps_times.gps.min(), gps_times.gps.max()
             # Create weights array for check of GPS data when user queries server
             counts, tbins = np.histogram(gps_times.gps,
                                          bins=int((tmax - tmin) / dt))
     # Start the next thread
     yourThread = threading.Timer(POOL_TIME, collection, ())
     yourThread.start()
예제 #3
0
        yourThread = threading.Timer(POOL_TIME, collection, ())
        yourThread.start()

    # Initiate
    initialize()
    # When you kill Flask (SIGTERM), clear the trigger for the next thread
    atexit.register(interrupt)

    # Return app with get function
    return app


# Global variables
gps_times, lats, lons, alts = get_data(opts.gps_file, filetype='gps')
print gps_times.shape, lats.shape, lons.shape, alts.shape
lati, loni, alti = interp_pos(gps_times.gps[:, 0], lats, lons, alts)

# Get current number of GPS data points for monitoring of opts.gps_file
lastlen = gps_times.shape[0]
tmin, tmax = gps_times.gps.min(), gps_times.gps.max()

# Create weights array for check of GPS data when user queries server
dt = opts.dt
counts, tbins = np.histogram(gps_times.gps, bins=int((tmax - tmin) / dt))

# Create Lock object to access variables on an individual thread
dataLock = threading.Lock()

# Thread handler
yourThread = threading.Thread()
예제 #4
0
        yourThread = threading.Timer(POOL_TIME, collection, ())
        yourThread.start()

    # Initiate
    initialize()
    # When you kill Flask (SIGTERM), clear the trigger for the next thread
    atexit.register(interrupt)

    # Return app with get function
    return app


# Global variables
gps_times,lats,lons,alts = get_data(opts.gps_file,filetype='gps')
print gps_times.shape,lats.shape,lons.shape,alts.shape
lati,loni,alti = interp_pos(gps_times.gps[:,0],lats,lons,alts)

# Get current number of GPS data points for monitoring of opts.gps_file
lastlen = gps_times.shape[0]
tmin,tmax = gps_times.gps.min(),gps_times.gps.max()

# Create weights array for check of GPS data when user queries server
dt = opts.dt
counts,tbins = np.histogram(gps_times.gps,bins=int((tmax-tmin)/dt))

# Create Lock object to access variables on an individual thread
dataLock = threading.Lock()

# Thread handler
yourThread = threading.Thread()
예제 #5
0
    print 'Read in %s GPS positions' % lats.shape[0]

    minTime = times.gps.min()
    maxTime = times.gps.max()

    # Left off here !!!
    #print "Before time filter: ",spec_times.shape
    specInds = np.where(
        np.logical_and(spec_times.gps > minTime, spec_times.gps < maxTime))[0]
    spec_times, spec_raw = spec_times[specInds], spec_raw[specInds]
    #print "After time filter: ",spec_times.shape

    # Interpolate GPS positions
    print '\nInterpolating...'
    start = time.time()
    latsi, lonsi, altsi = interp_pos(times.gps, lats, lons, alts)
    stop = time.time()
    print 'Interpolation finished in %.1e seconds' % (stop - start)
    latsi = latsi(spec_times.gps)
    lonsi = lonsi(spec_times.gps)
    altsi = altsi(spec_times.gps)

    # Zip everything together for start/stop and waypt filtering
    spec_times = np.expand_dims(spec_times.gps, axis=1)
    latsi = np.expand_dims(latsi, axis=1)
    lonsi = np.expand_dims(lonsi, axis=1)
    altsi = np.expand_dims(altsi, axis=1)
    all_Data = np.concatenate((spec_times, latsi, lonsi, altsi, spec_raw),
                              axis=1)
    print '\nZipped data shape: ' + str(all_Data.shape)
예제 #6
0
    minTime = times.gps.min()
    maxTime = times.gps.max()

    # Left off here !!!
    #print "Before time filter: ",spec_times.shape
    specInds = np.where(np.logical_and(spec_times.gps>minTime,
                                       spec_times.gps<maxTime))[0]
    spec_times,spec_raw = spec_times[specInds],spec_raw[specInds]
    #print "After time filter: ",spec_times.shape


    # Interpolate GPS positions
    print '\nInterpolating...'
    start = time.time()
    latsi,lonsi,altsi = interp_pos(times.gps,lats,lons,alts)
    stop = time.time()
    print 'Interpolation finished in %.1e seconds' %(stop-start)
    latsi = latsi(spec_times.gps)
    lonsi = lonsi(spec_times.gps)
    altsi = altsi(spec_times.gps)


    # Zip everything together for start/stop and waypt filtering
    spec_times = np.expand_dims(spec_times.gps,axis=1)
    latsi = np.expand_dims(latsi,axis=1)
    lonsi = np.expand_dims(lonsi,axis=1)
    altsi = np.expand_dims(altsi,axis=1)
    all_Data = np.concatenate((spec_times,latsi,lonsi,altsi,spec_raw),
                               axis=1)
    print '\nZipped data shape: '+str(all_Data.shape)