def antenna_temp(self, tsys, sig, ref, t_sig, t_ref): ref_smoothed = smoothing.boxcar(ref, self.SMOOTHING_WINDOW) ref_smoothed = self.pu.masked_array(ref_smoothed) spectrum = tsys * ((sig-ref_smoothed)/ref_smoothed) exposure_time = (t_sig * t_ref * self.SMOOTHING_WINDOW / (t_sig + t_ref*self.SMOOTHING_WINDOW)) return spectrum, exposure_time
def antenna_temp(self, tsys, sig, ref, t_sig, t_ref): r"""Calibrate a spectrum to units of antenna temperature. Args: tsys(float): System temperature of the reference scan. sig(1d array): Signal ("on") spectrum. ref(1d array): Reference ("off") spectrum. t_sig(float): Exposure time of the signal spectrum. t_ref(float): Exposure time of the reference spectrum. Returns: 1d array or float: A calibrated spectrum with an exposure time. The spectrum is .. math:: tsys * \frac{sig - ref}{ref}. The exposure time is .. math:: \frac{t\_{sig} * t\_{ref} * window\_{size}}{t\_{sig} + (t\_{ref} * window\_{size})} where the window size is an optional smoothing kernel size for the reference spectrum. """ if self.SMOOTHING_WINDOW > 1: ref = smoothing.boxcar(ref, self.SMOOTHING_WINDOW) window_size = self.SMOOTHING_WINDOW else: window_size = 1 ref = self.pu.masked_array(ref) spectrum = tsys * ((sig - ref) / ref) exposure_time = (t_sig * t_ref * window_size / (t_sig + t_ref * window_size)) return spectrum, exposure_time
def antenna_temp(self, tsys, sig, ref, t_sig, t_ref): r"""Calibrate a spectrum to units of antenna temperature. Args: tsys(float): System temperature of the reference scan. sig(1d array): Signal ("on") spectrum. ref(1d array): Reference ("off") spectrum. t_sig(float): Exposure time of the signal spectrum. t_ref(float): Exposure time of the reference spectrum. Returns: 1d array or float: A calibrated spectrum with an exposure time. The spectrum is .. math:: tsys * \frac{sig - ref}{ref}. The exposure time is .. math:: \frac{t\_{sig} * t\_{ref} * window\_{size}}{t\_{sig} + (t\_{ref} * window\_{size})} where the window size is an optional smoothing kernel size for the reference spectrum. """ if self.SMOOTHING_WINDOW > 1: ref = smoothing.boxcar(ref, self.SMOOTHING_WINDOW) window_size = self.SMOOTHING_WINDOW else: window_size = 1 ref = self.pu.masked_array(ref) spectrum = tsys * ((sig-ref)/ref) exposure_time = (t_sig * t_ref * window_size / (t_sig + t_ref*window_size)) return spectrum, exposure_time