Key

class bosaris.Key(keyFileName='', keyFileFormat='pickle', models=array([], dtype=float64), testsegs=array([], dtype=float64), trials=array([], dtype=float64))

A class for representing a Key i.e. it classifies trials as target or non-target trials.

Attr modelset:list of the models into a ndarray of strings
Attr segset:list of the test segments into a ndarray of strings
Attr tar:2D ndarray of booleans which rows correspond to the models and columns to the test segments. True if target trial.
Attr non:2D ndarray of booleans which rows correspond to the models and columns to the test segments. True is non-target trial.
filter(modlist, seglist, keep)

Removes some of the information in a key. Useful for creating a gender specific key from a pooled gender key. Depending on the value of ‘keep’, the two input lists indicate the strings to retain or the strings to discard.

Parameters:
  • modlist – a cell array of strings which will be compared with the modelset of ‘inkey’.
  • seglist – a cell array of strings which will be compared with the segset of ‘inkey’.
  • keep – a boolean indicating whether modlist and seglist are the models to keep or discard.
Returns:

a filtered version of ‘inkey’.

merge(keyList)

Merges Key objects. This function takes as input a list of Key objects to merge in the curent one.

Parameters:keyList – the list of Keys to merge
read(inputFileName)

Reads information from a file and constructs a Key object. The type of file is deduced from the extension.

Parameters:inputFileName – name of the file to read from
read_pickle(inputFileName)

Read Key in PICKLE format.

Parameters:inputFileName – name of the file to read from
read_txt(inputFileName)

Creates a Key object from information stored in a text file.

Parameters:inputFileName – name of the file to read from
save(outputFileName)

Save the Key object to file. The format of the file to create is set accordingly to the extension of the filename. This extension can be ‘.txt’ for text format and ‘.hdf5’ or ‘.h5’ for HDF5 format.

Parameters:outputFileName – name of the file to write to
save_pickle(outputFileName)

Save Key in PICKLE format

Parameters:outputFilename – name of the file to write to
save_txt(outputFileName)

Save a Key object to a text file.

Parameters:outputFileName – name of the output text file
to_ndx()

Create a Ndx object based on the Key object

Returns:a Ndx object based on the Key
validate()

Checks that an object of type Key obeys certain rules that must always be true.

Returns:a boolean value indicating whether the object is valid.

Previous topic

IdMap

Next topic

Ndx

This Page