RobustStepFinder.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2021 by Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // psrchive/More/Polarimetry/Pulsar/RobustStepFinder.h
10 
11 #ifndef __Pulsar_RobustStepFinder_H
12 #define __Pulsar_RobustStepFinder_H
13 
14 #include "Pulsar/SystemCalibratorStepFinder.h"
15 
16 namespace Pulsar
17 {
18  class RobustStepFinder : public SystemCalibrator::StepFinder
19  {
21  float step_threshold;
22 
24  unsigned depth;
25 
27  SystemCalibrator* calibrator;
28 
30  std::vector<unsigned> psr_before;
31 
33  std::vector<unsigned> psr_after;
34 
36  std::vector<unsigned> cal_before;
37 
39  std::vector<unsigned> cal_after;
40 
42  std::vector<unsigned> compare;
43 
44  template<typename Container>
45  void count_consistent (const Container& container,
46  std::vector<unsigned>& before,
47  std::vector<unsigned>& after,
48  bool wedge);
49 
50  template<typename Container>
51  void remove_inconsistent (Container& container,
52  std::vector<unsigned>& before,
53  std::vector<unsigned>& after);
54 
56  void find_steps (std::vector<unsigned>& steps,
57  const std::vector<unsigned>& before,
58  const std::vector<unsigned>& after);
59 
60  template<class Container>
61  void add_steps (std::vector<MJD>& steps,
62  std::vector<unsigned>& step_sub,
63  Container& data,
64  bool align_to_cal = 0);
65 
66  // adjust epochs and ids to align to calibrator observations
67  bool align_to_cal (MJD& i_epoch, std::string& i_id,
68  MJD& j_epoch, std::string& j_id);
69 
71 
73  void find_steps_pulsar (std::vector<MJD>& steps);
74  void find_steps_calibrator (std::vector<MJD>& steps);
75 
77  void insert_steps (std::vector<MJD>& steps,
79 
80  void remove_extra_calibrators ();
81  void remove_outliers ();
82 
84  void insert_steps ();
85 
86  public:
87 
89  RobustStepFinder (float threshold = 3.0)
90  {
91  step_threshold = threshold;
92  depth = 3;
93  }
94 
95  void set_step_threshold (float val) { step_threshold = val; }
96 
97  void process (SystemCalibrator*);
98 
99  };
100 }
101 
102 #endif
const Uncertainty * get_uncertainty() const
The uncertainty of the measurement.
Definition: CoherencyMeasurement.h:86
Data storage implementations.
Definition: Container.h:24
PolnCalibrator with estimated calibrator Stokes parameters.
Definition: SystemCalibrator.h:43
VariableBackend * clone() const
Clone operator.
Definition: VariableBackend.C:52
const ScalarMath sqrt(const ScalarMath &x)
A CoherencyMeasurement set and their coordinates.
Definition: CoherencyMeasurementSet.h:26
Jones< double > get_coherency() const
Get the measured coherency matrix.
Definition: CoherencyMeasurement.C:123
A coherency matrix measurement and its estimated error.
Definition: CoherencyMeasurement.h:32
Defines the PSRCHIVE library.
Definition: CalSource.h:17
Physical parameterization of the instrumental response.
Definition: VariableBackend.h:35

Generated using doxygen 1.8.17