Ndx

class bosaris.Ndx(ndxFileName='', ndxFileFormat='pickle', models=array([], dtype=float64), testsegs=array([], dtype=float64))

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.
clean(enroll, featureDir, featureExtension)

Clean the Ndx by removing missing models and segments

Parameters:
  • enroll – an IdMap with the defition of each model from the Ndx
  • featureDir – directory where the feature files are to be find
  • featureExtension – extension of the feature files to look for
filter(modlist, seglist, keep)

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(ndxList)

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:ndxList – list of Ndx objects to merge
read(inputFileName)

Reads information from a file and constructs an Ndx object. The type of file is deduced from the extension. The extension must be ‘.txt’ for a text file and ‘.hdf5’ or ‘.h5’ for a HDF5 file.

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

Read Ndx in PICKLE format.

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

Creates an Ndx object from information stored in a text file.

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

Save the Ndx object to file. The format of the file is deduced from the extension of the filename. The format can be PICKLE, HDF5 or text. Extension for pickle should be ‘.p’, text file should be ‘.txt’ and for HDF5 it should be ‘.hdf5’ or ‘.h5’

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

Save Ndx in PICKLE format

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

Save a Ndx object in a text file

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

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

Previous topic

Key

Next topic

PlotWindow

This Page