- craftutils.observation.epoch.ImagingEpoch.frame_class.model_background_local(centre: ~astropy.coordinates.sky_coordinate.SkyCoord, frame: ~astropy.units.quantity.Quantity, ext: int = 0, model_type: <module 'astropy.modeling.models' from '/home/docs/checkouts/readthedocs.org/user_builds/craft-optical-followup/envs/latest/lib/python3.8/site-packages/astropy/modeling/models.py'> = <class 'astropy.modeling.polynomial.Polynomial2D'> Name: Polynomial2D N_inputs: 2 N_outputs: 1 Fittable parameters: <property object>, fitter_type: ~astropy.modeling.fitting.Fitter = <class 'astropy.modeling.fitting.LevMarLSQFitter'>, init_params: dict = {'degree': 3}, write: ~typing.Optional[str] = None, write_subbed: ~typing.Optional[str] = None, generate_mask: bool = True, mask_ellipses: ~typing.Optional[~typing.List[dict]] = None, mask_kwargs: dict = {}, saturate_factor: float = 0.5)
Models and subtracts the background of a specified part of the image. A mask can be generated using either sep or photutils, automatically excluding objects from the background fit. Negative and saturated or near-saturated pixels, above saturate_factor * header[“SATURATE”], will also be masked regardless of generate_mask.
- Parameters¶
- centre
the centre of the mask region, as a SkyCoord.
- frame
the size of the region to fit, from centre to the edge, in pixels or units of on-sky angle. Currently only a square region is supported.
- ext
FITS extension of image to model.
- model_type
an astropy model to use for the background.
- fitter_type
an astropy Fitter to use.
- init_params
the initial parameters to give to the model.
- write
path to write the modelled background to disk, as a FITS file. If None, no file is written.
- write_subbed
path to write the subtracted image to, as a FITS file. If None, no file is written.
- generate_mask
whether to generate a mask or not.
- mask_ellipses
a set of ellipses to mask. If a mask is generated, will be added to it.
- mask_kwargs
keyword arguments to pass to generate_mask().
- saturate_factor
pixels with values greater than `saturate_factor * header[“SATURATE”] will be masked.
- Returns¶
Tuple of: model: the fitted model. model_eval: the pixel values of the model. data: the original data. subbed_data: the full image with the model subtracted from the window. mask: the final mask used for fitting. weights: the weights used for fitting, the inverse of the image error.