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: 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.
  
  Arguments
  ---------
  modlist : array
      A cell array of strings which will be compared with the modelset of 'inndx'.
  seglist : array
      A cell array of strings which will be compared with the segset of 'inndx'.
  keep : bool
      Indicating whether modlist and seglist are the models to keep or discard.
docstr_tok: ["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",".","Arguments","--","--","--","--","-","modlist",":","array","A","cell","array","of","strings","which","will","be","compared","with","the","modelset","of","'inndx","'",".","seglist",":","array","A","cell","array","of","strings","which","will","be","compared","with","the","segset","of","'inndx","'",".","keep",":","bool","Indicating","whether","modlist","and","seglist","are","the","models","to","keep","or","discard","."]
code: def filter(self, 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.
  
      Arguments
      ---------
      modlist : array
          A cell array of strings which will be compared with the modelset of 'inndx'.
      seglist : array
          A cell array of strings which will be compared with the segset of 'inndx'.
      keep : bool
          Indicating whether modlist and seglist are the models to keep or discard.
      """
      if keep:
          keepmods = modlist
          keepsegs = seglist
      else:
          keepmods = diff(self.modelset, modlist)
          keepsegs = diff(self.segset, seglist)
  
      keepmodidx = numpy.array(ismember(self.modelset, keepmods))
      keepsegidx = numpy.array(ismember(self.segset, keepsegs))
  
      outndx = Ndx()
      outndx.modelset = self.modelset[keepmodidx]
      outndx.segset = self.segset[keepsegidx]
      tmp = self.trialmask[numpy.array(keepmodidx), :]
      outndx.trialmask = tmp[:, numpy.array(keepsegidx)]
  
      assert outndx.validate, "Wrong Ndx format"
  
      if self.modelset.shape[0] > outndx.modelset.shape[0]:
          print(
              "Number of models reduced from %d to %d"
              % self.modelset.shape[0],
              outndx.modelset.shape[0],
          )
      if self.segset.shape[0] > outndx.segset.shape[0]:
          print(
              "Number of test segments reduced from %d to %d",
              self.segset.shape[0],
              outndx.segset.shape[0],
          )
      return outndx
  
imports: import numpy
  import copy
  import pickle
  from scipy import linalg
label_desc: Use image node_id 3 for calling the Ndx obj's underlying member method code with example usage: obj.filter(modlist, seglist, keep) and returns: outndx