Exemplo n.º 1
0
def run(run_start_uid=None, sleep=0):
    if sleep != 0:
        raise NotImplementedError("A sleep time is not implemented for this "
                                  "example.")
    ramp = common.stepped_ramp(start, stop, step, points_per_step)
    deadbanded_ramp = common.apply_deadband(ramp, deadband_size)
    rs = np.random.RandomState(5)
    point_det_data = rs.randn(num_exposures) + np.arange(num_exposures)

    data_keys1 = {
        'point_det': dict(source='PV:ES:PointDet', dtype='number', shape=2)
    }
    data_keys2 = {'Tsam': dict(source='PV:ES:Tsam', dtype='number', shape=1)}
    ev_desc1_uid = insert_descriptor(run_start=run_start_uid,
                                     data_keys=data_keys1,
                                     time=common.get_time(),
                                     uid=str(uuid.uuid4()))
    ev_desc2_uid = insert_descriptor(run_start=run_start_uid,
                                     data_keys=data_keys2,
                                     time=common.get_time(),
                                     uid=str(uuid.uuid4()))

    events = []

    base_time = common.get_time()
    for i in range(num_exposures):
        time = float(2 * i + 0.5 * rs.randn()) + base_time
        data = {'point_det': point_det_data[i]}
        timestamps = {'point_det': time}
        event_dict = dict(descriptor=ev_desc1_uid,
                          seq_num=i,
                          time=time,
                          data=data,
                          timestamps=timestamps,
                          uid=str(uuid.uuid4()))
        event_uid = insert_event(**event_dict)
        event, = find_events(uid=event_uid)
        events.append(event)

    for i, (time, temp) in enumerate(zip(*deadbanded_ramp)):
        time = float(time) + base_time
        data = {'Tsam': temp}
        timestamps = {'Tsam': time}
        event_dict = dict(descriptor=ev_desc2_uid,
                          time=time,
                          data=data,
                          timestamps=timestamps,
                          seq_num=i,
                          uid=str(uuid.uuid4()))
        event_uid = insert_event(**event_dict)
        event, = find_events(uid=event_uid)
        events.append(event)

    return events
Exemplo n.º 2
0
def run(run_start=None, sleep=0):
    if sleep != 0:
        raise NotImplementedError("A sleep time is not implemented for this "
                                  "example.")
    # Make the data
    ramp = common.stepped_ramp(start, stop, step, points_per_step)
    deadbanded_ramp = common.apply_deadband(ramp, deadband_size)
    rs = np.random.RandomState(5)
    point_det_data = rs.randn(num_exposures)
    # Create Event Descriptors
    data_keys1 = {'point_det': dict(source='PV:ES:PointDet',
                                    dtype='number', shape=point_det_data.shape[0])}
    data_keys2 = {'Tsam': dict(source='PV:ES:Tsam', dtype='number', shape=1),
                  'Troom': dict(source='PV:ES:Troom', dtype='number', shape=1)}
    ev_desc1_uid = insert_descriptor(run_start=run_start,
                                     data_keys=data_keys1, time=common.get_time(),
                                     uid=str(uuid.uuid4()))
    ev_desc2_uid = insert_descriptor(run_start=run_start,
                                     data_keys=data_keys2, time=common.get_time(),
                                     uid=str(uuid.uuid4()))
    print('event descriptor 1 uid = %s' % ev_desc1_uid)
    print('event descriptor 2 uid = %s' % ev_desc2_uid)
    # Create Events.
    events = []

    # Point Detector Events
    base_time = common.get_time()
    for i in range(num_exposures):
        time = float(i + 0.5 * rs.randn()) + base_time
        data = {'point_det': (point_det_data[i], time)}
        data = {'point_det': point_det_data[i]}
        timestamps = {'point_det': time}
        event_uid = insert_event(descriptor=ev_desc1_uid, seq_num=i, time=time,
                                 data=data, uid=str(uuid.uuid4()),
                                 timestamps=timestamps)
        event, = find_events(uid=event_uid)
        print(event)
        events.append(event)

    # Temperature Events
    for i, (time, temp) in enumerate(zip(*deadbanded_ramp)):
        time = float(time) + base_time
        data = {'Tsam': temp,
                'Troom': temp + 10}
        timestamps = {'Tsam': time,
                      'Troom': time}
        event_uid = insert_event(descriptor=ev_desc2_uid, time=time,
                                 data=data, seq_num=i, uid=str(uuid.uuid4()),
                                 timestamps=timestamps)

        event, = find_events(uid=event_uid)
        events.append(event)
    return events
Exemplo n.º 3
0
def run(run_start_uid=None, sleep=0):
    if sleep != 0:
        raise NotImplementedError("A sleep time is not implemented for this "
                                  "example.")
    ramp = common.stepped_ramp(start, stop, step, points_per_step)
    deadbanded_ramp = common.apply_deadband(ramp, deadband_size)
    rs = np.random.RandomState(5)
    point_det_data = rs.randn(num_exposures) + np.arange(num_exposures)

    data_keys1 = {'point_det': dict(source='PV:ES:PointDet', dtype='number',
                                    shape=2)}
    data_keys2 = {'Tsam': dict(source='PV:ES:Tsam', dtype='number',
                               shape=1)}
    ev_desc1_uid = insert_descriptor(run_start=run_start_uid,
                                           data_keys=data_keys1,
                                           time=common.get_time(),
                                           uid=str(uuid.uuid4()))
    ev_desc2_uid = insert_descriptor(run_start=run_start_uid,
                                           data_keys=data_keys2,
                                           time=common.get_time(),
                                           uid=str(uuid.uuid4()))

    events = []

    base_time = common.get_time()
    for i in range(num_exposures):
        time = float(2 * i + 0.5 * rs.randn()) + base_time
        data = {'point_det': point_det_data[i]}
        timestamps = {'point_det': time}
        event_dict = dict(descriptor=ev_desc1_uid, seq_num=i,
                          time=time, data=data, timestamps=timestamps,
                          uid=str(uuid.uuid4()))
        event_uid = insert_event(**event_dict)
        event, = find_events(uid=event_uid)
        events.append(event)

    for i, (time, temp) in enumerate(zip(*deadbanded_ramp)):
        time = float(time) + base_time
        data = {'Tsam': temp}
        timestamps = {'Tsam': time}
        event_dict = dict(descriptor=ev_desc2_uid, time=time,
                          data=data, timestamps=timestamps, seq_num=i,
                          uid=str(uuid.uuid4()))
        event_uid = insert_event(**event_dict)
        event, = find_events(uid=event_uid)
        events.append(event)

    return events
Exemplo n.º 4
0
def run(run_start=None, sleep=0):
    if sleep != 0:
        raise NotImplementedError("A sleep time is not implemented for this "
                                  "example.")
    # Make the data
    ramp = common.stepped_ramp(start, stop, step, points_per_step)
    deadbanded_ramp = common.apply_deadband(ramp, deadband_size)
    rs = np.random.RandomState(5)
    point_det_data = rs.randn(num_exposures)
    # Create Event Descriptors
    data_keys1 = {
        'point_det':
        dict(source='PV:ES:PointDet',
             dtype='number',
             shape=point_det_data.shape[0])
    }
    data_keys2 = {
        'Tsam': dict(source='PV:ES:Tsam', dtype='number', shape=1),
        'Troom': dict(source='PV:ES:Troom', dtype='number', shape=1)
    }
    ev_desc1_uid = insert_descriptor(run_start=run_start,
                                     data_keys=data_keys1,
                                     time=common.get_time(),
                                     uid=str(uuid.uuid4()))
    ev_desc2_uid = insert_descriptor(run_start=run_start,
                                     data_keys=data_keys2,
                                     time=common.get_time(),
                                     uid=str(uuid.uuid4()))
    print('event descriptor 1 uid = %s' % ev_desc1_uid)
    print('event descriptor 2 uid = %s' % ev_desc2_uid)
    # Create Events.
    events = []

    # Point Detector Events
    base_time = common.get_time()
    for i in range(num_exposures):
        time = float(i + 0.5 * rs.randn()) + base_time
        data = {'point_det': (point_det_data[i], time)}
        data = {'point_det': point_det_data[i]}
        timestamps = {'point_det': time}
        event_uid = insert_event(descriptor=ev_desc1_uid,
                                 seq_num=i,
                                 time=time,
                                 data=data,
                                 uid=str(uuid.uuid4()),
                                 timestamps=timestamps)
        event, = find_events(uid=event_uid)
        print(event)
        events.append(event)

    # Temperature Events
    for i, (time, temp) in enumerate(zip(*deadbanded_ramp)):
        time = float(time) + base_time
        data = {'Tsam': temp, 'Troom': temp + 10}
        timestamps = {'Tsam': time, 'Troom': time}
        event_uid = insert_event(descriptor=ev_desc2_uid,
                                 time=time,
                                 data=data,
                                 seq_num=i,
                                 uid=str(uuid.uuid4()),
                                 timestamps=timestamps)

        event, = find_events(uid=event_uid)
        events.append(event)
    return events