code: def invert(self, output_directory=None, catch_output=True, **kwargs):
          
          self._check_state()
          if self.can_invert:
              if output_directory is not None:
                  if not os.path.isdir(output_directory):
                      os.makedirs(output_directory)
                      tempdir = output_directory
                      self._invert(tempdir, catch_output, **kwargs)
                  else:
                      raise IOError(
                          'output directory already exists: {0}'.format(
                              output_directory
                          )
                      )
              else:
                  with tempfile.TemporaryDirectory(dir=self.tempdir) as tempdir:
                      self._invert(tempdir, catch_output, **kwargs)
  
              return 0
          else:
              print(
                  'Sorry, no measurements present, cannot model yet'
              )
              return 1
docs: Invert this instance, and import the result files
  
          No directories/files will be overwritten. Raise an IOError if the
          output directory exists.
  
          Parameters
          ----------
          output_directory: string, optional
              use this directory as output directory for the generated tomodir.
              If None, then a temporary directory will be used that is deleted
              after import.
          catch_output: bool, optional
              Do not show CRTomo output
          cores: int, optional
              how many cores to use for CRTomo
  
          Returns
          -------
          return_code: bool
              Return 0 if the inversion completed successfully. Return 1 if no
              measurements are present.