mirar.processors.photcal.zp_calculator package
Module to calculate zero point using outlier rejection
Submodules
mirar.processors.photcal.zp_calculator.base_zp_calculator module
Module for calculating zero points
- class mirar.processors.photcal.zp_calculator.base_zp_calculator.BaseZeroPointCalculator[source]
Bases:
objectBase class for actually calculating zero point calculators
- calculate_zeropoint(image: Image, matched_ref_cat: Table, matched_img_cat: Table, colnames: list[str]) Image[source]
Function to calculate zero point from two catalogs and add the zeropoint information to the image header Args:
matched_ref_cat: Reference catalog table matched_img_cat: Catalog of sources image: Image object colnames: List of column names from the image catalog to use for calculating zero point. The reference catalog is assumed to have the “magnitude” column, as it comes from mirar.catalog.base_catalog.BaseCatalog
- Returns:
Image object with zero point information added to the header.
mirar.processors.photcal.zp_calculator.color_term_zp_calculator module
Module to calculate zero point by including a color term.
- class mirar.processors.photcal.zp_calculator.color_term_zp_calculator.ZPWithColorTermCalculator(color_colnames_guess_generator: Callable[[Image], tuple[tuple[str, str], tuple[str, str], tuple[float, float]]], reject_outliers: bool = True, num_stars_threshold: int = 5, solver: str = 'odr')[source]
Bases:
BaseZeroPointCalculatorClass to calculate zero point by including a color term. This models the data as
ref_mag - img_mag = ZP + C * (ref_color).
Note: This processor can solve using either scipy.curve_fit or scipy.odr. scipy.odr is the default solver, and uses errors in both ref_color and ref_mag to fit the color term. scipy.curve_fit only uses errors in ref_mag to fit the color term. In both cases, the processor will remove any data points that are masked (missing entries) in the reference catalog. Additionally, scipy.odr requires all data points to have nonzero (x and y) error. The processor will removes those points, but it is up to the user to also consider removing these points from their reference catalogs to begin with (0 error in magnitude indicates unreliable photometry in PanStarrs, for example).
- Attributes:
- param color_colnames_guess_generator:
function that takes an image as input and
returns three tuples. The first two tuples contain two strings each that are the column names of the reference catalog magnitudes and magnitude errors to use for the color term. The first string is the bluer band, the second is the redder band. The third tuple returns a first guess at the color and zero-point values. :param reject_outliers: whether to reject outliers when fitting the color term. :param num_stars_threshold: minimum number of stars to fit the color term. :param solver: solver to use for fitting the color term. Must be ‘odr’ or ‘curve_fit’. Defaults to ‘odr’.
- calculate_zeropoint(image: Image, matched_ref_cat: Table, matched_img_cat: Table, colnames: list[str]) Image[source]
Function to calculate zero point from two catalogs and add the zeropoint information to the image header Args:
matched_ref_cat: Reference catalog table matched_img_cat: Catalog of sources image: Image object colnames: List of column names from the image catalog to use for calculating zero point. The reference catalog is assumed to have the “magnitude” column, as it comes from mirar.catalog.base_catalog.BaseCatalog
- Returns:
Image object with zero point information added to the header.
- mirar.processors.photcal.zp_calculator.color_term_zp_calculator.line_func_curve_fit(data: ndarray, slope: float, intercept: float) ndarray[source]
linear model to hand to scipy curve_fit
- mirar.processors.photcal.zp_calculator.color_term_zp_calculator.line_func_odr(theta: (<class 'float'>, <class 'float'>), x: ~numpy.ndarray) ndarray[source]
linear model to hand to scipy.odr Args:
theta: slope and intercept of line to fit to data x: x data (color in our context)
Returns:
- mirar.processors.photcal.zp_calculator.color_term_zp_calculator.solve_curve_fit(x: ndarray, y: ndarray, _, y_err: ndarray, firstguess_color_zp: tuple) tuple[ndarray, ndarray][source]
Solve for the zero point and color term using scipy.curve_fit. :param x: color :param y: ref_mag - img_mag :param y_err: uncertainty in ref_mag - img_mag :param firstguess_color_zp: first guess at the color and zero-point values :return: best-fit color and zero-point values, and their uncertainties
- mirar.processors.photcal.zp_calculator.color_term_zp_calculator.solve_odr(x: ndarray, y: ndarray, x_err: ndarray, y_err: ndarray, firstguess_color_zp: tuple) tuple[ndarray, ndarray][source]
Solve for the zero point and color term using scipy.odr. :param x: color :param y: ref_mag - img_mag :param x_err: uncertainty in color :param y_err: uncertainty in ref_mag - img_mag :param firstguess_color_zp: first guess at the color and zero-point values :return: best fit color and zero-point values, and their uncertainties
mirar.processors.photcal.zp_calculator.outlier_rejection_zp_calculator module
Module to calculate zero point using outlier rejection
- class mirar.processors.photcal.zp_calculator.outlier_rejection_zp_calculator.OutlierRejectionZPCalculator(num_stars_threshold: int = 5, outlier_rejection_threshold: float | list[float] = 3.0)[source]
Bases:
BaseZeroPointCalculatorClass to calculate zero point using outlier rejection Attributes:
num_stars_threshold: int to use as minimum number of stars outlier_rejection_threshold: float or list of floats to use as number of sigmas
- calculate_zeropoint(image: Image, matched_ref_cat: Table, matched_img_cat: Table, colnames: list[str]) Image[source]
Function to calculate zero point from two catalogs and add the zeropoint information to the image header Args:
matched_ref_cat: Reference catalog table matched_img_cat: Catalog of sources image: Image object colnames: List of column names from the image catalog to use for calculating zero point. The reference catalog is assumed to have the “magnitude” column, as it comes from mirar.catalog.base_catalog.BaseCatalog
- Returns:
Image object with zero point information added to the header.