expyriment.io.DataFile

class expyriment.io.DataFile(additional_suffix, directory=None, delimiter=None, time_stamp=None)

A class implementing a data file.

Methods

__init__(additional_suffix, directory=None, delimiter=None, time_stamp=None)

Create a data file.

Filename: {MAINFILE_NAME}_{SUBJECT_ID}_{TIME_STAMP}{ADD_SUFFIX}.xpd

Parameters :

additional_suffix : str

additional suffix

directory : str, optional

directory of the file

delimiter : str, optional

symbol between variables

time_stamp : bool, optional

using time stamps, based on the experiment start time, not the current time

add(data)

Add data.

Parameters :

data : string or numeric or list

data to be added

add_experiment_info(text)

Adds a text the subject info header.

Notes

The next data.save() might take longer!

add_subject_info(text)

Adds a text the subject info header.

Subject information can be extracted afterwards using misc.data_preprocessing.read_data_file. To defined between subject variables use a syntax like this: “gender = female” or “handedness : left”

Parameters :

text : str

subject infomation to be add to the file header

Notes

The next data.save() might take longer!

add_variable_names(variable_names)

Add data variable names to the data file.

Parameters :

variables : str or list of str

variable names

Notes

The next data.save() might take longer!

clear_variable_names()

Remove all variable names from data file.

Notes

The next data.save() might take longer!

comment_char

Getter for comment_char

delimiter

Getter for delimiter

directory

Getter for directory

filename

Getter for filename

fullpath

Getter for fullpath

static get_next_subject_number()

Return the next subject number based on the existing data files.

rename(new_filename)

Renames the output file.

save()

Save the new data to data-file.

Returns :

time : int

the time it took to execute this method

standard_file_name

Getter for the standard expyriment outputfile name.

Filename: {MAINFILE_NAME}_{SUBJECT_ID}_{TIME_STAMP}{suffix}

suffix

Getter for directory

variable_names

Getter for variable_names.

write(content)

Write to file.

Parameters :

content : str

content to be written (anything, will be casted to str)

write_comment(comment)

Write a comment line to files.

(i.e., text is proceeded by comment char).

Parameters :

comment : str

comment to be written (anything, will be casted to str)

write_line(content)

Write a text line to files.

Parameters :

content : str

content to be written (anything, will be casted to str)

write_list(list_)

Write a list in a row. Data are separated by a delimiter.

Parameters :

list_ : list

list to be written

Previous topic

expyriment.io.extras.MidiOut

Next topic

expyriment.io.EventButtonBox

This Page