class_docstr: 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.
  
  Arguments
  ---------
  modelset : list
      List of unique models in a ndarray.
  segset : list
      List of unique test segments in a ndarray.
  trialmask : 2D ndarray of bool.
      Rows correspond to the models and columns to the test segments. True, if the trial is of interest.
docstr: Initialize a Ndx object by loading information from a file.
  
  Arguments
  ---------
  ndx_file_name : str
      Name of the file to load.
docstr_tok: ["Initialize","a","Ndx","object","by","loading","information","from","a","file",".","Arguments","--","--","--","--","-","ndx_file_name",":","str","Name","of","the","file","to","load","."]
code: def __init__(
      self,
      ndx_file_name="",
      models=numpy.array([]),
      testsegs=numpy.array([]),
  ):
      """Initialize a Ndx object by loading information from a file.
  
      Arguments
      ---------
      ndx_file_name : str
          Name of the file to load.
      """
      self.modelset = numpy.empty(0, dtype="|O")
      self.segset = numpy.empty(0, dtype="|O")
      self.trialmask = numpy.array([], dtype="bool")
  
      if ndx_file_name == "":
          # This is needed to make sizes same
          d = models.shape[0] - testsegs.shape[0]
          if d != 0:
              if d > 0:
                  last = str(testsegs[-1])
                  pad = numpy.array([last] * d)
                  testsegs = numpy.hstack((testsegs, pad))
                  # pad = testsegs[-d:]
                  # testsegs = numpy.concatenate((testsegs, pad), axis=1)
              else:
                  d = abs(d)
                  last = str(models[-1])
                  pad = numpy.array([last] * d)
                  models = numpy.hstack((models, pad))
                  # pad = models[-d:]
                  # models = numpy.concatenate((models, pad), axis=1)
  
          modelset = numpy.unique(models)
          segset = numpy.unique(testsegs)
  
          trialmask = numpy.zeros(
              (modelset.shape[0], segset.shape[0]), dtype="bool"
          )
          for m in range(modelset.shape[0]):
              segs = testsegs[
                  numpy.array(ismember(models, modelset[m]))
              ]
              trialmask[m,] = ismember(segset, segs)  # noqa E231
  
          self.modelset = modelset
          self.segset = segset
          self.trialmask = trialmask
          assert self.validate(), "Wrong Ndx format"
  
      else:
          ndx = Ndx.read(ndx_file_name)
          self.modelset = ndx.modelset
          self.segset = ndx.segset
          self.trialmask = ndx.trialmask
  
imports: import numpy
  import copy
  import pickle
  from scipy import linalg
label_desc: Use image node_id 1 to create a new Ndx object  with example: obj = Ndx(ndx_file_name, models, testsegs)