MorphModelImageCreator¶
-
class
gammapy.image.models.
MorphModelImageCreator
(cfg_file, exposure, psf_file=None, apply_psf=True, background=None, flux_factor=1e-12, compute_excess=True)[source]¶ Bases:
object
Create model images from a HGPS pipeline source config file.
Uses astropy to evaluate the source model, with oversampling or integrating over pixels.
Parameters: cfg_file : str
Config file with all the sources listed.
exposure : str
Fits image file with the exposure.
psf_file : str (optional)
Json file with PSF information.
background : str (optional)
Fits image file with the background.
apply_psf : bool
Whether the psf should be applied.
compute_excess : bool
Whether to compute an excess image.
flux_factor : float
Flux conversion factor.
Examples
Here is an example how to use
MorphModelImageCreator
:>>> from gammapy.image.models import MorphModelImageCreator >>> model_image_creator = MorphModelImageCreator(cfg_file='input_sherpa.cfg', ... exposure='exposure.fits', ... psf_file='psf.json') >>> model_image_creator.evaluate_model(mode='center') >>> model_image_creator.save('model_image.fits')
Methods Summary
evaluate_model
(**kwargs)Evaluate model by oversampling or taking the value at the center of the pixel. fake_counts
(N[, random_state])Fake measurement data by adding Poisson noise to the model image. save
(filename, **kwargs)Save model image to file. Methods Documentation
-
evaluate_model
(**kwargs)[source]¶ Evaluate model by oversampling or taking the value at the center of the pixel.
-
fake_counts
(N, random_state='random-seed', **kwargs)[source]¶ Fake measurement data by adding Poisson noise to the model image.
Parameters: N : int
Number of measurements to fake.
random_state : {int, ‘random-seed’, ‘global-rng’,
RandomState
}Defines random number generator initialisation. Passed to
get_random_state
.
-