API

petrofit.correction Module

Functions

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

This function generates corrections for Petrosian radii by simulating a galaxy image and measuring its properties.

petrofit.modeling.fitting Module

Functions

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

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

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

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

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.

print_model_params(model)

Print the params and values of an AstroPy model

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

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

petrofit.modeling.models Module

Functions

get_default_sersic_bounds([override])

Returns the default bounds of the Sersic profile.

make_grid(size[, origin, factor])

Function to make image sampling grid.

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

sersic_enclosed_inv(f, amplitude, r_eff, n)

petrosian_profile(r, r_eff, n)

get_default_gen_sersic_bounds([override])

Classes

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

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

PetroApprox()

This class contains approximations of various Pertorisian and Sersic parameters.

GenSersic2D([c_0])

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

petrofit.petrosian Module

Functions

plot_petrosian(r_list, area_list, flux_list)

Given photometric values, plots petrosian profile.

calculate_petrosian(area_list, flux_list)

Given a list of aperture areas and associated fluxes, computes the petrosian curve.

calculate_petrosian_r(r_list, area_list, ...)

Calculate petrosian radius from photometric values using interpolation.

discrete_petrosian_r(r_list, area_list, ...)

Calculate petrosian radius from photometric values by using the nearest value petrosian to eta.

calculate_r_total_flux(r_list, area_list, ...)

Given photometric values, calculate Petrosian r_total_flux.

fraction_flux_to_r(r_list, flux_list, ...[, ...])

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

calculate_r_half_light(r_list, flux_list, ...)

Given photometric values, calculate Petrosian r_half_light.

calculate_concentration_index(r_list, ...[, ...])

Calculates Petrosian concentration index.

estimate_n(c2080pet[, verbose])

Classes

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

Class that computes and plots Petrosian properties.

PetrosianCorrection(grid_file)

This class computes corrections for Petrosian given default Petrosian measurements.

petrofit.photometry Module

Functions

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

Plot apertures on image

flux_to_abmag(flux, header)

Convert HST flux to AB Mag

order_cat(cat[, key, reverse])

Sort a catalog by largest area and return the argsort

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.

calculate_photometic_density(r_list, flux_list)

Compute value between radii

make_radius_list(max_pix, n[, log])

Make an array of radii of size n up to max_pix

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

Core photometry function.

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

Aperture photometry on a PhotUtils SourceProperties.

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.

make_kernel(fwhm, kernel_size)

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.

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(position, image, size[, vmin, vmax])

cutout_subtract(image, target, x, y)

Subtract cutout from image

measure_fwhm(image[, plot, printout])

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