PolnCalibrator with estimated calibrator Stokes parameters. More...

#include <SystemCalibrator.h>

Inheritance diagram for Pulsar::SystemCalibrator:
Pulsar::PolnCalibrator Pulsar::Calibrator Reference::Able Reference::HeapTracked Pulsar::PulsarCalibrator Pulsar::ReceptionCalibrator

Classes

class  Unloader
 Unloads Pulsar::SystemCalibrator solution to file. More...
 

Public Types

typedef Calibration::ReceptionModel::Solver Solver
 

Public Member Functions

 SystemCalibrator (Archive *archive=0)
 Construct with optional processed calibrator Archive. More...
 
 SystemCalibrator (const SystemCalibrator &)
 Copy constructor.
 
virtual ~SystemCalibrator ()
 Destructor.
 
Calibrator::Infoget_Info () const
 Return the Calibrator information.
 
MJD get_epoch () const
 Return the reference epoch of the calibration experiment.
 
unsigned get_nchan () const
 Get the number of frequency channels.
 
unsigned get_ndata (unsigned ichan) const
 Get the number of data points in the given frequency channel.
 
virtual unsigned get_nstate () const
 Get the total number of input polarization states (pulsar and cal) More...
 
virtual unsigned get_nstate_pulsar () const
 Get the number of pulsar polarization states in the model.
 
virtual unsigned get_state_is_pulsar (unsigned istate) const
 Return true if the state index is a pulsar.
 
virtual bool has_cal () const
 Return true if calibrator (e.g. noise diode) data are incorporated.
 
virtual Calibrator::Infonew_info_pulsar (unsigned istate) const
 Return a new plot information interface for the specified pulsar state. More...
 
void set_refcal_through_frontend (bool flag=true)
 True if noise diode illuminates feed; false if coupled after OMT.
 
void set_flux_calibrator (const FluxCalibrator *fluxcal)
 Set the flux calibrator solution used to estimate calibrator Stokes.
 
void set_calibrators (const std::vector< std::string > &filenames)
 Set the calibrator observations to be loaded after first pulsar.
 
void set_calibrator_preprocessor (Processor *)
 Set the calibrator preprocessor.
 
virtual void set_calibrator (const Archive *)
 Set the calibrator.
 
virtual void set_response (MEAL::Complex2 *)
 Set the response (pure Jones) transformation.
 
void set_previous_solution (const PolnCalibrator *)
 Set the response to a previous solution (for the first guess)
 
void set_response_fixed (const std::vector< unsigned > &)
 Set the response parameters to be held fixed.
 
virtual void set_response_variation (unsigned iparam, MEAL::Univariate< MEAL::Scalar > *)
 Set the temporal variation function of a specified response parameter.
 
virtual void set_impurity (MEAL::Real4 *)
 Set the impurity transformation.
 
virtual void set_projection (VariableTransformation *)
 Set the projection transformation.
 
virtual void set_ionospheric_rotation_measure (double rm)
 Set the ionospheric rotation measure applied to all observations.
 
virtual void set_gain (MEAL::Univariate< MEAL::Scalar > *)
 Set the time variation of absolute gain.
 
virtual void set_diff_gain (MEAL::Univariate< MEAL::Scalar > *)
 Set the time variation of differential gain.
 
virtual void set_diff_phase (MEAL::Univariate< MEAL::Scalar > *)
 Set the time variation of differential phase.
 
virtual void add_gain_step (const MJD &)
 Add a step to the gain variations.
 
virtual void add_diff_gain_step (const MJD &)
 Add a step to the differential gain variations.
 
virtual void add_diff_phase_step (const MJD &)
 Add a step to the differential phase variations.
 
virtual void add_step (const MJD &, Calibration::VariableBackend *)
 Add a VariableBackend step at the specified MJD.
 
void set_step_after_cal (bool val=true)
 Apply time steps afer cals.
 
bool get_step_after_cal () const
 
virtual void set_foreach_calibrator (const MEAL::Complex2 *)
 Prepare the data for inclusion in the model Set the transformation to be cloned for each calibrator.
 
virtual void set_stepeach_calibrator (const Calibration::VariableBackend *)
 Set the VariableBackend step to be cloned for each calibrator.
 
virtual void preprocess (Archive *data)
 Prepare the data for inclusion in the model.
 
virtual void add_observation (const Archive *data)
 Add the observation to the set of constraints.
 
virtual void set_normalize_by_invariant (bool flag=true)
 Normalize each pulsar Stokes vector by the mean on-pulse invariant.
 
virtual void add_pulsar (const Archive *data)
 Add the pulsar observation to the set of constraints. More...
 
virtual void add_calibrator (const Archive *data)
 Add the calibrator observation to the set of constraints. More...
 
virtual void add_calibrator (const ReferenceCalibrator *polncal)
 Add the ReferenceCalibrator observation to the set of constraints.
 
virtual bool calibrator_match (const Archive *, std::string &reason_for_not_matching)
 Return true if this calibrator can be applied to the data.
 
virtual void add_epoch (const MJD &epoch)
 Add an observational epoch.
 
MJD get_start_epoch () const
 Get the epoch of the first observation.
 
MJD get_end_epoch () const
 Get the epoch of the last observation.
 
virtual void set_nthread (unsigned nthread)
 Set the number of channels that may be simultaneously solved.
 
virtual void set_equation_configuration (const std::vector< std::string > &)
 Set the measurement equation configuration options.
 
virtual bool has_solver () const
 Return true if least squares minimization solvers are available.
 
virtual const Solverget_solver (unsigned ichan) const
 Return the solver for the specified channel. More...
 
virtual void set_solver (Solver *)
 Set the algorithm used to solve the measurement equation.
 
virtual Solverget_solver ()
 Get the algorithm used to solve the measurement equation.
 
virtual void set_retry_reduced_chisq (float)
 Set the reduced chisq above which the solution will be retried.
 
virtual void set_invalid_reduced_chisq (float)
 Set the reduced chisq above which a solution will be flagged invalid.
 
virtual void set_report_projection (bool)
 Report on the projection correction used in add_pulsar method.
 
virtual void set_report_initial_state (bool flag=true)
 Report on the initial state of the model before fitting.
 
virtual void set_report_input_data (bool flag=true)
 Report on the data included as constraints before fitting.
 
virtual void set_report_input_failed (bool flag=true)
 Report on the number of failed attempts to add data.
 
void set_cal_outlier_threshold (float f)
 Set the threshold used to reject outliers when computing CAL levels.
 
float get_cal_outlier_threshold () const
 Get the threshold used to reject outliers when computing CAL levels.
 
void set_cal_intensity_threshold (float f)
 Set the threshold used to reject CAL observations with no signal.
 
float get_cal_intensity_threshold () const
 Get the threshold used to reject CAL observations with no signal.
 
void set_cal_polarization_threshold (float f)
 Set the minimum degree of polarization of CAL observations.
 
float get_cal_polarization_threshold () const
 Get the minimum degree of polarization of CAL observations.
 
void set_step_finder (StepFinder *)
 Set the algorithm used to automatically insert steps in response.
 
StepFinder * get_step_finder ()
 Get the algorithm used to automatically insert steps in response.
 
virtual void solve ()
 Solve equation for each frequency.
 
virtual void reset ()
 Reset the response in each frequency to its initial value.
 
virtual bool get_solved () const
 Get the status of the model.
 
virtual bool has_valid () const
 Returns true if at least one channel returns get_valid == true.
 
float get_reduced_chisq (unsigned ichan) const
 Get the reduced chisq of the best fit in the specified channel.
 
virtual void precalibrate (Archive *archive)
 Pre-calibrate the polarization of the given archive. More...
 
virtual MEAL::Complex2get_transformation (const Archive *data, unsigned isub, unsigned ichan)
 Return the transformation to be used for precalibration.
 
virtual Archivenew_solution (const std::string &archive_class) const
 Return a Calibrator::new_solution with a CalibratorStokesExtension.
 
virtual const CalibratorStokesget_CalibratorStokes () const
 Return the CalibratorStokesExtension.
 
virtual const Calibration::SignalPath * get_model (unsigned ichan) const
 Return the SignalPath for the specified channel.
 
- Public Member Functions inherited from Pulsar::PolnCalibrator
 PolnCalibrator (const Archive *archive=0)
 Construct with optional processed calibrator Archive. More...
 
 PolnCalibrator (const PolnCalibrator &calibrator)
 Copy constructor.
 
virtual ~PolnCalibrator ()
 Destructor.
 
void set_subint (const Index &isub)
 Set the sub-integration index.
 
virtual void set_response_nchan (unsigned nchan)
 Set the number of frequency channels in the response array.
 
virtual unsigned get_response_nchan () const
 Get the number of frequency channels in the response array.
 
virtual Jones< float > get_response (unsigned ichan) const
 Return the system response for the specified channel.
 
bool has_Receiver () const
 Return true if the Receiver is set.
 
const Receiverget_Receiver () const
 Return the Receiver.
 
void set_Receiver (const Archive *)
 Set the Receiver extension to that of the input Archive.
 
std::string get_receiver_basis_filename () const
 
void transformation_resize (unsigned nchan)
 
bool get_transformation_valid (unsigned ch) const
 Return true if the transformation for the specified channel is valid. More...
 
void set_transformation_invalid (unsigned ch, const std::string &reason)
 Set the transformation invalid flag for the specified channel. More...
 
const std::string & get_transformation_invalid_reason (unsigned ichan) const
 Get the reason that the transformation in the specified channel is invalid.
 
const MEAL::Complex2get_transformation (unsigned ichan) const
 Return the transformation for the specified channel. More...
 
MEAL::Complex2get_transformation (unsigned ichan)
 Return the transformation for the specified channel. More...
 
void set_transformation (unsigned ichan, MEAL::Complex2 *)
 Set the transformation for the secified channel.
 
bool has_covariance () const
 Return true if parameter covariances are stored.
 
void get_covariance (unsigned ichan, std::vector< double > &) const
 Return the covariance matrix vector for the specified channel.
 
MEAL::LeastSquaresget_solver (unsigned ichan)
 
void set_backend_correction (bool f)
 Perform backend corrections before inverting response.
 
virtual void calibrate (Archive *archive)
 Calibrate the polarization of the given archive. More...
 
virtual const Typeget_type () const
 Return the Calibrator::Type of derived class.
 
unsigned get_nchan (bool build_if_needed) const
 Get the number of frequency channels in the calibrator.
 
CalibratorExtensionnew_Extension () const
 Return a new PolnCalibratorExtension.
 
void calibration_setup (const Archive *arch)
 Set up done before calibrating an archive.
 
- Public Member Functions inherited from Pulsar::Calibrator
 Calibrator ()
 Default constructor.
 
virtual ~Calibrator ()
 Destructor.
 
Archivenew_solution (const std::string &archive_class) const
 Return a new processed calibrator Archive with a CalibratorExtension.
 
virtual std::string get_filenames () const
 Return a string containing the file information.
 
const Archiveget_Archive () const
 Return a const reference to the calibrator archive.
 
template<class T >
bool is_a () const
 
- Public Member Functions inherited from Reference::Able
 Able (const Able &)
 
Ableoperator= (const Able &)
 
unsigned get_reference_count () const
 
- Public Member Functions inherited from Reference::HeapTracked
 HeapTracked (const HeapTracked &)
 
HeapTrackedoperator= (const HeapTracked &)
 
bool __is_on_heap () const
 

Protected Types

typedef MEAL::Univariate< MEAL::ScalarUniScalar
 

Protected Member Functions

virtual void prepare (const Archive *data)
 Prepare the model.
 
virtual void calculate_transformation ()
 Initialize the PolnCalibration::transformation attribute. More...
 
void create_model ()
 Create the model array.
 
virtual void init_model (unsigned ichan)
 Initialize the SignalPath of the specified channel.
 
virtual void init_estimates (std::vector< Calibration::SourceEstimate > &, unsigned ibin=0)
 Initialize a vector of SourceEstimate instances.
 
virtual void print_input_failed (const std::vector< Calibration::SourceEstimate > &)
 Report on input data failure rates.
 
virtual void close_input_failed ()
 
virtual void prepare_calibrator_estimate (Signal::Source)
 Prepare any calibrator estimates.
 
virtual void create_calibrator_estimate ()
 Create the calibrator estimate.
 
virtual void submit_calibrator_data ()
 
virtual void submit_calibrator_data (Calibration::CoherencyMeasurementSet &, const Calibration::SourceObservation &)
 
virtual void integrate_calibrator_data (const Calibration::SourceObservation &)
 
virtual void integrate_calibrator_solution (const Calibration::SourceObservation &)
 
virtual void load_calibrators ()
 Load any postponed calibrators and those set by set_calibrators.
 
virtual void match (const Archive *)
 Ensure that the pulsar observation can be added to the data set. More...
 
virtual void add_pulsar (const Archive *data, unsigned isub)
 Add the data from the specified sub-integration. More...
 
virtual void add_pulsar (Calibration::CoherencyMeasurementSet &, const Integration *, unsigned ichan)=0
 Add pulsar data constraints to coherency measurement set. More...
 
virtual void integrate_pulsar_data (const Calibration::CoherencyMeasurementSet &)
 add pulsar data to mean estimate used as initial guess
 
virtual void submit_pulsar_data ()
 add all pulsar data constraints to measurement equation
 
virtual void submit_pulsar_data (Calibration::CoherencyMeasurementSet &)
 add the given pulsar observations to measurement equation constraints
 
virtual void solve_prepare ()
 Prepare the measurement equations for fitting.
 
void configure (MEAL::Function *equation)
 Configure a measurement equation.
 
virtual void export_prepare () const =0
 Prepare to export the solution in current state; e.g. for plotting.
 
bool get_prepared () const
 Get the state of the prepared flag.
 
Solverget_solver (unsigned ichan)
 Return the transformation for the specified channel.
 
void resolve (unsigned ichan)
 Solve the specified channel after copying a good solution from another.
 
void check_ichan (const char *name, unsigned ichan) const
 ensure that ichan < model.size()
 
- Protected Member Functions inherited from Pulsar::PolnCalibrator
void setup_transformation () const
 Set up to call calculate_transformation.
 
virtual bool get_valid (unsigned ichan) const
 Derived classes can add conditions for channel validity. More...
 
float get_weight (unsigned ichan) const
 Return the weight (0 or 1) of the specified channel.
 
virtual unsigned get_maximum_nchan () const
 Derived classes may be able to shrink the transformation array. More...
 
- Protected Member Functions inherited from Pulsar::Calibrator
void copy_variation (Calibrator *)
 
void set_variation (Variation *var)
 
const Archiveget_calibrator () const
 Provide derived classes with access to the calibrator. More...
 
Archiveget_calibrator ()
 Provide derived classes with mutable access to the calibrator.
 
bool has_calibrator () const
 Return true if the calibrator attribute has been set. More...
 
- Protected Member Functions inherited from Reference::Able
Handle__reference (bool active) const
 
void __dereference (bool auto_delete=true) const
 

Protected Attributes

Reference::Vector< Calibration::SignalPath > model
 The standard calibration model as a function of frequency.
 
std::vector< std::string > equation_configuration
 Meausrement equation configuration options.
 
Reference::To< Solversolver
 The algorithm used to solve the measurement equation.
 
Reference::To< const FluxCalibratorflux_calibrator
 The FluxCalibrator solution.
 
Reference::To< VariableTransformationprojection
 The projection transformation (overrides ProjectionCorrection)
 
double ionospheric_rotation_measure
 The ionospheric rotation measure applied to all observations.
 
Reference::To< const CalibratorStokescalibrator_stokes
 The CalibratorStokesExtension of the Archive passed during construction.
 
Reference::To< MEAL::Complex2response
 Response transformation.
 
std::vector< unsigned > response_fixed
 Indeces of response parameters to be held fixed.
 
Reference::To< MEAL::Real4impurity
 Impurity transformation.
 
std::map< unsigned, Reference::To< UniScalar > > response_variation
 Temporal variation of response parameters.
 
Reference::To< UniScalargain_variation
 Time variation of absolute gain.
 
Reference::To< UniScalardiff_gain_variation
 Time variation of differential gain.
 
Reference::To< UniScalardiff_phase_variation
 Time variation of differential phase.
 
std::vector< MJDgain_steps
 
std::vector< MJDdiff_gain_steps
 
std::vector< MJDdiff_phase_steps
 
Reference::To< const MEAL::Complex2foreach_calibrator
 Transformation cloned for each calibrator observation.
 
Reference::To< const Calibration::VariableBackendstepeach_calibrator
 Step in backend response at each calibrator observation.
 
std::vector< std::ofstream * > input_failed
 
bool data_submitted
 Flag set when data have been integrated with measurement equation.
 
std::vector< std::vector< Calibration::SourceObservation > > calibrator_data
 Calibrator data loaded but not submitted or integrated.
 
Reference::To< StepFinder > step_finder
 
std::vector< std::vector< Calibration::CoherencyMeasurementSet > > pulsar_data
 Pulsar data loaded but not submitted or integrated.
 
std::vector< std::string > calibrator_filenames
 The calibrators to be loaded after first pulsar observation.
 
Reference::To< Processorcalibrator_preprocessor
 The calibrator pre-processor.
 
std::vector< Calibration::SourceEstimatecalibrator_estimate
 Uncalibrated estimate of calibrator polarization.
 
MJD start_epoch
 Epoch of the first observation.
 
MJD end_epoch
 Epoch of the last observation.
 
bool step_after_cal
 Apply time step after rather than before cals.
 
bool normalize_by_invariant
 Normalize pulsar Stokes parameters by the invariant interval.
 
bool solve_in_reverse_channel_order
 Solve measurement equations in reverse channel order.
 
bool correct_interstellar_Faraday_rotation
 Include a correction for Faraday rotation in the ISM.
 
bool refcal_through_frontend
 True if noise diode illuminates feed; false if coupled after OMT.
 
bool set_initial_guess
 Set the initial guess in solve_prepare.
 
bool guess_physical_calibrator_stokes
 Ensure that first guess of calibrator Stokes parameters is physical.
 
float retry_chisq
 The maximum reduced chisq before another fit will be attempted.
 
float invalid_chisq
 The maximum reduced chisq before a fit will be flagged invalid.
 
bool report_projection
 Report on the projection transformation used in add_pulsar.
 
bool report_initial_state
 Report the initial state of model before fitting.
 
bool report_input_data
 Report on the data included as constraints.
 
bool report_input_failed
 Report the number of input failures.
 
double cal_outlier_threshold
 Threshold used to reject outliers when computing CAL levels.
 
double cal_intensity_threshold
 Threshold used to reject CAL observations with no signal.
 
double cal_polarization_threshold
 Minimum degree of polarization of CAL observations.
 
BatchQueue queue
 Controls the number of channels that may be simultaneously solved.
 
unsigned get_data_fail
 
unsigned get_data_call
 
Reference::To< const PolnCalibratorprevious
 A previous solution, if availabe.
 
Reference::To< const CalibratorStokesprevious_cal
 
bool has_pulsar
 Flag set after the first pulsar observation is added.
 
- Protected Attributes inherited from Pulsar::PolnCalibrator
std::vector< std::vector< double > > covariance
 The array of covariance matrix vectors.
 
std::vector< Jones< float > > response
 The array of Jones matrices derived from the transformation array.
 
Reference::To< const PolnCalibratorExtensionpoln_extension
 The PolnCalibratorExtension of the Archive passed during construction.
 
Reference::To< const FeedExtensionfeed
 The FeedExtension of the Archive passed during construction.
 
bool built
 Flag set when response has been built.
 
unsigned observation_nchan
 The number of frequency channels in the observation to be calibrated.
 
bool do_backend_correction
 Perform backend corrections before inverting.
 
Index subint
 The sub-integration from which to construct a solution.
 
- Protected Attributes inherited from Pulsar::Calibrator
Reference::To< Typetype
 The type of the Calibrator.
 
Reference::To< Variationvariation
 Updates model parameters.
 
Reference::To< const CalibratorExtensionextension
 The CalibratorExtension of the Archive passed during construction.
 
std::vector< std::string > filenames
 Filenames of Pulsar::Archives from which instance was created.
 

Friends

class SystemCalibratorPlotter
 
class MatrixTemplateMatching
 

Additional Inherited Members

- Static Public Member Functions inherited from Pulsar::Calibrator
static unsigned get_instance_count ()
 Returns the number of Calibrator instances currently in existence.
 
- Static Public Member Functions inherited from Reference::Able
static size_t get_instance_count ()
 
- Static Public Member Functions inherited from Reference::HeapTracked
static void * operator new (size_t size, void *ptr=0)
 
static void operator delete (void *location, void *ptr)
 
static void operator delete (void *location)
 
static size_t get_heap_queue_size ()
 
- Static Public Attributes inherited from Pulsar::PolnCalibrator
static Option< double > minimum_determinant
 Minimum allowable determinant of Jones matrices. More...
 
- Static Public Attributes inherited from Pulsar::Calibrator
static unsigned verbose = 0
 Verbosity level.
 
static Pulsar::Option< float > median_smoothing
 Fractional bandwidth of the window used in median filter.
 
static Pulsar::Option< float > interpolating
 Fractional bandwidth over which interpolation will be performed.
 
static Pulsar::Option< float > det_threshold
 Tolerance to non-physical values of the coherency matrix.
 

Detailed Description

PolnCalibrator with estimated calibrator Stokes parameters.

The SystemCalibrator is the virtual base class of polarization calibrators that determine both the instrumental response and the input Stokes parameters of the reference signal.

Constructor & Destructor Documentation

◆ SystemCalibrator()

SystemCalibrator::SystemCalibrator ( Archive archive = 0)

Construct with optional processed calibrator Archive.

If a Archive is provided, and if it contains a SystemCalibratorExtension, then the constructed instance can be used to calibrate other Archive instances.

Member Function Documentation

◆ add_calibrator()

void SystemCalibrator::add_calibrator ( const Archive data)
virtual

Add the calibrator observation to the set of constraints.

Add the specified pulsar observation to the set of constraints.

Reimplemented in Pulsar::ReceptionCalibrator.

References Pulsar::Archive::get_filename().

◆ add_pulsar() [1/3]

virtual void Pulsar::SystemCalibrator::add_pulsar ( Calibration::CoherencyMeasurementSet ,
const Integration ,
unsigned  ichan 
)
protectedpure virtual

Add pulsar data constraints to coherency measurement set.

Derived types must define how pulsar data are incorporated

Implemented in Pulsar::ReceptionCalibrator, and Pulsar::PulsarCalibrator.

◆ add_pulsar() [2/3]

void SystemCalibrator::add_pulsar ( const Archive data)
virtual

Add the pulsar observation to the set of constraints.

Add the specified pulsar observation to the set of constraints.

References Pulsar::Archive::get_nchan(), and Pulsar::IntegrationManager::get_nsubint().

◆ add_pulsar() [3/3]

◆ calculate_transformation()

void SystemCalibrator::calculate_transformation ( )
protectedvirtual

Initialize the PolnCalibration::transformation attribute.

Retrieves the transformation from the standard model in each channel

Reimplemented from Pulsar::PolnCalibrator.

◆ get_nstate()

unsigned SystemCalibrator::get_nstate ( ) const
virtual

Get the total number of input polarization states (pulsar and cal)

Get the total number of input polarization states.

◆ get_solver()

const Calibration::ReceptionModel::Solver * SystemCalibrator::get_solver ( unsigned  ichan) const
virtual

Return the solver for the specified channel.

Return the transformation for the specified channel.

Reimplemented from Pulsar::PolnCalibrator.

◆ match()

void SystemCalibrator::match ( const Archive data)
protectedvirtual

Ensure that the pulsar observation can be added to the data set.

Add the specified pulsar observation to the set of constraints.

Reimplemented in Pulsar::ReceptionCalibrator, and Pulsar::PulsarCalibrator.

References Pulsar::Archive::get_filename().

◆ new_info_pulsar()

Calibrator::Info * SystemCalibrator::new_info_pulsar ( unsigned  istate) const
virtual

Return a new plot information interface for the specified pulsar state.

Retern a new plot information interface for the specified pulsar state.

Reimplemented in Pulsar::ReceptionCalibrator.

◆ precalibrate()


The documentation for this class was generated from the following files:

Generated using doxygen 1.8.17