00001 /* 00002 * This file is part of Healpix_cxx. 00003 * 00004 * Healpix_cxx is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * Healpix_cxx is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with Healpix_cxx; if not, write to the Free Software 00016 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00017 * 00018 * For more information about HEALPix, see http://healpix.sourceforge.net 00019 */ 00020 00021 /* 00022 * Healpix_cxx is being developed at the Max-Planck-Institut fuer Astrophysik 00023 * and financially supported by the Deutsches Zentrum fuer Luft- und Raumfahrt 00024 * (DLR). 00025 */ 00026 00027 /* 00028 * Copyright (C) 2003-2011 Max-Planck-Society 00029 * Author: Martin Reinecke 00030 */ 00031 00032 #ifndef POWSPEC_H 00033 #define POWSPEC_H 00034 00035 #include "arr.h" 00036 00037 /*! Class for storing unpolarised and polarised power spectra. */ 00038 class PowSpec 00039 { 00040 private: 00041 arr<double> tt_, gg_, cc_, tg_, tc_, gc_; 00042 int num_specs; 00043 00044 void dealloc(); 00045 00046 public: 00047 /*! */ 00048 PowSpec() {} 00049 /*! Constructs a \a PowSpec with \a nspec components and a maximum 00050 multipole of \a lmax. \a nspec can be 1 (TT), 4 (TT,GG,CC,TG) or 00051 6 (TT,GG,CC,TG,TC,GC). */ 00052 PowSpec(int nspec, int lmax); 00053 00054 ~PowSpec(); 00055 00056 /*! Ensures that the internal array sizes are consistent with the 00057 \a num_specs variable. */ 00058 void assertArraySizes() const; 00059 00060 /*! Checks whether the object can be an auto power spectrum. If this 00061 is not the case, an exception is thrown. */ 00062 bool consistentAutoPowspec() const; 00063 00064 /*! Returns the number of spectral components. */ 00065 int Num_specs() const { return num_specs; } 00066 /*! Returns the maximum \a l. */ 00067 int Lmax() const { return tt_.size()-1; } 00068 /*! Returns the TT array (read-only). */ 00069 const arr<double> &tt() const { return tt_; } 00070 /*! Returns the GG array (read-only). */ 00071 const arr<double> &gg() const { return gg_; } 00072 /*! Returns the CC array (read-only). */ 00073 const arr<double> &cc() const { return cc_; } 00074 /*! Returns the TG array (read-only). */ 00075 const arr<double> &tg() const { return tg_; } 00076 /*! Returns the TC array (read-only). */ 00077 const arr<double> &tc() const { return tc_; } 00078 /*! Returns the GC array (read-only). */ 00079 const arr<double> &gc() const { return gc_; } 00080 /*! Returns TT(l) (read-write). */ 00081 double &tt (int l) { return tt_[l]; } 00082 /*! Returns GG(l) (read-write). */ 00083 double &gg (int l) { return gg_[l]; } 00084 /*! Returns CC(l) (read-write). */ 00085 double &cc (int l) { return cc_[l]; } 00086 /*! Returns TG(l) (read-write). */ 00087 double &tg (int l) { return tg_[l]; } 00088 /*! Returns TC(l) (read-write). */ 00089 double &tc (int l) { return tc_[l]; } 00090 /*! Returns GC(l) (read-write). */ 00091 double &gc (int l) { return gc_[l]; } 00092 /*! Returns TT(l) (read-only). */ 00093 const double &tt (int l) const { return tt_[l]; } 00094 /*! Returns GG(l) (read-only). */ 00095 const double &gg (int l) const { return gg_[l]; } 00096 /*! Returns CC(l) (read-only). */ 00097 const double &cc (int l) const { return cc_[l]; } 00098 /*! Returns TG(l) (read-only). */ 00099 const double &tg (int l) const { return tg_[l]; } 00100 /*! Returns TC(l) (read-only). */ 00101 const double &tc (int l) const { return tc_[l]; } 00102 /*! Returns GC(l) (read-only). */ 00103 const double &gc (int l) const { return gc_[l]; } 00104 00105 /*! Re-allocates the object */ 00106 void Set(int nspec, int lmax); 00107 00108 /*! Sets the whole TT array. 00109 \note On exit, \a tt_new is zero-sized! */ 00110 void Set(arr<double> &tt_new); 00111 /*! Sets the four first components. 00112 \note On exit, all arguments are zero-sized! */ 00113 void Set(arr<double> &tt_new, arr<double> &gg_new, 00114 arr<double> &cc_new, arr<double> &tg_new); 00115 /*! Sets all components. 00116 \note On exit, all arguments are zero-sized! */ 00117 void Set(arr<double> &tt_new, arr<double> &gg_new, 00118 arr<double> &cc_new, arr<double> &tg_new, 00119 arr<double> &tc_new, arr<double> &gc_new); 00120 /*! Smooths the spectrum with a Gaussian beam. 00121 \a fwhm is given in radian. 00122 \note This is only implememted for 1 and 4 spectra so far. */ 00123 void smoothWithGauss (double fwhm); 00124 }; 00125 00126 #endif