Buffer
mosca.control.buffer.CircularBuffer ¶
CircularBuffer(
n_items=DEFAULT_N_ITEMS,
buffer_size=DEFAULT_BUFFER_SIZE,
data_size=DEFAULT_DATA_SIZE,
dtype=DEFAULT_DTYPE,
)
Class managing a circular buffer.
buffer_size
class-attribute
instance-attribute
¶
buffer_size = property(lambda self: shape[1])
Maximum number of points that can be stored in the buffer at any given time (2nd dimension). Once the limit is reached the older points will be overwritten.
data_size
class-attribute
instance-attribute
¶
data_size = property(lambda self: shape[2])
Data size (3d dimension of the buffer).
first_point_time
class-attribute
instance-attribute
¶
first_point_time = property(
lambda self: _metadata["first_point_time"]
)
Timestamp of the first added point.
latest_point_time
class-attribute
instance-attribute
¶
latest_point_time = property(
lambda self: _metadata["latest_point_time"]
)
Timestamp of the latest added point.
n_items
class-attribute
instance-attribute
¶
n_items = property(lambda self: shape[0])
Number of detector modules. (1st dim of the buffer)
n_points
class-attribute
instance-attribute
¶
n_points = property(lambda self: _n_points_set)
Total number of points that have been added to this buffer, including ones that may have been overwritten (i.e: NOT the number of points currently stored, which can't be greater than buffer_size)
add_data ¶
add_data(data)
Add data to the buffers. point_nums: 1D array containing the point numbers (0 being the first point of the SCAN) data: array (see below)
Returns: the number of new points
IMPORTANT! Arrays shape: it is the CALLER's resposability to provide correctly aligned data. -> data will be reshaped to (n_items, n_points, data_size)
get_data ¶
get_data(
first=None,
last=None,
strip_first_axis=False,
raise_ex=True,
clip_idx=False,
flatten=False,
)
WARNING!! like any python array indexing, the last point returned will be the one found at index last-1. e.g: get_data(0, 34) will return points 0 to 33 included.
Returns data from a range of points first: point number stored in the buffer. If None, the older point is selected. last: point number stored in the buffer. If None, the latest point is selected. strip_first_axis: if the first axis (nb points) size is 1, the arrays will be reshaped to 2D (points, data) clip_idx: if true the given point range will be clipped to the available points. flatten: reshape the arrays to 1D. raise_ex: if set to True, the function will raise an exception instead of returning empty arrays.
get_point ¶
get_point(pix_num)
Returns the given point. pix_num: point number (0 is the first point of the SCAN)