Пример #1
0
def run_type_word(run):
    '''Get the run start time using the detector state db
    :param int run:
    :returns str: "-" if not found
    '''
    try:
        return detector_state.get_run_state(run)['run_type']
    except:
        return "-"
Пример #2
0
def run_time(run):
    '''Get the run start time using the detector state db
    :param int run:
    :returns str: "-" if not found
    '''
    try:
        return detector_state.get_run_state(run)['timestamp'].strftime("%m-%d-%y %H:%M:%S")
    except:
        return "-"
Пример #3
0
def run_type_word(run):
    '''Get the run start time using the detector state db
    :param int run:
    :returns str: "-" if not found
    '''
    try:
        return detector_state.get_run_state(run)['run_type']
    except:
        return "-"
Пример #4
0
def run_time(run):
    '''Get the run start time using the detector state db
    :param int run:
    :returns str: "-" if not found
    '''
    try:
        return detector_state.get_run_state(run)['timestamp'].strftime("%m-%d-%y %H:%M:%S")
    except:
        return "-"
Пример #5
0
def state(run=None):
    try:
        run_state = detector_state.get_run_state(run)
        run = run_state['run']
        # Have to put these in ISO format so flask doesn't mangle it later
        run_state['timestamp'] = run_state['timestamp'].isoformat()
        # end_timestamp isn't that important. If it's not there, it's ignored
        if(run_state['end_timestamp']):
            run_state['end_timestamp'] = run_state['end_timestamp'].isoformat()
    except Exception as e:
        return render_template('state.html', err=str(e))

    detector_control_state = None
    if run_state['detector_control'] is not None:
        detector_control_state = detector_state.get_detector_control_state(run_state['detector_control'])

    mtc_state = None
    if run_state['mtc'] is not None:
        mtc_state = detector_state.get_mtc_state(run_state['mtc'])

    caen_state = None
    if run_state['caen'] is not None:
        caen_state = detector_state.get_caen_state(run_state['caen'])

    tubii_state = None
    if run_state['tubii'] is not None:
        tubii_state = detector_state.get_tubii_state(run_state['tubii'])

    crates_state = detector_state.get_detector_state(run)

    if not any(crates_state.values()):
        crates_state = None

    trigger_scan = None
    if run_state['timestamp'] is not None:
        trigger_scan = detector_state.get_trigger_scan_for_run(run)

    hv_params = detector_state.get_hv_nominals()

    return render_template('state.html', run=run,
                           run_state=run_state,
                           detector_control_state=detector_control_state,
                           mtc_state=mtc_state,
                           caen_state=caen_state,
                           tubii_state=tubii_state,
                           crates_state=crates_state,
                           trigger_scan=trigger_scan,
                           hv_params=hv_params,
                           err=None)
Пример #6
0
def state(run=None):
    try:
        run_state = detector_state.get_run_state(run)
        run = run_state['run']
        # Have to put these in ISO format so flask doesn't mangle it later
        run_state['timestamp'] = run_state['timestamp'].isoformat()
        # end_timestamp isn't that important. If it's not there, it's ignored
        if (run_state['end_timestamp']):
            run_state['end_timestamp'] = run_state['end_timestamp'].isoformat()
    except Exception as e:
        return render_template('state.html', err=str(e))

    detector_control_state = None
    if run_state['detector_control'] is not None:
        detector_control_state = detector_state.get_detector_control_state(
            run_state['detector_control'])

    mtc_state = None
    if run_state['mtc'] is not None:
        mtc_state = detector_state.get_mtc_state(run_state['mtc'])

    caen_state = None
    if run_state['caen'] is not None:
        caen_state = detector_state.get_caen_state(run_state['caen'])

    tubii_state = None
    if run_state['tubii'] is not None:
        tubii_state = detector_state.get_tubii_state(run_state['tubii'])

    crates_state = detector_state.get_detector_state(run)

    if not any(crates_state.values()):
        crates_state = None

    trigger_scan = None
    if run_state['timestamp'] is not None:
        trigger_scan = detector_state.get_trigger_scan_for_run(run)

    return render_template('state.html',
                           run=run,
                           run_state=run_state,
                           detector_control_state=detector_control_state,
                           mtc_state=mtc_state,
                           caen_state=caen_state,
                           tubii_state=tubii_state,
                           crates_state=crates_state,
                           trigger_scan=trigger_scan,
                           err=None)
Пример #7
0
def detector_state_check(run=None):
    if run is None:
        run = detector_state.get_run_state(None)['run']

    messages, channels = detector_state.get_detector_state_check(run)
    alarms = detector_state.get_alarms(run)

    if alarms is None:
        flash("unable to get alarms for run %i" % run, 'danger')

    try:
        warnings = get_daq_log_warnings(run)
    except IOError:
        flash("unable to get daq log for run %i" % run, 'danger')
        warnings = None

    return render_template('detector_state_check.html', run=run, messages=messages, channels=channels, alarms=alarms, warnings=warnings)
Пример #8
0
def detector_state_check(run=None):
    if run is None:
        run = detector_state.get_run_state(None)['run']

    messages, channels = detector_state.get_detector_state_check(run)
    alarms = detector_state.get_alarms(run)

    if alarms is None:
        flash("unable to get alarms for run %i" % run, 'danger')

    try:
        warnings = get_daq_log_warnings(run)
    except IOError:
        flash("unable to get daq log for run %i" % run, 'danger')
        warnings = None

    return render_template('detector_state_check.html',
                           run=run,
                           messages=messages,
                           channels=channels,
                           alarms=alarms,
                           warnings=warnings)