calculate_transform_coefficients#

stellarphot.utils.calculate_transform_coefficients(input_mag, catalog_mag, color, input_mag_error=None, catalog_mag_error=None, faintest_mag=None, order=1, sigma=2.0, gain=None)[source]#

Calculate linear transform coefficients from input magnitudes to catalog magnitudes.

Parameters:
input_magnumpy.ndarray or astropy.table.Column

Input magnitudes; for example, instrumental magnitudes.

catalog_magnumpy.ndarray or astropy.table.Column

Catalog (or reference) magnitudes; the magnitudes to which the input_mag will eventually be transformed.

colornumpy.ndarray or astropy.table.Column

Colors to use in determining transform coefficients.

input_mag_errornumpy.ndarray or astropy.table.Column, optional

Error in input magnitudes. Default is zero.

catalog_mag_errornumpy.ndarray or astropy.table.Column, optional

Error in catalog magnitudes. Default is zero.

faintest_mag_for_transformfloat, optional

If this is not None, the magnitude of the faintest catalog stars to use in computing transform coefficients.

orderint, optional

Order of the polynomial fit to use in correcting for color.

sigmafloat, optional

Value of sigma to use to reject outliers while fitting using sigma clipping.

gainfloat, optional

If not None, adjust the instrumental magnitude by -2.5 * log10(gain), i.e. gain correct the magnitude.

verbosebool, optional

If True, print some diagnostic information.

extended_outputbool, optional

If True, return additional information.

Returns:
filtered_datanumpy.ma.core.MaskedArray

The data, with the mask set True for the data that was omitted from the fit.

modelastropy.modeling.FittableModel

Entries in the model are the coefficients in the fit made to the data. Since the model is always a polynomial, these are terms in a polynomial in the order of ascending power. In other words, the coefficient ci is the coefficient of the term x**i.

If extended_output=True, then also return:
fit_inputtuple

A tuple of color, magnitude for only the stars brighter than faintest_mag_for_transform. These are input to the sigma-clipping fitter.

used_in_fittuple

A tuple of color, magnitude for only the stars brighter than faintest_mag_for_transform that were not sigma-cliped out.

Notes

This function has some pretty serious limitations right now:

  • Errors in the independent variable are ignored.

  • Outliers are rejected using a modified loss function (Huber loss) that cannot be modified.

  • No errors are estimated in the calculated transformation coefficients.

And there is all the stuff that is not listed here…