Beispiel #1
0
def callback_update_data():
    # Tornado async coroutine to update rawdata
    if ser.inWaiting():
        intensities = CCD_protocol_parser.read_data(ser)
        new_data = dict()
        new_data['intensities'] = intensities
        new_data['rawdata_x'] = rawdata_x
        new_data['raman_spec_x'] = calibrate_model(rawdata_x)
        waveform_data_source.data = new_data
Beispiel #2
0
def callback_sample_signal_button():
    global user_SAMPLE_INTERVAL_IN_SECONDS
    global user_SIGNAL_SAMPLE_SIZE
    global ser
    # # stop current jobs
    # doc.add_next_tick_callback(callback_stop_button)
    # set integration time
    ser.write(
        CCD_protocol_parser.to_set_integration_time_command(
            user_SAMPLE_INTERVAL_IN_SECONDS, 's'))
    # prepare a new list to store data
    global signal_data_list
    signal_data_list = list()
    # check counter status, start to collect data
    global signal_sample_counter
    signal_sample_counter = user_SIGNAL_SAMPLE_SIZE
    doc.add_periodic_callback(callback_collect_signal_data_average, 10)
Beispiel #3
0
def callback_open_serial_port():
    global ser
    global user_serial_port
    global user_baud_rate
    # --- Serial port related
    # open serial port
    if raman_configs.IS_TESTING:
        ser = fake_serial.FakeSerial()
    else:
        ser = serial.Serial(user_serial_port, user_baud_rate, timeout=1)

    # --- configure CCD to it's default settings
    # default integration time
    ser.write(
        CCD_protocol_parser.to_set_integration_time_command(
            raman_configs.DEFAULT_CCD_INTEGRATION_INTERVAL,
            raman_configs.DEFAULT_CCD_INTEGRATION_UNIT))
Beispiel #4
0
def callback_collect_signal_data_average():
    global signal_sample_counter
    global signal_data_list
    global signal_data_averaged_dict
    if signal_sample_counter <= 0:
        doc.remove_periodic_callback(callback_collect_signal_data_average)
        sampling_signal_div.text = raman_languages.TEXT__SIGNAL_FINISHED_SAMPLING
        signal_data_averaged_dict = CCD_utils.average_over_samples(
            signal_data_list)
        waveform_data_source.data = signal_data_averaged_dict
    if ser.inWaiting():
        intensities = CCD_protocol_parser.read_data(ser)
        new_data = dict()
        new_data['intensities'] = intensities
        new_data['rawdata_x'] = rawdata_x
        new_data['raman_spec_x'] = calibrate_model(rawdata_x)
        waveform_data_source.data = new_data
        signal_data_list.append(new_data)
        sampling_signal_div.text = raman_languages.TEXT__SAMPLING_SIGNAL + \
            ": {signal_sample_counter}".format(
                signal_sample_counter=signal_sample_counter)
        signal_sample_counter = signal_sample_counter - 1
Beispiel #5
0
def callback_set_integration_time_button():
    global user_CCD_integration_interval, user_CCD_integration_unit
    ser.write(
        CCD_protocol_parser.to_set_integration_time_command(
            user_CCD_integration_interval, user_CCD_integration_unit))