Internal function than runs an inversion using CRTomo.

        Parameters
        ----------
        tempdir : string
            directory which to use as a tomodir
        catch_output : bool, optional
            if True, catch all outputs of the CRTomo call (default: True)
        cores : int, optional
            how many cores to use. (default 2)

def _invert(self, tempdir, catch_output=True, **kwargs):
        """Internal function than runs an inversion using CRTomo.

        Parameters
        ----------
        tempdir : string
            directory which to use as a tomodir
        catch_output : bool, optional
            if True, catch all outputs of the CRTomo call (default: True)
        cores : int, optional
            how many cores to use. (default 2)
        """
        nr_cores = kwargs.get('cores', 2)
        print('attempting inversion in directory: {0}'.format(tempdir))
        pwd = os.getcwd()
        os.chdir(tempdir)

        self.save_to_tomodir('.')
        os.chdir('exe')
        binary = CRBin.get('CRTomo')
        print('Using binary: {0}'.format(binary))
        print('calling CRTomo')
        # store env variable
        env_omp = os.environ.get('OMP_NUM_THREADS', '')
        os.environ['OMP_NUM_THREADS'] = '{0}'.format(nr_cores)
        if catch_output:
            subprocess.check_output(
                binary,
                shell=True,
                stderr=subprocess.STDOUT,
            )
        else:
            subprocess.call(
                binary,
                shell=True,
            )
        # reset environment variable
        os.environ['OMP_NUM_THREADS'] = env_omp

        print('finished')

        os.chdir(pwd)
        self.read_inversion_results(tempdir)