Key

class bosaris.Key(key_file_name='', models=array([], dtype=float64), testsegs=array([], dtype=float64), trials=array([], dtype=float64))[source]

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)[source]

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(key_list)[source]

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

Parameters

key_list – the list of Keys to merge

static read(input_file_fame)[source]

Reads a Key object from an hdf5 file.

Parameters

input_file_fame – name of the file to read from

static read_txt(input_file_name)[source]

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

Parameters

input_file_name – name of the file to read from

to_ndx()[source]

Create a Ndx object based on the Key object

Returns

a Ndx object based on the Key

validate()[source]

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.