expyriment.misc.ByteBuffer

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

A class implementing a buffer for bytes.

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

Methods

__init__(name='ByteBuffer', clock=None)[source]

Create a buffer for bytes.

Parameters:

name : str

the name of the buffer

clock : expyriment.Clock object (optional)

an experimental clock

add_event(event)

Add an event to the buffer.

Parameters:

event : anything

the event to add

add_events(events)

Add a list of events to the buffer.

All events get the same time stamp!

Parameters:

events : list

the event list to add

check_set(search_byte, search_start_position=0)[source]

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

Parameters:

search_byte : int

the byte to search for

search_start_position : int (optional)

position to start search from (int)

Returns:

position : int

the position of element with set bits

check_unset(search_byte, search_start_position=0)[source]

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

Parameters:

search_byte : int

the byte to search for

search_start_position : int (optional)

position to start search from

Returns:

position : int

the position of element with unset bits

check_value(value, search_start_position=0)[source]

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

Parameters:

value : int

the value to check

search_start_position : int (optional)

position to start search from

Returns:

position : int

the position of element with value

clear()

Clear the buffer.

clock

Getter for clock

get_element(position)

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

Parameters:

position : int

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:

size : int

the size of the buffer

get_whole_buffer()

Get a copy of the buffer.

Returns:

copy : list

the copy of the buffer

memory

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

name

Getter for name