Healpix C++  3.82
powspec.h
1 /*
2  * This file is part of Healpix_cxx.
3  *
4  * Healpix_cxx is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * Healpix_cxx is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with Healpix_cxx; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17  *
18  * For more information about HEALPix, see http://healpix.sourceforge.net
19  */
20 
21 /*
22  * Healpix_cxx is being developed at the Max-Planck-Institut fuer Astrophysik
23  * and financially supported by the Deutsches Zentrum fuer Luft- und Raumfahrt
24  * (DLR).
25  */
26 
27 /*
28  * Copyright (C) 2003-2011 Max-Planck-Society
29  * Author: Martin Reinecke
30  */
31 
32 #ifndef POWSPEC_H
33 #define POWSPEC_H
34 
35 #include "arr.h"
36 
37 /*! Class for storing unpolarised and polarised power spectra. */
38 class PowSpec
39  {
40  private:
41  arr<double> tt_, gg_, cc_, tg_, tc_, gc_;
42  int num_specs;
43 
44  void dealloc();
45 
46  public:
47  /*! */
48  PowSpec() {}
49  /*! Constructs a \a PowSpec with \a nspec components and a maximum
50  multipole of \a lmax. \a nspec can be 1 (TT), 4 (TT,GG,CC,TG) or
51  6 (TT,GG,CC,TG,TC,GC). */
52  PowSpec(int nspec, int lmax);
53 
54  ~PowSpec();
55 
56  /*! Ensures that the internal array sizes are consistent with the
57  \a num_specs variable. */
58  void assertArraySizes() const;
59 
60  /*! Checks whether the object can be an auto power spectrum. If this
61  is not the case, an exception is thrown. */
62  bool consistentAutoPowspec() const;
63 
64  /*! Returns the number of spectral components. */
65  int Num_specs() const { return num_specs; }
66  /*! Returns the maximum \a l. */
67  int Lmax() const { return tt_.size()-1; }
68  /*! Returns the TT array (read-only). */
69  const arr<double> &tt() const { return tt_; }
70  /*! Returns the GG array (read-only). */
71  const arr<double> &gg() const { return gg_; }
72  /*! Returns the CC array (read-only). */
73  const arr<double> &cc() const { return cc_; }
74  /*! Returns the TG array (read-only). */
75  const arr<double> &tg() const { return tg_; }
76  /*! Returns the TC array (read-only). */
77  const arr<double> &tc() const { return tc_; }
78  /*! Returns the GC array (read-only). */
79  const arr<double> &gc() const { return gc_; }
80  /*! Returns TT(l) (read-write). */
81  double &tt (int l) { return tt_[l]; }
82  /*! Returns GG(l) (read-write). */
83  double &gg (int l) { return gg_[l]; }
84  /*! Returns CC(l) (read-write). */
85  double &cc (int l) { return cc_[l]; }
86  /*! Returns TG(l) (read-write). */
87  double &tg (int l) { return tg_[l]; }
88  /*! Returns TC(l) (read-write). */
89  double &tc (int l) { return tc_[l]; }
90  /*! Returns GC(l) (read-write). */
91  double &gc (int l) { return gc_[l]; }
92  /*! Returns TT(l) (read-only). */
93  const double &tt (int l) const { return tt_[l]; }
94  /*! Returns GG(l) (read-only). */
95  const double &gg (int l) const { return gg_[l]; }
96  /*! Returns CC(l) (read-only). */
97  const double &cc (int l) const { return cc_[l]; }
98  /*! Returns TG(l) (read-only). */
99  const double &tg (int l) const { return tg_[l]; }
100  /*! Returns TC(l) (read-only). */
101  const double &tc (int l) const { return tc_[l]; }
102  /*! Returns GC(l) (read-only). */
103  const double &gc (int l) const { return gc_[l]; }
104 
105  /*! Re-allocates the object */
106  void Set(int nspec, int lmax);
107 
108  /*! Sets the whole TT array.
109  \note On exit, \a tt_new is zero-sized! */
110  void Set(arr<double> &tt_new);
111  /*! Sets the four first components.
112  \note On exit, all arguments are zero-sized! */
113  void Set(arr<double> &tt_new, arr<double> &gg_new,
114  arr<double> &cc_new, arr<double> &tg_new);
115  /*! Sets all components.
116  \note On exit, all arguments are zero-sized! */
117  void Set(arr<double> &tt_new, arr<double> &gg_new,
118  arr<double> &cc_new, arr<double> &tg_new,
119  arr<double> &tc_new, arr<double> &gc_new);
120  /*! Smooths the spectrum with a Gaussian beam.
121  \a fwhm is given in radian.
122  \note This is only implememted for 1 and 4 spectra so far. */
123  void smoothWithGauss (double fwhm);
124  };
125 
126 #endif
void Set(int nspec, int lmax)
Definition: powspec.cc:92
void smoothWithGauss(double fwhm)
Definition: powspec.cc:140
const arr< double > & gg() const
Definition: powspec.h:71
const double & tc(int l) const
Definition: powspec.h:101
const arr< double > & tc() const
Definition: powspec.h:77
int Lmax() const
Definition: powspec.h:67
int Num_specs() const
Definition: powspec.h:65
double & cc(int l)
Definition: powspec.h:85
const arr< double > & tt() const
Definition: powspec.h:69
void assertArraySizes() const
Definition: powspec.cc:53
const double & cc(int l) const
Definition: powspec.h:97
const arr< double > & tg() const
Definition: powspec.h:75
double & tt(int l)
Definition: powspec.h:81
bool consistentAutoPowspec() const
Definition: powspec.cc:72
const double & gc(int l) const
Definition: powspec.h:103
double & tc(int l)
Definition: powspec.h:89
const arr< double > & cc() const
Definition: powspec.h:73
double & tg(int l)
Definition: powspec.h:87
const double & tt(int l) const
Definition: powspec.h:93
const double & tg(int l) const
Definition: powspec.h:99
const arr< double > & gc() const
Definition: powspec.h:79
double & gc(int l)
Definition: powspec.h:91
double & gg(int l)
Definition: powspec.h:83
const double & gg(int l) const
Definition: powspec.h:95

Generated on Thu Jul 28 2022 17:32:07 for Healpix C++