Esempio n. 1
0
    def _check_gfiles(self):
        """Checks whether all files exist

        The method checks whether the files whose names
        are within the class data do exist or not.
        An error is reported in case that the files
        do not exist.
        """
        # list of the root of all
        # global keys indicating a file
        fkeys = ['FFNAME']

        # go over all file keywords
        for key in fkeys:

            # identify the keyword in the list
            index = self._get_gkey_index(key)

            # check for existence
            if index > -1:

                # extract the keyvalue
                kvalue = self.gkeys[index].keyvalue

                # if the keyvalue is NOT None but the file does not exist
                if ((kvalue.upper() is not 'NONE')
                        and (not os.path.isfile(config_util.getCONF(kvalue)))):
                    # report an error
                    err_msg = ("The file: {0:s} does not exist!".format(
                        config_util.getCONF(kvalue)))
                    raise aXeError(err_msg)
Esempio n. 2
0
    def _check_files(self):
        """Checks the existence of the input files"""
        # check the direct image
        if not os.path.isfile(config_util.getDATA(self.direct_image)):
            err_msg = ("\nThe direct image is not available: {0:s}"
                       .format(config_util.getDATA(self.direct_image)))
            raise aXeSIMError(err_msg)

        # check the configuration file
        if not os.path.isfile(config_util.getCONF(self.configfile)):
            err_msg = ("\nThe configuration file is not available: {0:s}"
                       .format(config_util.getCONF(self.configfile)))
            raise aXeSIMError(err_msg)

        # check the simulated grism image
        if not os.path.isfile(config_util.getOUTSIM(self.simul_grisim)):
            err_msg = ("\nThe grism image is not available: {0:s}"
                       .format(config_util.getOUTSIM(self.simul_grisim)))
            raise aXeSIMError(err_msg)

        # check the IOL
        if not os.path.isfile(self.iolname):
            err_msg = ("\nThe Input Object List is not available: {0:s}"
                       .format(self.iolname))
            raise aXeSIMError(err_msg)

        try:
            float(self.bck_flux)
        except ValueError:
            # check the background image
            if not os.path.isfile(config_util.getCONF(self.bck_flux)):
                err_msg = ("\nThe background imagage is not available: {0:s}"
                           .format(config_util.getCONF(self.bck_flux)))
                raise aXeSIMError(err_msg)
Esempio n. 3
0
    def _get_dpp_list(self, inima, confterm, back):
        """Determine the name of all DPP files"""
        DPP_list = []

        # generate the input list for aXe
        axe_inputs = axeinputs.aXeInput(inima, confterm)

        # go over the list of all inputs
        for an_input in axe_inputs:
            # load the configuration file
            conf = configfile.ConfigFile(config_util.getCONF(an_input['config']))

            # get the image extensions
            ext_info = config_util.get_ext_info(config_util.getDATA(an_input['grisim']), conf)

            # get the name of all axe files
            axe_names = config_util.get_axe_names(an_input['grisim'], ext_info)

            # if requested,
            # append the background DPP file
            if back:
                DPP_list.append(axe_names['BCK_DPP'])
            else:
                # append the 'normal' DPP name to the list
                DPP_list.append(axe_names['DPP'])

        # return the DPP list
        return DPP_list
Esempio n. 4
0
    def _check_global_backsub(self):
        """Check for global background subtraction"""
        # go over all inputs
        for one_input in self.axe_inputs:

            # load the config file and get the extension information
            conf = configfile.ConfigFile(
                config_util.getCONF(one_input['config']))
            ext_info = config_util.get_ext_info(
                config_util.getDATA(one_input['grisim']), conf)

            # open the fits image
            gri_fits = fits.open(config_util.getDATA(one_input['grisim']),
                                 'readonly')

            # go to the correct header
            act_header = gri_fits[ext_info['fits_ext']].header

            # make sure a sky background value is set
            if 'SKY_CPS' in act_header and act_header['SKY_CPS'] >= 0.0:
                # close the fits
                gri_fits.close()
            else:
                # close fits, complain and out
                gri_fits.close()
                err_msg = (
                    "{0:s}: The grism image: \n{1:s}\nhas no keyword "
                    "SKY_CPS>=0.0 in the extension {2:d}. This means "
                    "it had NO global\nsky subtraction, which is "
                    "required for the CRR version of aXedrizzle!".format(
                        self.taskname,
                        config_util.getDATA(one_input['grisim']),
                        ext_info['fits_ext']))
                raise aXeError(err_msg)
Esempio n. 5
0
    def _check_dpps(self, back=False):
        # go over all inputs
        for one_input in self.axe_inputs:
            # load the config file and get the extension information
            conf = configfile.ConfigFile(
                config_util.getCONF(one_input['config']))
            ext_info = config_util.get_ext_info(
                config_util.getDATA(one_input['grisim']), conf)

            # derive the aXe names
            axe_names = config_util.get_axe_names(one_input['grisim'],
                                                  ext_info)

            # check the DPP file
            if not os.path.isfile(config_util.getOUTPUT(axe_names['DPP'])):
                # error and out
                err_msg = ("{0s:}: The DPP file: {1:s} does not exist!".format(
                    self.taskname, config_util.getOUTPUT(axe_names['DPP'])))
                raise aXeError(err_msg)

            # check for the background DPP file
            if back and not os.path.isfile(
                    config_util.getOUTPUT(axe_names['BCK_DPP'])):
                # error and out
                err_msg = ("{0:s}: The background DPP file: {1:s} does not "
                           "exist!".format(
                               self.taskname,
                               config_util.getOUTPUT(axe_names['BCK_DPP'])))
                raise aXeError(err_msg)
Esempio n. 6
0
    def _get_grism_ext_info(self, grisim='', config='', spec_hdu=None):
        """Determine the extension information on the grism image.

        Parameters
        ----------
        grisim : str
            The name of the grism images
        config : str
            The name of the configuration file
        spec_hdu : int, None
            The extention number of the spectra data

        Returns
        -------
        ext_info : dict
            A dictionary that contains the header extension
            and the data extension
        """

        if spec_hdu is None:
            conf = configfile.ConfigFile(getCONF(config))
            ext_info = get_ext_info(getDATA(grisim), conf)

        else:
            # make by hand the extension information
            ext_info = {'axe_ext': spec_hdu, 'fits_ext': spec_hdu - 1}

        # return the extension info
        return ext_info
Esempio n. 7
0
    def _make_objPET(self):
        """Generate the object PET."""

        # set the use_direct flag
        # NOTE: the flag is only usefull
        #       for the C-version, the python
        #       version does not need it!

        use_direct = False
        if self.dirim is not None:
            use_direct = True

        # run SEX2GOL
        axetasks.sex2gol(grism=self.grisim,
                         config=config_util.getCONF(self.config),
                         in_sex=config_util.getDATA(self.objcat),
                         use_direct=use_direct,
                         direct=config_util.getDATA(self.dirim),
                         dir_hdu=None,
                         spec_hdu=None,
                         out_sex=None)

        # run GOL2AF
        axetasks.gol2af(grism=self.grisim,
                        config=self.config,
                        mfwhm=self.params['extrfwhm'],
                        back=False,
                        orient=self.params['orient'],
                        slitless_geom=self.params['slitless_geom'],
                        exclude=self.params['exclude'],
                        lambda_mark=self.params['lambda_mark'],
                        dmag=self.dmag,
                        out_af=None,
                        in_gol=None)

        # run AF2PET
        axetasks.af2pet(grism=self.grisim,
                        config=self.config,
                        back=False,
                        out_pet=None)

        # run PETCONT
        axetasks.petcont(grism=self.grisim,
                         config=self.config,
                         cont_model=self.params['cont_model'],
                         model_scale=self.params['model_scale'],
                         spec_models=None,
                         object_models=None,
                         inter_type=self.params['inter_type'],
                         lambda_psf=self.params['lambda_psf'],
                         cont_map=True,
                         in_af="")

        # run PETFF
        axetasks.petff(grism=self.grisim,
                       config=self.config,
                       back=False,
                       ffname=None)
Esempio n. 8
0
    def _get_dirname_information(self,
                                 dirname=None,
                                 config="",
                                 grisim="",
                                 grism_extinfo=None,
                                 dir_hdu=None):
        """Determine the direct image information.

        Parameters
        ----------
        dirname : str
            Diretory name
        config : str
            The name of the config file
        grisim : str
            The name of the grisim image
        grism_extinfo : dict
            Dictionary of header information
        dir_hdu :  fits.HDU
            FITS header data unit

        Returns
        -------
        A tuple of the direct image name and a dictionary of
        extension information

        """
        # check whether ANY direct image information exists
        if ((dirname is None) and (dir_hdu is None)):
            # set the grism image as direct image
            dirname = grisim
            dirname_extinfo = grism_extinfo

        elif ((dirname is not None) and (dir_hdu is None)):
            # load the configuration file;
            # determine the extension information
            conf = configfile.ConfigFile(getCONF(config))
            dirname_extinfo = get_ext_info(getDATA(grisim), conf)
            del conf

        elif ((dirname is not None) and (dir_hdu is not None)):
            # make by hand the extension information
            dirname_extinfo = {'axe_ext': dir_hdu, 'fits_ext': dir_hdu - 1}

        else:
            # error and out
            err_msg = ("Specifying NO direct image but a direct image HDU: "
                       "{0:d} makrs NO sense!".format(dir_hdu))
            raise aXeError(err_msg)

        # return the name and the extension info
        return dirname, dirname_extinfo
Esempio n. 9
0
    def check_files(self):
        """Checks whether all files exist

        The method checks whether the files whose names
        are within the class data do exist or not.
        An error is reported in case that the files
        do not exist.

        """
        n_sens = 0

        # list of the root of all
        # beamword keys indicating a file
        fkeys = ['SENSITIVITY_']

        # append the beam identifier to the
        # keyword roots to get the full keyname
        for key in fkeys:
            full_keyword = key + self.ident

            # go over all beam keys
            for bkey in self.beamkeys:

                # check whether the current keyword is right
                # and whether the keyvalue is not 'None'
                if ((bkey.keyword is full_keyword)
                        and (bkey.keyvalue.upper() is not 'NONE')):
                    # check for the file
                    if not os.path.isfile(config_util.getCONF(bkey.keyvalue)):
                        # report an error
                        err_msg = ("The file: {0:s} does not exist!".format(
                            config_util.getCONF(bkey.keyvalue)))
                        raise aXeError(err_msg)
                    else:
                        n_sens += 1

        return n_sens
Esempio n. 10
0
    def _make_mask(self):
        """Make the background mask file"""

        # set the use_direct flag
        # NOTE: the flag is only useful
        #       for the C-version, the python
        #       version does not need it!
        if self.dirim is not None:
            use_direct = True
        else:
            use_direct = False

        # run SEX2GOL
        axetasks.sex2gol(grism=self.grisim,
                         config=config_util.getCONF(self.config),
                         in_sex=self.objcat,
                         use_direct=use_direct,
                         direct=self.dirim,
                         dir_hdu=None,
                         spec_hdu=None,
                         out_sex=None)

        # run GOL2AF
        axetasks.gol2af(grism=os.path.split(self.grisim)[-1],
                        config=self.config,
                        mfwhm=self.params['mfwhm'],
                        back=False,
                        orient=True,
                        slitless_geom=True,
                        exclude=False,
                        lambda_mark=None,
                        dmag=self.dmag,
                        out_af=None,
                        in_gol=None)

        #  run BACKEST
        axetasks.backest(grism=os.path.split(self.grisim)[-1],
                         config=self.config,
                         np=0,
                         interp=-1,
                         niter_med=None,
                         niter_fit=None,
                         kappa=None,
                         smooth_length=None,
                         smooth_fwhm=None,
                         old_bck=False,
                         mask=True,
                         in_af="",
                         out_bck=None)
Esempio n. 11
0
    def __init__(self, drizzle_params, modvar=0):
        """Initializes the class"""
        # get the name of the input configuration file;
        # load the configuration file
        config_file = drizzle_params['CONF']
        config = configfile.ConfigFile(config_utils.getCONF(config_file))

        # get the header
        header = self._get_header()

        # generate the list of keywords
        keylist = self._make_keylist(config, drizzle_params, modvar)

        # generate the configuration file via the super class
        super(DrizzleConf, self).__init__(keylist, header)
Esempio n. 12
0
    def _get_ext_names(self, drizzle_params):
        """Define the file names for extracting the drizzled spectra."""

        ext_names = {}

        # check that a root name is given;
        # message and out if not
        if 'ROOT' not in drizzle_params:
            err_msg = 'Not root name given. Nothing to do!'
            raise aXeError(err_msg)

        # compose the filenames for the input list, the configuration file
        # and the OAF file
        ext_names['OLIS'] = drizzle_params['ROOT'] + '_2.lis'

        ext_names['BLIS'] = drizzle_params['ROOT'] + '_2.BCK.lis'

        ext_names['OAF'] = drizzle_params['ROOT'] + '_2.OAF'
        ext_names['DRZ_OAF'] = config_utils.getDRIZZLE(ext_names['OAF'])

        ext_names['BAF'] = drizzle_params['ROOT'] + '_2.BAF'
        ext_names['DRZ_BAF'] = config_utils.getDRIZZLE(ext_names['BAF'])

        ext_names['FITS'] = drizzle_params['ROOT'] + '.fits'
        ext_names['DRZ_FITS'] = config_utils.getDRIZZLE(ext_names['FITS'])

        ext_names['OPET'] = drizzle_params['ROOT'] + '_2.PET.fits'
        ext_names['DRZ_OPET'] = config_utils.getDRIZZLE(ext_names['OPET'])

        ext_names['BPET'] = drizzle_params['ROOT'] + '_2.BCK.PET.fits'
        ext_names['DRZ_BPET'] = config_utils.getDRIZZLE(ext_names['BPET'])

        ext_names['SPC'] = drizzle_params['ROOT'] + '_2.SPC.fits'
        ext_names['DRZ_SPC'] = config_utils.getDRIZZLE(ext_names['SPC'])

        ext_names['STP'] = drizzle_params['ROOT'] + '_2.STP.fits'
        ext_names['DRZ_STP'] = config_utils.getDRIZZLE(ext_names['STP'])

        ext_names['CONF'] = drizzle_params['ROOT'] + '.conf'
        ext_names['CON_CONF'] = config_utils.getCONF(ext_names['CONF'])

        # return the dictionary
        return ext_names
Esempio n. 13
0
    def _get_opt_names(self, drizzle_params):
        """Define the file names for the optimal extraction"""
        # make an empty dictionary
        opt_names = {}

        # check that a root name is given;
        # message and out if not
        if 'ROOT' not in drizzle_params:
            err_msg = 'Root name not given. Nothing to do!'
            raise aXeError(err_msg)

        # compose the filenames for the input list, the configuration file
        # and the OAF file
        opt_names['OLIS'] = drizzle_params['ROOT'] + '_2.lis'

        opt_names['BLIS'] = drizzle_params['ROOT'] + '_2.BCK.lis'

        opt_names['OAF'] = drizzle_params['ROOT'] + '_2.OAF'
        opt_names['DRZ_OAF'] = config_utils.getDRIZZLE(opt_names['OAF'])

        opt_names['BAF'] = drizzle_params['ROOT'] + '_2.BAF'
        opt_names['DRZ_BAF'] = config_utils.getDRIZZLE(opt_names['BAF'])

        opt_names['FITS'] = drizzle_params['ROOT'] + '.fits'
        opt_names['DRZ_FITS'] = config_utils.getDRIZZLE(opt_names['FITS'])

        opt_names['OPET'] = drizzle_params['ROOT'] + '_2_opt.PET.fits'
        opt_names['DRZ_OPET'] = config_utils.getDRIZZLE(opt_names['OPET'])

        opt_names['BPET'] = drizzle_params['ROOT'] + '_2_opt.BCK.PET.fits'
        opt_names['DRZ_BPET'] = config_utils.getDRIZZLE(opt_names['BPET'])

        opt_names['SPC'] = drizzle_params['ROOT'] + '_2_opt.SPC.fits'
        opt_names['DRZ_SPC'] = config_utils.getDRIZZLE(opt_names['SPC'])

        opt_names['STP'] = drizzle_params['ROOT'] + '_2_opt.STP.fits'
        opt_names['DRZ_STP'] = config_utils.getDRIZZLE(opt_names['STP'])

        opt_names['CONF'] = drizzle_params['ROOT'] + '.conf'
        opt_names['CON_CONF'] = config_utils.getCONF(opt_names['CONF'])

        # return the dictionary
        return opt_names
Esempio n. 14
0
    def run(self):
        # load the configuration files;
        # get the extension info
        conf = configfile.ConfigFile(config_util.getCONF(self.config))
        ext_info = config_util.get_ext_info(config_util.getDATA(self.grisim),
                                            conf)
        del conf

        # Does this harm data that was astrodrizzled?
        if (('drzfwhm' in self.params) and (self.params['drzfwhm'])
                or (('cont_model' in self.params) and
                    (config_util.is_quant_contam(self.params['cont_model'])))):

            # generate the non-linear distortions from the IDCTAB;
            # and store them in the fits-file header
            _log.info(
                "Generating and storing nonlinear distortions in {0}".format(
                    config_util.getDATA(self.grisim)))
            nlins = nlincoeffs.NonLinCoeffs(config_util.getDATA(self.grisim),
                                            ext_info)
            nlins.make()
            nlins.store_coeffs()
            del nlins

        # make the object PET's
        self._make_objPET()

        # make a background PET if necessary
        if 'back' in self.params and self.params['back']:
            _log.info("\nMaking backpet\n")
            self._make_bckPET()

        # extract the spectra
        if 'spectr' in self.params and self.params['spectr']:
            _log.info("\nMaking spectra\n")
            self._make_spectra()

        # make the proper non-quantitative contamination
        if ('drzfwhm' in self.params and self.params['drzfwhm']) and \
           ('cont_model' in self.params and not config_util.is_quant_contam(self.params['cont_model'])):
            _log.info("\nmaking non quant contam\n")
            self._make_drzgeocont(ext_info)
Esempio n. 15
0
    def _check_fluxcubes(self):
        # go over all inputs
        for one_input in self.axe_inputs:

            # load the config file and get the extension information
            conf = configfile.ConfigFile(
                config_util.getCONF(one_input['config']))
            ext_info = config_util.get_ext_info(
                config_util.getDATA(one_input['grisim']), conf)

            # derive the aXe names
            axe_names = config_util.get_axe_names(one_input['grisim'],
                                                  ext_info)

            # check the fluxcube
            if not os.path.isfile(config_util.getDATA(axe_names['FLX'])):
                # error and out
                err_msg = (
                    "{0:s}: The fluxcube file: {1:s} does not exist!".format(
                        self.taskname, config_util.getDATA(axe_names['FLX'])))
                raise aXeError(err_msg)
Esempio n. 16
0
    def __init__(self,
                 grisim="",
                 objcat="",
                 dirim="",
                 config="",
                 dmag=None,
                 **params):
        if grisim:
            self.grisim = config_util.getDATA(grisim)
        else:
            raise ValueError("No grisim image specified for axeprep")
        self.objcat = config_util.getDATA(objcat)
        _log.info("\n**Using object catalog: {0}\n".format(self.objcat))
        self.dirim = config_util.getDATA(dirim)
        self.config = config
        self.dmag = dmag
        self.params = params

        # store the master background
        if 'master_bck' in params:
            self.master_bck = config_util.getCONF(params['master_bck'])
Esempio n. 17
0
    def run(self):
        """Run AXEPREP on one slitless image"""

        # load the configuration files;
        # get the extension info
        conf = configfile.ConfigFile(config_util.getCONF(self.config))
        ext_info = config_util.get_ext_info(self.grisim, conf)

        # make a background PET if necessary
        if 'backgr' in self.params and self.params['backgr']:
            self._subtract_background(ext_info)

        # make a background PET if necessary
        if 'norm' in self.params and self.params['norm']:
            self._transform_to_cps(ext_info, conf)

        # check wheter the gain correction is desired
        if 'gcorr' in self.params and self.params['gcorr']:

            # check whether we have NICMOS data
            if not self._is_nicmos_data():

                # check whether gain correction IS desired
                if self._check_gain_correction():

                    # make the gain correction
                    self._apply_gain_correction(ext_info)

            else:

                # make the gain correction
                self._apply_gain_correction(ext_info)

        del conf

        # return something
        return 1
Esempio n. 18
0
    def check_simdirim_input(self, incat, config, tpass_direct, model_spectra,
                             model_images, nx, ny, exptime, bck_flux):
        """Does basic checks on the parameters

        The method checks whether all input values are reasonable, e.g.
        the exposure time and background flux >= 0.0 and similar.
        Input files are checked for existence. Also the input type is
        checked for the numbers.

        Parameters
        ----------
        incat: str
            name of model object table
        config: str
            aXe configuration file name
        tpass_direct: str
            total passband file
        model_spectra: str
            name of model spectra
        model_images: str
            name of model images
        nx: int
            number of pixels in x
        ny: int
            number of pixels in y
        exptime: float
            exposure time
        bck_flux: float
            flux in background
        """

        # do the setup
        config_util.axe_setup(axesim=True)

        # check the existence of the
        # model object table
        if not os.path.isfile(config_util.getDATA(incat)):
            error_message = (
                "The Model Object Table does not exist: {0}".format(
                    config_util.getDATA(incat)))
            raise aXeSIMError(error_message)

        # check the existence of the
        # axe configuration file
        if not os.path.isfile(config_util.getCONF(config)):
            error_message = (
                "The aXe configuration file does not exist: {0}".format(
                    config_util.getCONF(config)))
            raise aXeSIMError(error_message)

        else:
            # load the aXe configuration file
            conf = configfile.ConfigFile(config_util.getCONF(config))

            # make the internal checks
            n_sens = conf.check_files(check_glob=False)

            # make sure there is
            # at least one sens. file
            if n_sens < 1:
                error_message = ("There must be at least one sensitivity "
                                 "file in: {0}".format(
                                     config_util.getCONF(config)))
                raise aXeSIMError(error_message)

        # check the existence of the
        # total passband file
        if not os.path.isfile(config_util.getSIMDATA(tpass_direct)):
            error_message = (
                "The total passband file does not exist: {0}".format(
                    config_util.getSIMDATA(tpass_direct)))
            raise aXeSIMError(error_message)

        if model_spectra is not None:
            # check the existence of the
            # model spectra file
            if not os.path.isfile(config_util.getDATA(model_spectra)):
                error_message = (
                    "The model spectra file does not exist: {0}".format(
                        config_util.getDATA(config)))
                raise aXeSIMError(error_message)

        if model_images is not None:
            # check the existence of the
            # model images file
            if not os.path.isfile(config_util.getDATA(model_images)):
                error_message = (
                    "The model images file does not exist: {0}".format(
                        config_util.getDATA(config)))
                raise aXeSIMError(error_message)

        # check the nx-value
        if ((nx is not None) and (nx <= 0.0)):
            error_message = ("Value for 'nx' or 'nx_dir' must be positive: "
                             "{0:s}".format(str(nx)))
            raise aXeSIMError(error_message)

        # check the ny-value
        if ((ny is not None) and (ny <= 0)):
            error_message = ("Value for 'ny' or 'ny_dir' must be positive: "
                             "{0:s}".format(str(ny)))
            raise aXeSIMError(error_message)

        # check the exptime-value
        if ((exptime is not None) and (exptime < 0)):
            error_message = ("Value for 'exptime' or 'exptime_dir' must be "
                             "positive: {0:s}".format(str(exptime)))
            raise aXeSIMError(error_message)

        if bck_flux is not None:
            # check the bck_flux-value
            try:
                # convert to float
                bck = float(bck_flux)

                # check for positive value
                if bck < 0:
                    error_message = ("Value for 'bck_flux' or 'bck_flux_dir'"
                                     " must be positive: {0:s}".format(
                                         str(bck_flux)))
                    raise aXeSIMError(error_message)

                # catch a string
            except ValueError:
                # check for existence of file
                if not os.path.isfile(config_util.getCONF(bck_flux)):
                    error_message = (
                        "The background file does not exist: {0}".format(
                            config_util.getCONF(bck_flux)))
                    raise aXeSIMError(error_message)
Esempio n. 19
0
    def check_simdispim_input(self, incat, config, lambda_psf, model_spectra,
                              model_images, nx, ny, exptime, bck_flux,
                              extraction, extrfwhm, orient, slitless_geom,
                              adj_sens):
        """Does basic checks on the parameters

        The method checks whether all input values are reasonable, e.g.
        the exposure time and background flux >= 0.0 and similar.
        Input files are checked for existence. Also the input type is
        checked for the numbers.

        Parameters
        ----------
        incat: str
            name of model object table
        config: str
            aXe configuration file name
        lambda_psf: float
            wavelength the object shapes were determined at
        model_spectra: str
            name of model spectra
        model_images: str
            name of model images
        nx: int
            number of pixels in x
        ny: int
            number of pixels in y
        exptime: float
            exposure time
        bck_flux: float
            flux in background
        extraction: bool
            flag for default extraction
        extrfwhm: float
            multiplier for extraction width
        orient: bool
            flag for tilted extraction
        slitless_geom: bool
            flag for slitless optimized extraction
        adj_sens: bool
            flag for adjusted flux conversion
        """

        # do the setup
        config_util.axe_setup(axesim=True)

        # check the existence of the
        # model object table
        if not os.path.isfile(config_util.getDATA(incat)):
            msg = ("The Model Object Table does not exist: {}".format(
                config_util.getDATA(incat)))
            raise aXeSIMError(msg)

        # check the existence of the
        # axe configuration file
        if not os.path.isfile(config_util.getCONF(config)):
            msg = ("The aXe configuration file does not exist: {}".format(
                config_util.getCONF(config)))
            raise aXeSIMError(msg)

        else:
            # load the aXe configuration file
            conf = configfile.ConfigFile(config_util.getCONF(config))

            # make the internal checks
            n_sens = conf.check_files(check_glob=False)

            # make sure there is
            # at least one sens. file
            if n_sens < 1:
                msg = ("There must be at least one sensitivity file in: {}".
                       format(config_util.getCONF(config)))
                raise aXeSIMError(msg)

        # check whether the configuration files
        # allows the requested extraction
        if extraction and (slitless_geom or adj_sens):
            extr_ready = conf.confirm_extrkeys()

            # error and out
            if not extr_ready:
                msg = ("It is not possible to perform the requested"
                       "extraction. The likely cause is that the configuration"
                       "file does NOT contain the keywords 'POBJSIZE' or "
                       "'SMFACTOR' or their values are NOT reasonable "
                       "(e.g. <0.0)!")
                raise aXeSIMError(msg)

        # check the lambda_psf-value
        if ((lambda_psf is not None) and (lambda_psf <= 0.0)):
            msg = ("Value for 'lambda_psf' must be positive: {0:s}".format(
                str(lambda_psf)))
            raise aXeSIMError(msg)

        if (model_spectra is not None):
            # check the existence of the
            # model spectra file
            if not os.path.isfile(config_util.getDATA(model_spectra)):
                msg = ("The model spectra file does not exist: {}".format(
                    config_util.getDATA(model_spectra)))
                raise aXeSIMError(msg)

        if model_images is not None:
            # check the existence of the
            # model images file
            if not os.path.isfile(config_util.getDATA(model_images)):
                msg = ("The model images file does not exist: ".format(
                    config_util.getDATA(model_images)))
                raise aXeSIMError(msg)

        # check the nx-value
        if ((nx is not None) and (nx <= 0.0)):
            msg = ("Value for 'nx' or 'nx_disp' must be positive: {0:g}".
                   format(nx))
            raise aXeSIMError(msg)

        # check the ny-value
        if ((ny is not None) and (ny <= 0)):
            error_message = ("Value for 'ny' or 'ny_disp' must be "
                             "positive: {0:g}".format(ny))
            raise aXeSIMError(error_message)

        # check the exptime-value
        if ((exptime is not None) and (exptime < 0)):
            error_message = ("Value for 'exptime' or 'exptime_disp' must be "
                             "positive: {0:g}".format(exptime))
            raise aXeSIMError(error_message)

        # the extraction width must be set!
        if not extrfwhm:
            error_message = ("Value for 'extrfwhm' must not be 0.0 to create"
                             "PETs, but extrfwhm={0:0.1f}!".format(extrfwhm))
            raise aXeSIMError(error_message)

        # negative extraction width is significant ONLY
        # if orient="NO"
        if orient and extrfwhm < 0.0:
            error_message = (
                "Negative width extrfwhm={0:0.1f} together with "
                "extraction orient=yes does NOT make sense!".format(extrfwhm))
            raise aXeSIMError(error_message)

        try:
            # convert to float
            bck = float(bck_flux)

            # check for positive value
            if bck < 0:
                error_message = ("Value for 'bck_flux' or 'bck_flux_disp'"
                                 " most be positive: {0:g}".format(bck_flux))
                raise aXeSIMError(error_message)

        # catch a string
        except ValueError:
            # check for existence of file
            if not os.path.isfile(config_util.getCONF(bck_flux)):
                error_message = (
                    "The background file does not exist: {0}".format(
                        config_util.getCONF(bck_flux)))
                raise aXeSIMError(error_message)