API

petrofit.modeling Package

Functions

I0_to_Ie(I_0, n)

Converts the intensity at the 0 radius (I_0) to the Sersic intensity at the effective radius (I_e) based on the Sersic index (n).

Ie_to_I0(I_e, n)

Converts the sersic intensity at the effective radius (I_e) to the intensity at the 0 radius (I_0) based on the sersic index (n)

fit_background(image[, model, sigma, ...])

Fit sigma clipped background image using a user provided model.

fit_gaussian2d(image)

Fit a 2D gaussian to a source in an image.

fit_model(image, model[, weights, fitter, ...])

Wrapper function to conveniently fit an image to an input model.

get_default_gen_sersic_bounds([override])

Returns the default bounds of a Generalized Sersic profile.

get_default_sersic_bounds([override])

Returns the default bounds of the Sersic profile.

make_grid(size[, origin, factor])

Function to make image sampling grid.

measure_fwhm(image[, plot, printout])

Find the 2D FWHM of a background/continuum subtracted cutout image of a target.

model_to_image(model, size[, mode, factor, ...])

Converts 2D models into images using astropy.convolution.utils.discretize_model.

petrosian_profile(r, r_eff, n)

Ideal Sersic Petrosian profile evaluated at input radii.

plot_fit(model, image[, mode, center, vmin, ...])

Plot fitted model, its 1D fit profile and residuals.

print_model_params(model)

Print the params and values of an AstroPy model

sersic_enclosed(r, amplitude, r_eff, n[, ellip])

Total Sersic flux enclosed within a radius.

sersic_enclosed_inv(f, amplitude, r_eff, n)

Radius that would enclose the input flux.

Classes

GenSersic2D([c_0])

Two dimensional Sersic surface brightness profile with Generalized Ellipses described in Peng et al. 2010.

PSFConvolvedModel2D(model[, psf, ...])

Fittable model for converting FittableModel and CompoundModel into 2D images.

PetroApprox()

This class contains approximations of various Pertorisian and Sersic parameters.

petrofit.petrosian Package

Functions

calculate_concentration_index(fraction_1, ...)

Calculates Petrosian concentration index.

calculate_petrosian(area_list, flux_list[, ...])

Given a list of aperture areas and associated fluxes, and their errors, computes the petrosian curve and its 1-sigma errors.

calculate_petrosian_r(r_list, petrosian_list)

Calculate petrosian radius from photometric values using interpolation.

fraction_to_r(fraction, r_list, flux_list, ...)

Given photometric values and r_total_flux, calculate radius which encloses a specified fraction of the total flux.

generate_petrosian_sersic_correction(...[, ...])

Generate corrections for Petrosian profiles by simulating a galaxy image (single component sersic) and measuring its properties.

Classes

Petrosian(r_list, area_list, flux_list[, ...])

Class that computes and plots Petrosian properties.

PetrosianCorrection(grid[, enforce_range])

This class computes corrections for Petrosian given default Petrosian measurements.

petrofit.photometry Module

Functions

plot_apertures([image, apertures, vmin, ...])

Plot apertures on image

radial_elliptical_aperture(position, r[, ...])

Helper function given a radius, elongation and theta, will make an elliptical aperture.

radial_elliptical_annulus(position, r, dr[, ...])

Helper function given a radius, elongation and theta, will make an elliptical aperture.

radial_photometry(image, position, r_list[, ...])

Core photometry function.

petrofit.segmentation Module

Functions

plot_segments(segm[, image, vmin, vmax, ...])

Plot segmented areas over an image (2D array, if provided)

plot_segment_residual(segm, image[, vmin, vmax])

Plot segment subtracted image (residual)

get_source_position(source)

Return max x, y value of a SourceCatalog or catalog row

get_source_elong(source)

Return SourceCatalog elongation

get_source_ellip(source)

Return SourceCatalog ellipticity

get_source_theta(source)

Return SourceCatalog orientation in rad

get_amplitude_at_r(r, image, x0, y0, ellip, ...)

Finds the amplitude at an isophotal radius r.

order_cat(cat[, key, reverse])

Sort a catalog by largest area and return the argsort

segm_mask(source, segm[, mask_background])

Given a segmentation and a target with an label, returns a mask with all other sources masked in the original image.

masked_segm_image(source, image, segm[, ...])

Returns a masked image of the original image by masking out other sources

make_segments(image[, npixels, threshold])

Segment an image.

deblend_segments(image, segm[, npixels, ...])

Deblend overlapping sources labeled in a segmentation image.

make_catalog(image, threshold[, wcs, ...])

This function constructs a catalog using PhotUtils.

source_photometry(source, image, ...[, ...])

Aperture photometry on a PhotUtils SourceProperties.

petrofit.utils Module

Functions

match_catalogs(ra_1, dec_1, ra_2, dec_2[, unit])

Wrapper for SkyCoord.match_to_catalog_sky

angular_to_pixel(angular_diameter, wcs)

pixel_to_angular(pixel_size, wcs)

elliptical_area_to_r(area, elong)

circle_area_to_r(area)

get_interpolated_values(x, y[, num, kind])

closest_value_index(value, array[, growing])

Return first index closes to value

plot_target(image, position[, size, c, lw, ...])

Plot an image with a target marker.

cutout_subtract(image, target, x, y)

Subtract cutout from image

hst_flux_to_abmag(flux, header)

Convert HST flux to AB Mag

make_radius_list(max_pix, n[, log])

Make an array of radii of size n up to max_pix

natural_sort(l)

mpl_tick_frame([ax, minorticks, tick_fontsize])

ellip_to_elong(ellip)

elong_to_ellip(elong)