ConfigurableProjectionExtension.h
1//-*-C++-*-
2/***************************************************************************
3 *
4 * Copyright (C) 2022 - 2023 by Willem van Straten
5 * Licensed under the Academic Free License version 2.1
6 *
7 ***************************************************************************/
8
9// psrchive/Base/Extensions/Pulsar/ConfigurableProjectionExtension.h
10
11#ifndef __ConfigurableProjectionExtension_h
12#define __ConfigurableProjectionExtension_h
13
14#include "Pulsar/HasChannels.h"
15
16namespace Pulsar {
17
19
21
22
23 class ConfigurableProjectionExtension : public HasChannels
24 {
25
26 public:
27
30
33
36
39
43
46
47 // Text interface to a ConfigurableProjectionExtension instance
48 class Interface : public TextInterface::To<ConfigurableProjectionExtension>
49 {
50 public:
51 Interface( ConfigurableProjectionExtension *s_instance = NULL );
52 };
53
55 ConfigurableProjectionExtension (const ConfigurableProjection*);
56
58 std::string get_short_name () const { return "proj"; }
59
61 void set_configuration (const std::string& text) { configuration = text; }
63 const std::string& get_configuration () const { return configuration; }
64
66 void set_nchan (unsigned nchan);
68 unsigned get_nchan () const;
69
71 void remove_chan (unsigned first, unsigned last);
72
74 void set_weight (unsigned ichan, float weight);
76 float get_weight (unsigned ichan) const;
77
79 unsigned get_nparam () const;
81 void set_nparam (unsigned);
82
84 bool get_has_covariance () const;
86 void set_has_covariance (bool);
87
89 bool get_valid (unsigned ichan) const;
90 void set_valid (unsigned ichan, bool valid);
91
92 class Transformation;
93
97 const Transformation* get_transformation (unsigned c) const;
98
100 void frequency_append (Archive* to, const Archive* from);
101
102 void fscrunch (unsigned factor = 0);
103 void fscrunch_to_nchan (unsigned new_nchan);
104
105 Estimate<float> get_Estimate ( unsigned iparam, unsigned ichan ) const;
106 void set_Estimate (unsigned iparam, unsigned ichan, const Estimate<float>&);
107
108 protected:
109
111 std::string configuration;
112
114 std::vector<Transformation> response;
115
117 unsigned nparam;
118
121
123 void construct ();
124
125 void range_check (unsigned ichan, const char* method) const;
126
127 private:
128
129 void init ();
130
131 };
132
135 {
136 public:
137
140
142 unsigned get_nparam() const;
144 void set_nparam (unsigned);
145
147 std::string get_param_name (unsigned) const;
149 void set_param_name (unsigned, const std::string&);
150
152 std::string get_param_description (unsigned) const;
154 void set_param_description (unsigned, const std::string&);
155
157 double get_param (unsigned) const;
159 void set_param (unsigned, double);
160
162 double get_variance (unsigned) const;
164 void set_variance (unsigned, double);
165
167 std::vector< std::vector<double> > get_covariance () const;
169 void set_covariance (const std::vector< std::vector<double> >&);
170
172 void get_covariance (std::vector<double>&) const;
174 void set_covariance (const std::vector<double>&);
175
177 Estimate<double> get_Estimate (unsigned) const;
179 void set_Estimate (unsigned, const Estimate<double>&);
180
182 bool get_valid () const;
184 void set_valid (bool);
185
186 // Text interface to a ConfigurableProjectionExtension instance
187 class Interface : public TextInterface::To<Transformation>
188 {
189 public:
190 Interface();
191 };
192
193 protected:
194
195 std::vector< Estimate<double> > params;
196 std::vector< std::string > names;
197 std::vector< std::string > descriptions;
198
199 std::vector<double> covariance;
200 bool valid;
201
202 };
203
204}
205
206#endif
The primary interface to pulsar observational data.
Definition Archive.h:46
Intermediate storage of MEAL::Complex parameters.
Definition ConfigurableProjectionExtension.h:135
void set_Estimate(unsigned, const Estimate< double > &)
Set the value and variance of the specified model parameter.
Definition ConfigurableProjectionExtension.C:285
void set_param(unsigned, double)
Set the value of the specified model parameter.
Definition ConfigurableProjectionExtension.C:259
std::string get_param_name(unsigned) const
Get the name of the specified model parameter.
Definition ConfigurableProjectionExtension.C:222
void set_nparam(unsigned)
Set the number of model parameters.
Definition ConfigurableProjectionExtension.C:245
std::string get_param_description(unsigned) const
Get the description of the specified model parameter.
Definition ConfigurableProjectionExtension.C:234
Estimate< double > get_Estimate(unsigned) const
Get the value and variance of the specified model parameter.
Definition ConfigurableProjectionExtension.C:277
void set_valid(bool)
Set the model validity flag.
Definition ConfigurableProjectionExtension.C:295
void set_variance(unsigned, double)
Set the variance of the specified model parameter.
Definition ConfigurableProjectionExtension.C:272
unsigned get_nparam() const
Get the number of model parameters.
Definition ConfigurableProjectionExtension.C:216
void set_param_description(unsigned, const std::string &)
Set the description of the specified model parameter.
Definition ConfigurableProjectionExtension.C:240
void set_param_name(unsigned, const std::string &)
Set the name of the specified model parameter.
Definition ConfigurableProjectionExtension.C:228
std::vector< std::vector< double > > get_covariance() const
Get the covariance matrix of the model paramters.
Definition ConfigurableProjectionExtension.C:301
bool get_valid() const
Get the model validity flag.
Definition ConfigurableProjectionExtension.C:290
double get_param(unsigned) const
Get the value of the specified model parameter.
Definition ConfigurableProjectionExtension.C:253
Transformation()
Default constructor.
Definition ConfigurableProjectionExtension.C:211
void set_covariance(const std::vector< std::vector< double > > &)
Set the covariance matrix of the model paramters.
Definition ConfigurableProjectionExtension.C:328
double get_variance(unsigned) const
Get the variance of the specified model parameter.
Definition ConfigurableProjectionExtension.C:265
Stores ConfigurableProjection parameters in an Archive instance.
Definition ConfigurableProjectionExtension.h:24
unsigned get_nchan() const
Get the number of frequency channels.
Definition ConfigurableProjectionExtension.C:75
std::string get_short_name() const
Return a short name.
Definition ConfigurableProjectionExtension.h:58
std::string configuration
Configures this projection.
Definition ConfigurableProjectionExtension.h:111
void construct()
Construct the response array according to the current attributes.
Definition ConfigurableProjectionExtension.C:175
std::vector< Transformation > response
The instrumental response as a function of frequency.
Definition ConfigurableProjectionExtension.h:114
bool get_valid(unsigned ichan) const
Return true if the transformation for the specified channel is valid.
Definition ConfigurableProjectionExtension.C:102
bool has_covariance
The covariances of the transformation parameters are available.
Definition ConfigurableProjectionExtension.h:120
void set_nchan(unsigned nchan)
Set the number of frequency channels.
Definition ConfigurableProjectionExtension.C:69
const std::string & get_configuration() const
Get the string that configures this projection.
Definition ConfigurableProjectionExtension.h:63
void frequency_append(Archive *to, const Archive *from)
Append ConfigurableProjection Extension data from another Archive.
Definition ConfigurableProjectionExtension.C:187
float get_weight(unsigned ichan) const
Get the weight of the specified channel.
Definition ConfigurableProjectionExtension.C:92
ConfigurableProjectionExtension()
Default constructor.
Definition ConfigurableProjectionExtension.C:18
void set_configuration(const std::string &text)
Set the string that configures this projection.
Definition ConfigurableProjectionExtension.h:61
TextInterface::Parser * get_interface()
get the text ineterface
Definition ConfigurableProjectionExtension.C:399
ConfigurableProjectionExtension * clone() const
Clone method.
Definition ConfigurableProjectionExtension.h:41
~ConfigurableProjectionExtension()
Destructor.
Definition ConfigurableProjectionExtension.C:64
void set_weight(unsigned ichan, float weight)
Set the weight of the specified channel.
Definition ConfigurableProjectionExtension.C:86
bool get_has_covariance() const
Get if the covariances of the transformation parameters.
Definition ConfigurableProjectionExtension.C:125
const ConfigurableProjectionExtension & operator=(const ConfigurableProjectionExtension &)
Operator =.
Definition ConfigurableProjectionExtension.C:41
Transformation * get_transformation(unsigned c)
Get the transformation for the specified frequency channel.
Definition ConfigurableProjectionExtension.C:144
void set_has_covariance(bool)
Set if the covariances of the transformation parameters.
Definition ConfigurableProjectionExtension.C:130
void remove_chan(unsigned first, unsigned last)
Remove the inclusive range of channels.
Definition ConfigurableProjectionExtension.C:80
void set_nparam(unsigned)
Set the number of parameters describing each transformation.
Definition ConfigurableProjectionExtension.C:119
unsigned get_nparam() const
Get the number of parameters describing each transformation.
Definition ConfigurableProjectionExtension.C:114
unsigned nparam
The number of parameters that describe the transformation.
Definition ConfigurableProjectionExtension.h:117
Manager of variable transformations.
Definition ConfigurableProjection.h:23
Algorithms that modify data in the Container.
Definition Transformation.h:20
Defines the PSRCHIVE library.
Definition CalSource.h:17
void fscrunch(Container *, const ScrunchFactor &)
Integrate frequency channels.
Definition ScrunchFactor.h:102

Generated using doxygen 1.14.0