PetrosianCorrection

class petrofit.petrosian.PetrosianCorrection(grid, enforce_range=True)[source]

Bases: object

This class computes corrections for Petrosian given default Petrosian measurements.

Parameters:
gridstr

Correction grid generated by petrofit.correction.generate_petrosian_sersic_correction. Use PetrosianCorrection.read(file_path) to read grid from file.

enforce_rangebool

If true, the nearest approximation is returned. If false, an assertion will be applied that makes sure that the profiles to be corrected are covered by the correction grid.

Attributes Summary

grid_keys

Return dictionary keys of the grid.

Methods Summary

correct(p)

Given a Petrosian object, return a corrected Petrosian object

estimate_epsilon(p)

Given the half light radius and c2080 computed using the default epsilon value, return a corrected epsilon value.

estimate_n(p)

Given the half light radius and c2080 computed using the default epsilon value, return an estimated sersic index n.

filter_grid(key, value)

Return a filtered grid based on key and value.

plot_correction(p[, cmap, target_c, ...])

Plots the correction grid for the given a Petrosian object. Parameters: ----------- p : array-like The Petrosian object for which the correction grid is to be plotted. cmap : str, optional The colormap to be used for the plot. Default is "hot". target_c : str, optional The color to be used for the target. Default is "blue". cmap_key : str, optional The key to be used for the colormap. Default is "n". colorbar_label : str, optional The label for the colorbar. Default is None. suptitle : str, optional The super title for the plot. Default is None. axs : matplotlib.axes.Axes, optional The axes on which to plot. If None, a new figure and axes are created. Default is None. Returns: -------- fig : matplotlib.figure.Figure The figure object containing the plot. axs : matplotlib.axes.Axes The axes object containing the plot.

read(grid_file[, file_format])

Read grid from file.

unique_grid_values(key)

Return unique values of a key in the grid.

write(grid_file[, file_format])

Write grid to file.

Attributes Documentation

grid_keys

Return dictionary keys of the grid.

Methods Documentation

correct(p)[source]

Given a Petrosian object, return a corrected Petrosian object

estimate_epsilon(p)[source]

Given the half light radius and c2080 computed using the default epsilon value, return a corrected epsilon value.

estimate_n(p)[source]

Given the half light radius and c2080 computed using the default epsilon value, return an estimated sersic index n.

filter_grid(key, value)[source]

Return a filtered grid based on key and value.

plot_correction(p, cmap='hot', target_c='blue', cmap_key='n', colorbar_label=None, suptitle=None, axs=None)[source]

Plots the correction grid for the given a Petrosian object. Parameters: ———– p : array-like

The Petrosian object for which the correction grid is to be plotted.

cmapstr, optional

The colormap to be used for the plot. Default is “hot”.

target_cstr, optional

The color to be used for the target. Default is “blue”.

cmap_keystr, optional

The key to be used for the colormap. Default is “n”.

colorbar_labelstr, optional

The label for the colorbar. Default is None.

suptitlestr, optional

The super title for the plot. Default is None.

axsmatplotlib.axes.Axes, optional

The axes on which to plot. If None, a new figure and axes are created. Default is None.

Returns:

figmatplotlib.figure.Figure

The figure object containing the plot.

axsmatplotlib.axes.Axes

The axes object containing the plot.

classmethod read(grid_file, file_format=None)[source]

Read grid from file.

unique_grid_values(key)[source]

Return unique values of a key in the grid.

write(grid_file, file_format=None)[source]

Write grid to file.