expyriment.misc.ByteBuffer

class expyriment.misc.ByteBuffer(name='ByteBuffer', clock=None)

A class implementing a buffer for bytes.

The ByteBuffer class is also used for the input_histoy of serial and parallel ports.

__init__(name='ByteBuffer', clock=None)

Create a buffer for bytes.

Parameters:
namestr

the name of the buffer

clockexpyriment.Clock object (optional)

an experimental clock

add_event(event)

Add an event to the buffer.

Parameters:
eventanything

the event to add

add_events(events)

Add a list of events to the buffer.

All events get the same time stamp!

Parameters:
eventslist

the event list to add

check_set(search_byte, search_start_position=0)

Check if bits are set in buffer bytes and return position.

Parameters:
search_byteint

the byte to search for

search_start_positionint (optional)

position to start search from (int)

Returns:
positionint

the position of element with set bits

check_unset(search_byte, search_start_position=0)

Check if bits are NOT set in buffer bytes and return position.

Parameters:
search_byteint

the byte to search for

search_start_positionint (optional)

position to start search from

Returns:
positionint

the position of element with unset bits

check_value(value, search_start_position=0)

Check if value is in buffer bytes and return the position.

Parameters:
valueint

the value to check

search_start_positionint (optional)

position to start search from

Returns:
positionint

the position of element with value

clear()

Clear the buffer.

property clock

Getter for clock

get_element(position)

Get an element (code, rt) from the buffer.

Parameters:
positionint

the position to get the element from

Returns:
element(anything, float)

The element to get from the buffer

get_last_event()

Get the last event (code, rt) in the buffer.

Returns:
element(anything, float)

the last element of the buffer

get_size()

Return the number of elements in the buffer.

Returns:
sizeint

the size of the buffer

get_whole_buffer()

Get a copy of the buffer.

Returns:
copylist

the copy of the buffer

property memory

Getter for memory [list of tuples (code, rt)]

property name

Getter for name