Ndx

class bosaris.Ndx(ndx_file_name='', models=array([], dtype=float64), testsegs=array([], dtype=float64))[source]

A class that encodes trial index information. It has a list of model names and a list of test segment names and a matrix indicating which combinations of model and test segment are trials of interest.

Attr modelset

list of unique models in a ndarray

Attr segset

list of unique test segments in a ndarray

Attr trialmask

2D ndarray of boolean. Rows correspond to the models and columns to the test segments. True if the trial is of interest.

filter(modlist, seglist, keep)[source]

Removes some of the information in an Ndx. Useful for creating a gender specific Ndx from a pooled gender Ndx. 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 ‘inndx’.

  • seglist – a cell array of strings which will be compared with the segset of ‘inndx’.

  • keep – a boolean indicating whether modlist and seglist are the models to keep or discard.

Returns

a filtered version of the current Ndx object.

merge(ndx_list)[source]

Merges a list of Ndx objects into the current one. The resulting ndx must have all models and segment in the input ndxs (only once). A trial in any ndx becomes a trial in the output ndx

Parameters

ndx_list – list of Ndx objects to merge

static read(input_file_name)[source]

Creates an Ndx object from the information in an hdf5 file.

Parameters

input_file_name – name of the file to read from

validate()[source]

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

Returns

a boolean value indicating whether the object is valid