Пример #1
0
def stream():
    a = calib.Calibrator()

    #port = str(raw_input("Serial Port: "))

    #baudrate = str(raw_input("Baud Rate: "))
    ser = serial.Serial('/dev/ttyACM0', 9600)

    ref = cPickle.load(open('datasets.p', 'rb'))
    ref = ref.values()

    return Response(stream_data(ser, ref, a.maxVal),
                    mimetype='text/event-stream')
    ys = [290, 270, 250, 230, 210]
    dirs = 0
    score = 0
    applepos = (random.randint(0, 590), random.randint(0, 590))
    pygame.init()
    s = pygame.display.set_mode((600, 600))
    pygame.display.set_caption('Snake')
    appleimage = pygame.Surface((10, 10))
    appleimage.fill((0, 255, 0))
    img = pygame.Surface((20, 20))
    img.fill((255, 0, 0))
    f = pygame.font.SysFont('Arial', 20)
    clock = pygame.time.Clock()

    # Create a Calibrator object.
    a = calib.Calibrator()

    # Open up the serial port.
    ser = serial.Serial('COM9', 9600)

    # Deserialize the stored dataset from calibration
    # Extract the lists of tuples of values from the dict.
    ref = cPickle.load(open('datasets.p', 'rb'))
    ref = ref.values()

    while True:
        clock.tick(10)

        readingList = []
        count = 0
Пример #3
0
divdata = divdata.drop('qmi',axis=1)

#
# now get div247 file and calibrate
#
# get data pump
pump = fu.Div247DataPump("20110416")

# get first hour for that day
df = pump.get_n_hours(2)

#options for calbibration
options = dict(do_bbtimes=True, pad_bbtemps=False,
               single_rbb=True, skipsamples=True)
#calibrate
calib_mine = calib.Calibrator(df, do_bbtimes=False, pad_bbtemps=False,
                                single_rbb=False, skipsamples=False)
calib_mine.calibrate()

calib_jpl = calib.Calibrator(df, do_bbtimes=True, pad_bbtemps=True,
                                single_rbb=True, skipsamples=True)
calib_jpl.calibrate()

# find out the channel that was used by divdata
cdet = get_channel_from_fname(divrad_fname)

# get a view to the right channel
myrad_new = pd.DataFrame(calib_mine.abs_radiance[cdet])
myrad_old = pd.DataFrame(calib_jpl.abs_radiance[cdet])

compare = myrad_new.merge(divdata, left_index=True, right_index=True)
compare.columns = ['new','divdata']