class_docstr: A cost function generator.
      
docstr: Adds a forward model factory to the cost factory.
  
  Inputs:
      model   -- a callable function factory object
      inputs  -- number of input arguments to model
      name    -- a string representing the model name
  
  Example:
      >>> import numpy as np
      >>> C = CostFactory()
      >>> C.addModel(np.poly, inputs=3)
          
docstr_tok: ["Adds","a","forward","model","factory","to","the","cost","factory",".","Inputs",":","model","--","a","callable","function","factory","object","inputs","--","number","of","input","arguments","to","model","name","--","a","string","representing","the","model","name","Example",":",">",">",">","import","numpy","as","np",">",">",">","C","=","CostFactory","(",")",">",">",">","C.addModel","(","np.poly",",","inputs=3",")"]
code: def addModel(
      self,
      model,
      inputs,
      name=None,
      outputFilter=identity,
      inputChecker=null_check,
  ):
      """
      Adds a forward model factory to the cost factory.
  
      Inputs:
          model   -- a callable function factory object
          inputs  -- number of input arguments to model
          name    -- a string representing the model name
  
      Example:
          >>> import numpy as np
          >>> C = CostFactory()
          >>> C.addModel(np.poly, inputs=3)
      """
      if name is None:
          import dill
  
          name = dill.source.getname(model)
      if name is None:
          for i in range(len(self._names) + 1):
              name = "model" + str(i)
              if name not in self._names:
                  break
      elif name in self._names:
          print("Model [%s] already in database." % name)
          raise AssertionError
      self._names.append(name)
      self._forwardFactories.append(model)
      self._inputs.append(inputs)
      self._outputFilters.append(outputFilter)
      self._inputCheckers.append(inputChecker)
  
file_path: mystic/mystic/forward_model.py
imports: from mystic.filters import identity, component
  from mystic.filters import null_check
  from numpy import pi, sqrt, array, mgrid, random, real, conjugate, arange, sum
label_desc: Use image node_id 2 for calling the CostFactory obj's underlying member method code with example usage: obj.addModel(model, inputs, name, outputFilter, inputChecker) without return types