diff --git a/rubin_sim/maf/metrics/brown_dwarf_metric.py b/rubin_sim/maf/metrics/brown_dwarf_metric.py index bdf30259e..b652466c0 100644 --- a/rubin_sim/maf/metrics/brown_dwarf_metric.py +++ b/rubin_sim/maf/metrics/brown_dwarf_metric.py @@ -126,9 +126,7 @@ def run(self, data_slice, slice_point=None): self.mags[str(filt)][:, np.newaxis], data_slice[self.m5_col][good] ) - position_errors = np.sqrt( - mafUtils.astrom_precision(data_slice[self.seeing_col], snr) ** 2 + self.atm_err**2 - ) + position_errors = mafUtils.astrom_precision(data_slice[self.seeing_col], snr, self.atm_err) # uncertainty in the parallax in mas sigma = self._final_sigma(position_errors, data_slice["ra_pi_amp"], data_slice["dec_pi_amp"]) fitted_parallax_snr = self.parallaxes / sigma diff --git a/rubin_sim/maf/metrics/calibration_metrics.py b/rubin_sim/maf/metrics/calibration_metrics.py index 610756029..2ac1c20e9 100644 --- a/rubin_sim/maf/metrics/calibration_metrics.py +++ b/rubin_sim/maf/metrics/calibration_metrics.py @@ -240,9 +240,8 @@ def run(self, data_slice, slice_point=None): else: snr = mafUtils.m52snr(self.mags[f], data_slice[self.m5_col][observations]) precis[observations] = mafUtils.astrom_precision( - data_slice[self.seeing_col][observations], snr + data_slice[self.seeing_col][observations], snr, self.atm_err ) - precis[observations] = np.sqrt(precis[observations] ** 2 + self.atm_err**2) good = np.where(precis != self.badval) result = mafUtils.sigma_slope(data_slice[self.mjd_col][good], precis[good]) result = result * 365.25 * 1e3 # Convert to mas/yr @@ -364,9 +363,7 @@ def _theta_check(self, ra_pi_amp, dec_pi_amp, snr): def _compute_weights(self, data_slice, snr): # Compute centroid uncertainty in each visit - position_errors = np.sqrt( - mafUtils.astrom_precision(data_slice[self.seeing_col], snr) ** 2 + self.atm_err**2 - ) + position_errors = mafUtils.astrom_precision(data_slice[self.seeing_col], snr, self.atm_err) weights = 1.0 / position_errors**2 return weights @@ -493,9 +490,7 @@ def run(self, data_slice, slice_point=None): # Compute the centroiding uncertainties # Note that these centroiding uncertainties depend on the physical size of the PSF, thus # we are using seeingFwhmGeom for these metrics, not seeingFwhmEff. - position_errors = np.sqrt( - mafUtils.astrom_precision(data_slice[self.seeing_col], snr) ** 2 + self.atm_err**2 - ) + position_errors = mafUtils.astrom_precision(data_slice[self.seeing_col], snr, self.atm_err) # Construct the vectors of RA/Dec offsets. xdata is the "input data". ydata is the "output". xdata = np.empty((2, data_slice.size * 2), dtype=float) xdata[0, :] = np.concatenate((data_slice["ra_pi_amp"], data_slice["dec_pi_amp"])) diff --git a/rubin_sim/maf/utils/astrometry_utils.py b/rubin_sim/maf/utils/astrometry_utils.py index a00d940b8..bc281fb8a 100644 --- a/rubin_sim/maf/utils/astrometry_utils.py +++ b/rubin_sim/maf/utils/astrometry_utils.py @@ -32,7 +32,7 @@ def sigma_slope(x, sigma_y): return result -def m52snr(m, m5): +def m52snr(m, m5, gamma=0.039): """ Calculate the SNR for a star of magnitude m in an observation with 5-sigma limiting magnitude depth m5. @@ -52,14 +52,13 @@ def m52snr(m, m5): snr : `float` or `np.ndarray` (N,) The SNR """ - # gamma varies per band, but is fairly close to this value - rgamma = 0.039 + # gamma varies per band, but is fairly close to 0.039 or 0.04 xval = np.power(10, 0.4 * (m - m5)) - snr = 1 / np.sqrt((0.04 - rgamma) * xval + rgamma * xval * xval) + snr = 1 / np.sqrt((0.04 - gamma) * xval + gamma * xval * xval) return snr -def astrom_precision(fwhm, snr, systematic_floor=0.01): +def astrom_precision(fwhm, snr, systematic_floor=0.00): """ Calculate the approximate precision of astrometric measurements, given a particular seeing and SNR value. @@ -71,12 +70,14 @@ def astrom_precision(fwhm, snr, systematic_floor=0.01): snr : float` or `np.ndarray` (N,) The SNR of the object. systematic_floor : `float` - Systematic noise floor for astrometric error. + Systematic noise floor for astrometric error, in arcseconds. + Default here is 0, for backwards compatibility. + General Rubin use should be 0.01. Returns ------- - astrp,+err " `float` or `numpy.ndarray` (N,) - The astrometric precision. + astrom_err : `float` or `numpy.ndarray` (N,) + The astrometric precision, in arcseconds. """ astrom_err = np.sqrt((fwhm / snr) ** 2 + systematic_floor**2) return astrom_err