astrophot.plots package
Submodules
astrophot.plots.diagnostic module
astrophot.plots.image module
- astrophot.plots.image.model_image(fig, ax, model, sample_image=None, window=None, target=None, showcbar=True, target_mask=False, cmap_levels=None, flipx=False, magunits=True, sample_full_image=False, **kwargs)[source]
This function is used to generate a model image and display it using the provided figure and axes.
- Parameters:
fig (matplotlib.figure.Figure) – The figure object in which the image will be displayed.
ax (matplotlib.axes.Axes) – The axes object on which the image will be plotted.
model (Model) – The model object used to generate a model image if sample_image is not provided.
sample_image (Image or Image_List, optional) – The image or list of images to be displayed. If None, a model image is generated using the provided model. Defaults to None.
window (Window, optional) – The window through which the image is viewed. If None, the window of the provided model is used. Defaults to None.
target (Target, optional) – The target or list of targets for the image or image list. If None, the target of the model is used. Defaults to None.
showcbar (bool, optional) – Whether to show the color bar. Defaults to True.
target_mask (bool, optional) – Whether to apply the mask of the target. If True and if the target has a mask, the mask is applied to the image. Defaults to False.
cmap_levels (int, optional) – The number of discrete levels to convert the continuous color map to. If not None, the color map is converted to a ListedColormap with the specified number of levels. Defaults to None.
sample_full_image – If True, every model will be sampled on the full image window. If False (default) each model will only be sampled in its fitting window.
**kwargs – Arbitrary keyword arguments. These are used to override the default imshow_kwargs.
- Returns:
The figure object containing the displayed image. ax (matplotlib.axes.Axes): The axes object containing the displayed image.
- Return type:
fig (matplotlib.figure.Figure)
Note
If the sample_image is an Image_List, this function will recursively call itself for each image in the list, with the corresponding target and window. The showcbar parameter and kwargs are passed unchanged to each recursive call.
- astrophot.plots.image.model_window(fig, ax, model, target=None, rectangle_linewidth=2, **kwargs)[source]
- astrophot.plots.image.psf_image(fig, ax, psf, window=None, cmap_levels=None, flipx=False, **kwargs)[source]
- astrophot.plots.image.residual_image(fig, ax, model, target=None, sample_image=None, showcbar=True, window=None, center_residuals=False, clb_label=None, normalize_residuals=False, flipx=False, sample_full_image=False, **kwargs)[source]
This function is used to calculate and display the residuals of a model image with respect to a target image. The residuals are calculated as the difference between the target image and the sample image.
- Parameters:
fig (matplotlib.figure.Figure) – The figure object in which the residuals will be displayed.
ax (matplotlib.axes.Axes) – The axes object on which the residuals will be plotted.
model (Model) – The model object used to generate a model image if sample_image is not provided.
target (Target or Image_List, optional) – The target or list of targets for the image or image list. If None, the target of the model is used. Defaults to None.
sample_image (Image or Image_List, optional) – The image or list of images from which residuals will be calculated. If None, a model image is generated using the provided model. Defaults to None.
showcbar (bool, optional) – Whether to show the color bar. Defaults to True.
window (Window or Window_List, optional) – The window through which the image is viewed. If None, the window of the provided model is used. Defaults to None.
center_residuals (bool, optional) – Whether to subtract the median of the residuals. If True, the median is subtracted from the residuals. Defaults to False.
clb_label (str, optional) – The label for the colorbar. If None, a default label is used based on the normalization of the residuals. Defaults to None.
normalize_residuals (bool, optional) – Whether to normalize the residuals. If True, residuals are divided by the square root of the variance of the target. Defaults to False.
sample_full_image – If True, every model will be sampled on the full image window. If False (default) each model will only be sampled in its fitting window.
**kwargs – Arbitrary keyword arguments. These are used to override the default imshow_kwargs.
- Returns:
The figure object containing the displayed residuals. ax (matplotlib.axes.Axes): The axes object containing the displayed residuals.
- Return type:
fig (matplotlib.figure.Figure)
Note
If the window, target, or sample_image are lists, this function will recursively call itself for each element in the list, with the corresponding window, target, and sample image. The showcbar, center_residuals, and kwargs are passed unchanged to each recursive call.
- astrophot.plots.image.target_image(fig, ax, target, window=None, **kwargs)[source]
This function is used to display a target image using the provided figure and axes.
- Parameters:
fig (matplotlib.figure.Figure) – The figure object in which the target image will be displayed.
ax (matplotlib.axes.Axes) – The axes object on which the target image will be plotted.
target (Image or Image_List) – The image or list of images to be displayed.
window (Window, optional) – The window through which the image is viewed. If None, the window of the provided target is used. Defaults to None.
**kwargs – Arbitrary keyword arguments.
- Returns:
The figure object containing the displayed target image. ax (matplotlib.axes.Axes): The axes object containing the displayed target image.
- Return type:
fig (matplotlib.figure.Figure)
Note
If the target is an Image_List, this function will recursively call itself for each image in the list. The window parameter and kwargs are passed unchanged to each recursive call.
astrophot.plots.profile module
- astrophot.plots.profile.radial_light_profile(fig, ax, model, rad_unit='arcsec', extend_profile=1.0, R0=0.0, resolution=1000, doassert=True, plot_kwargs={})[source]
- astrophot.plots.profile.radial_median_profile(fig, ax, model: AstroPhot_Model, count_limit: int = 10, return_profile: bool = False, rad_unit: str = 'arcsec', doassert: bool = True, plot_kwargs: dict = {})[source]
Plot an SB profile by taking flux median at each radius.
Using the coordinate transforms defined by the model object, assigns a radius to each pixel then bins the pixel-radii and computes the median in each bin. This gives a simple representation of the image data if one were to simply average the pixels along isophotes.
- Parameters:
fig – matplotlib figure object
ax – matplotlib axis object
model (AstroPhot_Model) – Model object from which to determine the radial binning. Also provides the target image to extract the data
count_limit (int) – The limit of pixels in a bin, below which uncertainties are not computed. Default: 10
return_profile (bool) – Instead of just returning the fig and ax object, will return the extracted profile formatted as: Rbins (the radial bin edges), medians (the median in each bin), scatter (the 16-84 quartile range / 2), count (the number of pixels in each bin). Default: False
rad_unit (str) – The name of the physical radius units. Default: “arcsec”
doassert (bool) – If any requirements are imposed on which kind of profile can be plotted, this activates them. Default: True
- astrophot.plots.profile.ray_light_profile(fig, ax, model, rad_unit='arcsec', extend_profile=1.0, resolution=1000, doassert=True)[source]