cogrecon.core.data_flexing.virtual_morris_water_maze package

Submodules

cogrecon.core.data_flexing.virtual_morris_water_maze.virtual_morris_water_maze_analytics module

cogrecon.core.data_flexing.virtual_morris_water_maze.virtual_morris_water_maze_analytics.generate_virtual_morris_water_maze_summary_file(search_directory=None, file_regex='..._\\d_\\d_\\d\\d\\d\\d-\\d\\d-\\d\\d_\\d\\d-\\d\\d-\\d\\d.dat', save_xyz_file=True, next_to_distance=9, next_to_point=(5, -7))[source]

cogrecon.core.data_flexing.virtual_morris_water_maze.virtual_morris_water_maze_parser module

cogrecon.core.data_flexing.virtual_morris_water_maze.virtual_morris_water_maze_parser.datetime_from_dot_net_binary(data)[source]

From http://stackoverflow.com/questions/15919598/serialize-datetime-as-binary

This function converts data from a .NET datetime binary representation to a python datetime object

Parameters:data – some binary data which is expected to convert to a datetime value
Returns:a datetime value corresponding to the binary .NET datetime representation from the input data
cogrecon.core.data_flexing.virtual_morris_water_maze.virtual_morris_water_maze_parser.decode_7bit_int_length(fp)[source]

From: http://stackoverflow.com/questions/1550560/encoding-an-integer-in-7-bit-format-of-c-sharp-binaryreader-readstring

This function takes a file pointer and extracts the appropriate next information which is expected to contain a .NET 7bit binary datetime encoded value and extracts the length of that datetime value.

Parameters:fp – a file pointer whose next expected element is a 7bit integer length of a binary datetime in .NET
Returns:a length value representing the string length of a binary datetime in .NET
cogrecon.core.data_flexing.virtual_morris_water_maze.virtual_morris_water_maze_parser.find_data_files_in_directory(directory, file_regex='')[source]

This function acts as a helper to search a directory for files that match a regular expression. The function will raise an IOError if the input path is not found.

Parameters:
  • directory – the directory to search
  • file_regex – the regular expression to match for files
Returns:

a list of files which match the regular expression

cogrecon.core.data_flexing.virtual_morris_water_maze.virtual_morris_water_maze_parser.get_exploration_metrics(iterations)[source]

This function returns basic exploration metrics (total time, space travelled, time spent moving, and space_time travelled) given the iterations from read_binary_file.

Parameters:iterations – the iterations from read_binary_file
Returns:a tuple containing total_time, space_travelled, time_travelled, and space_time_travelled
cogrecon.core.data_flexing.virtual_morris_water_maze.virtual_morris_water_maze_parser.get_filename_meta_data(fn)[source]

This helper function extracts the meta-data from the filename.

Parameters:fn – a string filename to be split
Returns:a dictionary containing ‘subid’, ‘trial’, ‘iteration’, and ‘datetime’ keys
cogrecon.core.data_flexing.virtual_morris_water_maze.virtual_morris_water_maze_parser.read_binary_file(path)[source]

This function reads a Time Travel Task binary file in its entirety and converts it into a list of iterations which can be parsed independently.

Parameters:path – a string absolute path to a Time Travel Task binary file
Returns:a list of iterations (dictionaries containing values: ‘version’ - an integer version number

’datetime’ - a python datetime object for this iteration

’time’ - a time for this iteration

’x’, ‘y’, ‘z’ - x, y, and z spatial coordinates in which the participant resides

’rx’, ‘ry’, ‘rz’, ‘rw’ - x, y, z, and w rotation quaternion coordinates in which the participant resides ‘keys’, ‘buttons’ - key and button states

cogrecon.core.data_flexing.virtual_morris_water_maze.virtual_morris_water_maze_parser.trial_num_to_str(phase)[source]

This function performs the lookup of the phase name from the phase number.

Parameters:phase – the phase number
Returns:a string representing the name of the phase associated with the phase number

Module contents