def model(self,
              voltages=True,
              sensitivities=False,
              potentials=False,
              output_directory=None,
              silent=False,
              ):
        """Forward model the tomodir and read in the results
        """
        self._check_state()
        if self.can_model:
            if output_directory is not None:
                if not os.path.isdir(output_directory):
                    os.makedirs(output_directory)
                    tempdir = output_directory
                    self._model(voltages, sensitivities, potentials, tempdir)
                else:
                    raise IOError(
                        'output directory already exists: {0}'.format(
                            output_directory
                        )
                    )
            else:
                with tempfile.TemporaryDirectory(dir=self.tempdir) as tempdir:
                    self._model(
                        voltages, sensitivities, potentials, tempdir,
                        silent=silent
                    )

            return 1
        else:
            print('Sorry, not all required information to model are present')
            print('Check:')
            print('1) configurations present: self.configs.configs')
            print('2) is a model present')
            return None
def model ( self , voltages = True , sensitivities = False , potentials = False , output_directory = None , silent = False , ) : self . _check_state ( ) if self . can_model : if output_directory is not None : if not os . path . isdir ( output_directory ) : os . makedirs ( output_directory ) tempdir = output_directory self . _model ( voltages , sensitivities , potentials , tempdir ) else : raise IOError ( 'output directory already exists: {0}' . format ( output_directory ) ) else : with tempfile . TemporaryDirectory ( dir = self . tempdir ) as tempdir : self . _model ( voltages , sensitivities , potentials , tempdir , silent = silent ) return 1 else : print ( 'Sorry, not all required information to model are present' ) print ( 'Check:' ) print ( '1) configurations present: self.configs.configs' ) print ( '2) is a model present' ) return None
Forward model the tomodir and read in the results