explicit_mapmaking
 All Classes Files Pages
ces.hpp
Go to the documentation of this file.
1 
8 #ifndef EXPLICIT_MAPMAKING_CES_HPP_
9 #define EXPLICIT_MAPMAKING_CES_HPP_
10 
11 #include "filters.hpp"
12 #include <vector>
13 #include <list>
14 #include <stdio.h>
15 
16 namespace mapmaking {
17 
18 struct Subscan { // TODO move it elsewhere
19  Subscan(int in_idx, int in_t_first, int in_n_sample, Filters& filters)
20  : legendre_(filters.ConcatenetedLegendre(in_n_sample)) {
21  idx = in_idx;
22  t_first = in_t_first;
23  n_sample = in_n_sample;
24  t_last = in_t_first + in_n_sample - 1;
25  }
26  int idx;
27  int t_first;
28  int t_last;
29  int n_sample;
30  const std::vector<double>& legendre_;
31  double Legendre(int order, int i_sample) const { return legendre_[i_sample + order * n_sample]; }
32 };
33 
34 class CES {
35  friend class IOManager;
36  public:
37  CES(int n_sample, Filters& filters);
38  CES(int n_sample, const double* data, const double* pol_angle, const int* pixel, const int* ground, double weight, Filters& filters);
39  int ComputeKernel(double threshold=1e-6);
40  void WhiteNoise();
41 
42  void AddSubscan(int t_first, int n_sample);
43  void ChangePixelIndexes(const std::vector<int>& old2new);
44  int id() const { return id_; }
45  double weight() const { return weight_; }
46  double data(int t) const { return data_[t]; }
47  double data(int t, const std::vector<double>& map) const { return cos_[t] * map[2 * pixel_[t]] + sin_[t] * map[2 * pixel_[t] + 1]; }
48  double cos(int t) const { return cos_[t]; } // cos(2 * phi); phi = pol angle
49  double sin(int t) const { return sin_[t]; }
50  int pixel(int t) const { return pixel_[t]; }
51  int n_pol() const { return n_pol_; }
52  int n_gt() const { return n_gt_; }
53  int n_sub() const { return subscans_.size(); }
54  int n_filters() const { return n_filters_; }
55  double kernel(int idx) const { return kernel_[idx]; }
56  double ground(int t) const { return ground_[t]; }
57  void ApplyKernel(std::vector<double>* vec);
58  int CompressTimeStreams(); // TODO test and assess the gain
59  const std::list<Subscan>& subscans() const { return subscans_; };
60 
61  private:
62  std::list<Subscan> subscans_;
63  double weight_ = 0;
64  int id_ = 0; // common to all the bolometers in the same CES
65  std::vector<double> data_;
66  std::vector<double> cos_;
67  std::vector<double> sin_;
68  std::vector<int> pixel_;
69  std::vector<int> ground_;
70  std::vector<double> kernel_; // Orthonormalization kernel
71  Filters& filters_; // Contains the polynomial filters, shared by many ces instances
72  int n_filters_ = 0; // Both ground template and polynomial
73  int n_gt_;
74  int n_pol_;
75  void AllocateVectors(int n_sample);
76  void CosSinFromPolAngle(const std::vector<double>& pol_angle);
77 };
78 }
79 
80 #endif // EXPLICIT_MAPMAKING_CES_HPP_
Definition: filters.hpp:17
Definition: atfa.hpp:18
Definition: ces.hpp:18
Definition: io_manager.hpp:19
Definition: ces.hpp:34
Concatenation of legendre polynomials.