9 #ifndef __Pulsar_SplineSmooth_h
10 #define __Pulsar_SplineSmooth_h
12 #include "ReferenceAble.h"
33 void set_alpha ( double _alpha) { alpha = _alpha; }
34 double get_alpha () const { return alpha; }
37 void unload ( const std::string&) const;
39 void load ( const std::string&);
44 double evaluate ( const std::vector<double>& xval);
60 class SplineSmooth1D : public SplineSmooth
64 void fit ( const std::vector< double >& data_x,
70 class SplineSmooth2D : public SplineSmooth
78 SplineSmooth2D ( const std::string& json) : SplineSmooth (json) {}
80 void fit ( const std::vector< std::pair<double,double> >& data_x,
83 double evaluate ( const std::pair<double,double>& );
95 class CrossValidatedSmooth2D
100 double validation_fraction;
102 SplineSmooth2D* spline;
104 double iqr_threshold;
105 unsigned nflagged_iqr;
107 double gof_step_threshold;
108 unsigned nflagged_gof;
110 std::vector<double> gof_tot;
111 std::vector<unsigned> gof_count;
113 std::string gof_filename;
114 std::ofstream* gof_out;
120 void set_gof_filename ( const std::string& name) { gof_filename = name; }
122 void set_spline (SplineSmooth2D* _spline) { spline = _spline; }
127 unsigned get_npartition () const { return npartition; }
132 double get_validation_fraction () const { return validation_fraction; }
137 double get_iqr_threshold () const { return iqr_threshold; }
142 double get_gof_step_threshold () const { return gof_step_threshold; }
145 void fit ( std::vector< std::pair<double,double> >& data_x,
148 void remove_iqr_outliers
149 ( std::vector< std::pair<double,double> >& x,
152 unsigned get_nflagged_iqr () const { return nflagged_iqr; }
154 void find_optimal_smoothing_factor
155 ( const std::vector< std::pair<double,double> >& dat_x,
158 void remove_gof_outliers
159 ( std::vector< std::pair<double,double> >& x,
162 unsigned get_nflagged_gof () const { return nflagged_gof; }
165 double get_mean_gof ( const std::vector< std::pair<double,double> >& data_x,
170 const std::vector< std::pair<double,double> >& data_x,
175 class BootstrapUncertainty2D
178 SplineSmooth2D* spline;
182 BootstrapUncertainty2D ();
184 void set_spline (SplineSmooth2D* _spline) { spline = _spline; }
186 void get_uncertainty ( const std::vector< std::pair<double,double> >& data_x,
void fit(const Pulsar::Parameters *model, std::vector< toa > &data, Pulsar::Parameters *postfit=NULL, bool track=false, Tempo::toa::State min_state=Tempo::toa::Normal)
void new_spline(const std::vector< T > &data_x, const std::vector< Estimate< double > > &data_y) constructor used by derived types Definition: SplineSmooth.C:67
void set_alpha(double _alpha) Set the smoothing factor. Definition: SplineSmooth.h:43
SplineSmooth() Constructor. Definition: SplineSmooth.C:29
void set_gof_step_threshold(double s) Set the goodness-of-fit step threshold. Definition: SplineSmooth.h:146
double get_mean_gof(const std::vector< std::pair< double, double > > &data_x, const std::vector< Estimate< double > > &data_y) Return the mean goodness-of-fit for the current smoothing.
void unload(const std::string &) const Unload spline to specified filename. Definition: SplineSmooth.C:101
Determines the spline smoothing factor as in Clark (1977) Definition: SplineSmooth.h:100
void set_validation_fraction(double f) Set the fraction of data reserved for validation. Definition: SplineSmooth.h:136
double evaluate(const std::vector< double > &xval) evaluate method used by derived types Definition: SplineSmooth.C:145
Defines the PSRCHIVE library. Definition: CalSource.h:17
void load(const std::string &) Load spline from specified filename. Definition: SplineSmooth.C:111
void fit(std::vector< std::pair< double, double > > &data_x, std::vector< Estimate< double > > &data_y) Fit spline to data using current configuration. Definition: CrossValidatedSmooth2D.C:80
void set_npartition(unsigned m) Set the number of cross-validation iterations, m. Definition: SplineSmooth.h:131
void set_iqr_threshold(double t) Set the multiple of IQR used to implement Tukey's fence outlier detection. Definition: SplineSmooth.h:141
~SplineSmooth() Destructor. Definition: SplineSmooth.C:50
Generated using doxygen 1.8.17
|