rss_ringoccs.calibration.calibration_class module

Purpose:Class framework for performing the necessary calibration steps for the RSR data. This includes phase correction based on frequency offset of the spacecraft and normalization of received power with respect to the intrinsic spacecraft power.
Notes:Can be computationally cumbersome, especially for chord occultations. May require up to 30 mins for 16 kHz RSR data files.
Dependencies:
  1. numpy
  2. scipy
  3. sys
class rss_ringoccs.calibration.calibration_class.Calibration(rsr_inst, geo_inst, pnf_order=3, dt_cal=1.0, verbose=False, write_file=True, interact=False)

Bases: object

Purpose:Define a class which, when instantiated, calls the submodules for performing each step of the calibration process by instantiating the classes FreqOffsetFit in the freq_offset_fit.py script and Normalization in the power_normalization.py script.
Arguments
rsr_inst (object):
 Instance of the RSRReader class
geo_inst (object):
 Instance of the Geometry class
Keyword Arguments
pnf_order (float):
 whole number specifying the polynomial order to use when fitting the freespace power. Default is 3.
dt_cal (float):Desired final spacing in SPM between data points. Default is 1 sec.
verbose (bool):If True, print intermediate steps and results. Default is False.
write_file (bool):
 If True, write output CAL .TAB and CAL .LBL files. Default is True.
interact (bool):
 If True, enables the interactive mode in the terminal for fitting the freespace power. Default is False.
Attributes
rev_info (dict):
 dict of information identifying the specific occultation: rsrfile, year, day of year, direction and type of occultation, spacecraft revolution number, and observation band
t_oet_spm_vals (np.ndarray):
 SPM values for observed event time t
f_sky_hz_vals (np.ndarray):
 sum of the reconstructed sky frequency values and the fit to frequency offset \hat{f}(t)_{sky}=f_{dr}(t)
+\hat{f}(t)_{offset} following Equation 19 in [CRSUG2018].
f_offset_fit_vals (np.ndarray):
 fit to frequency offset \hat{f}(t)_{offset}
p_free_vals (np.ndarray):
 fit to freespace power \hat{P}_0(t)
IQ_c (np.ndarray):
 phase-corrected spacecraft signal I_{c}+iQ_{c}
history (dict):information about the parameters, results, and computation of the calibration procedures
FORFIT_chi_squared (float):
 sum of the squared residual frequency offset fit such that \chi^2 = \frac{1}{N-m}
\sum((\hat{f}(t)_{offset}-f(t)_{offset})
/\hat{f}(t)_{offset})^2
FSPFIT_chi_squared (float):
 \chi^2 = \frac{1}{N-m}\sum
((\hat{P}_0(t)-P_0(t))/\hat{P}_0(t))^2
correct_IQ(spm_vals, IQ_m, f_spm, f_offset_fit)

Purpose:

Apply frequency offset fit to raw measured signal using the signal frequencies calculated by FreqOffsetFit. First resamples the frequency offset fit to a 0.1 sec separation. Then, computes detrending function by integrating frequency offset fit to get phase detrending function \psi using Equation 18 from [CRSUG2018] where

\psi = \int^{t}\hat{f}(\tau)_{offset}
\mathrm{d}\tau+\psi(t_0)

Finally, applies phase detrending correction to signal to raw signal such that

I_{c}+iQ_{c} = [I_{m}+iQ_{m}] \exp(-i\psi)

as discussed in [CRSUG2018] (see their Equation 17).

Arguments:
spm_vals (np.ndarray):
 raw SPM values
IQ_m (np.ndarray):
 raw complex signal measured by DSN
f_spm (np.ndarray):
 SPM sampled for frequency offset calculation in the calc_freq_offset class in the calc_freq_offset.py script.
f_offset_fit (np.ndarray):
 frequency of the spacecraft signal corresponding to f_spm
Returns:
IQ_c (np.ndarray):
 Frequency-corrected complex signal I_{c}+iQ_{c} corresponding to spm_vals