expyriment.io.extras.TbvNetworkInterface

class expyriment.io.extras.TbvNetworkInterface(host, port, timeout=None, connect=None)

A class implementing a network interface to Turbo Brain Voyager.

See http://www.brainvoyager.com/products/turbobrainvoyager.html for more information.

__init__(host, port, timeout=None, connect=None)

Create a TbvNetworkInterface.

Parameters:

host : str

The hostname or IPv4 address of the TBV server to connect to.

port : int

The port on the TBV server to connect to.

timeout : int, optional

The maximal time to wait for a response from the server for each request.

connect : bool, optional

If True, connect immediately.

close()

Close the connection.

connect()

Connect to the TBV server.

get_all_coords_of_voxels_of_roi(roi)

Get coordinates for all voxels for a ROI.

Parameters:

roi : int

The ROI.

Returns:

coords : list

The coordinates of all voxels of the ROI. [[v1_x, v1_y, v1_z], [v2_x, v2_z, v2_y], ..., [vn_x, vn_y, _vn_z]]

rt : int

The time it took to get the data.

get_beta_maps()

Get the beta maps.

Returns:

beta_maps : list

The data of all raw voxel values.

[x1_y1_z_p1, ..., xn_y1_y1_p1, ..., xn_yn_z1_p1, ..., xn_yn_zn_p1, ..., xn_yn_zn_pn]

A beta value of a single predictor can be accessed at:

beta_i*dim_xyz + z_coord*dim_xy + y_coord*dim_x + x_coord

rt : int

The time it took to get the data.

get_beta_of_roi(roi, beta)

Get the value of a beta of a ROI.

Parameters:

roi : int

The ROI.

beta : int

The beta.

Returns:

value : float

The value of the beta of the ROI.

rt : int

The time it took to get the data.

get_beta_of_voxel(beta, coords)

Get a specific beta value of a voxel.

Parameters:

beta : int

The beta.

coords : list

The coordinates of the voxel. [x, y, z]

Returns:

value : double

The beta value.

rt : int

The time it took to get the data.

get_contrast_maps()

Get the contrast maps.

Returns:

contrast_maps : list

The data of all contrast maps values.

[x1_y1_z_c1, ..., xn_y1_y1_c1, ..., xn_yn_z1_c1, ..., xn_yn_zn_cn]

A t value of a specific contrast map of a voxel with specific coordinates can be accessed at:

map_i*dim_xyz + z_coord*dim_xy + y_coord*dim_x + x_coord

rt : int

The time it took to get the data.

get_coord_of_voxel_of_roi(roi, voxel)

Get the coordinates of a voxel of a ROI.

Parameters:

roi : int

The ROI.

voxel : int

The voxel.

Returns:

coords : list

The coordinates of the voxel. [x, y, z]

rt : int

The time it took to get the data.

get_current_classifier_output()

Get the current classifier output.

Returns:

output : list

The current classifier output. NOTE: Output is 1-based!

rt : int

The time it took to get the data.

get_current_nr_of_predictors()

Get the current number of predictors.

Returns:

nr_predictors : int

The number of predictors.

rt : int

The time it took to get the data.

get_current_protocol_condition()

Get the current protocol condition.

Returns:

condition_nr : int

The current protocol condition.

rt : int

The time it took to get the data.

get_current_time_point()

Get the current time point.

Returns:

data : int

The current time point.

rt : int

The time it took to get the data.

get_dims_of_functional_data()

Get the dimensions of the functional data.

Returns:

dims : list

The dimension of the functional volume. [x, y, z]

rt : int

The time it took to get the data.

get_existing_means_of_roi(roi, to_time_point)

Get the existing means of a ROI.

Parameters:

roi : int

The ROI.

to_time_point : int

Get all the means up to this point.

Returns:

means : list

The means of the ROI.

rt : int

The time it took to get the data.

get_expected_nr_of_time_points()

Get the expected number of time points.

Returns:

data : int

The expected number of time points.

rt : int

The time it took to get the data.

get_feedback_folder()

Get the feedback folder.

Returns:

folder : str

The feedback folder.

rt : int

The time it took to get the data.

get_full_nr_of_predictors()

Get the full number of predictors.

Returns:

nr_predictors : int

The number of predictors.

rt : int

The time it took to get the data.

get_map_value_of_voxel(map, coords)

Get a specific map value of a voxel.

Parameters:

map : int

The map.

coords : list

The coordinates of the voxel. [x, y, z]

Returns:

value : float

The map value.

rt : int

The time it took to get the data.

get_mean_of_roi(roi)

Get the mean of a ROI.

Parameters:

roi : int

The ROI.

Returns:

mean : float

The mean of the ROI.

rt : int

The time it took to get the data.

get_mean_of_roi_at_time_point(roi, time_point)

Get the mean of a ROI at a time point.

Parameters:

roi : int

The ROI.

time_point : int

The time point.

Returns:

mean : float

The mean of the ROI.

rt : int

The time it took to get the data.

get_nr_of_confound_predictors()

Get the number of confound predictors.

Returns:

nr_predictors : int

The number of predictors.

rt : int

The time it took to get the data.

get_nr_of_contrasts()

Get the number of contrasts.

Returns:

nr_contrasts : int

The number of contrasts.

rt : int

The time it took to get the data.

get_nr_of_rois()

Get the number of ROIs.

Returns:

nr_rois : int

The number of ROIs.

rt : int

The time it took to get the data.

get_nr_of_voxels_of_roi(roi)

Get the number of voxels of a ROI.

Parameters:

roi : int

The ROI.

Returns:

nr_voxels : int

The number of voxels of the ROI.

rt : int

The time it took to get the data.

get_number_of_classes()

Get the number of classes.

Returns:

nr_classes : int

The number of classes.

rt : int

The time it took to get the data.

get_project_name()

Get the project name.

Returns:

name : str

The project name.

rt : int

The time it took to get the data.

get_raw_value_of_all_voxels_at_time(time_point)

Get the raw value of all voxels at a certain time point.

Parameters:

time_point : int

The time point.

Returns:

voxels : list

The data of all raw voxel values. [x1_y1_z1, ..., xn_y1_y1, ..., xn_yn_z1, ..., xn_yn_zn] The value of a single voxel can be accessed at:

z_coord*dim_x*dim_y + y_coord*dim_x + x_coord

rt : int

The time it took to get the data.

get_target_folder()

Get the target folder.

Returns:

folder : str

The target folder.

rt : int

The time it took to get the data.

get_value_of_all_voxels_at_time(time_point)

Get the value of all voxels at a certain time point.

Parameters:

time_point : int

The time point.

Returns:

voxels : list

The data of all voxel values. [x1_y1_z1, ..., xn_y1_y1, ..., xn_yn_z1, ..., xn_yn_zn] The value of a single voxel can be accessed at:

z_coord*dim_x*dim_y + y_coord*dim_x + x_coord

rt : int

The time it took to get the data.

get_value_of_design_matrix(pred, time_point)

Get the value of the design matrix.

Parameters:

pred : int

The predictor.

time_point : int

The time point.

Returns:

value : float

The design matrix value.

rt : int

The time it took to get the data.

get_value_of_voxel_at_time(coords, time_point)

Get the value of a voxel at a certain time point.

Parameters:

coords : list

The coordinates of the voxel. [x, y, z]

time_point : int

The time point.

Returns:

value : float

The voxel value.

rt : int

The time it took to get the data.

get_watch_folder()

Get the watch folder.

Returns:

folder : str

The watch folder.

rt : int

The time it took to get the data.

host

Getter for host.

is_connected

Getter for is_connected.

logging

Getter for logging.

port

Getter for port.

request_data(request, *args)

Request data from Turbo Brain Voyager.

Parameters:

request : str

The request to be sent to Turbo Brain Voyager.

Returns:

data : str

The byte string of the received data.

rt : int

The time it took to get the data.

set_logging(onoff)

Set logging of this object on or off

Parameters:

onoff : bool

set logging on (True) or off (False)

Notes

See also design.experiment.set_log_level fur further information about event logging.

tbv_plugin_version

Getter for tbv_plugin_version.

timeout

Getter for timeout.