source: Sophya/trunk/Cosmo/RadioBeam/specpk.h@ 3828

Last change on this file since 3828 was 3825, checked in by ansari, 15 years ago

modifs et ajout de programme pour traitement cartes GSM (Global Sky Model), Reza 02/08/2010

File size: 3.3 KB
Line 
1// Class examples to generate mass distribution
2// R.A. for A. Abate , Nov. 2008
3
4#ifndef SPECPK_SEEN
5#define SPECPK_SEEN
6
7#include "machdefs.h"
8#include "sopnamsp.h"
9#include <math.h>
10#include <iostream>
11#include <vector>
12#include <string>
13
14#include "genericfunc.h"
15#include "array.h"
16#include "histats.h"
17#include "fftwserver.h"
18#include "randinterf.h"
19
20#include "mdish.h"
21
22#define DeuxPI 2.*M_PI
23
24// -- SpectralShape class : test P(k) class
25class SpectralShape : public GenericFunc {
26public:
27 SpectralShape(int typ);
28// Return the value of power spectrum for wave number wk
29 virtual double operator() (double wk);
30 inline double Value(double wk) { return((*this)(wk)); }
31// Return a vector representing the power spectrum (for checking)
32 Histo GetPk(int n=256);
33 double Sommek2Pk(double kmax=1000., int n=5000);
34 inline void SetRenormFac(double f=1.) { renorm_fac=f; }
35 int typ_;
36 double renorm_fac;
37};
38
39
40#define TF r_4
41
42// -- Four3DPk class : 3D fourier amplitudes and power spectrum
43class Four3DPk {
44public:
45// Constructor
46 Four3DPk(TArray< complex<TF> > & fourcoedd, RandomGeneratorInterface& rg);
47 Four3DPk(RandomGeneratorInterface& rg, sa_size_t szx=128, sa_size_t szy=256, sa_size_t szz=128);
48 inline void SetCellSize(double dkx=DeuxPI, double dky=DeuxPI, double dkz=DeuxPI)
49 { dkx_=dkx; dky_=dky; dkz_=dkz; }
50 inline int SetPrtLevel(int lev=0)
51 { int olev=prtlev_; prtlev_=lev; return olev; }
52 void ComputeFourierAmp(SpectralShape& pk);
53 void ComputeNoiseFourierAmp(Four2DResponse& resp, bool crmask=false);
54// Return the array size
55 inline sa_size_t NCells() { return fourAmp.Size(); }
56// Set the cell size/step in Fourier Space
57// Return the fourier amplitude matrix
58 TArray< complex<TF> > GetFourierAmp()
59 { return fourAmp; }
60// Return the mass density matrix
61 TArray<TF> ComputeMassDens();
62
63// Return the reconstructed power spectrum as a profile histogram
64 HProf ComputePk(double s2cut=0., int nbin=256, double kmin=0., double kmax=-1.);
65 void ComputePkCumul(HProf& hp, double s2cut=0.);
66
67protected:
68 // member attribute
69 RandomGeneratorInterface& rg_;
70 TArray< complex<TF> > fourAmp; // complex array of fourier coefficients
71 double dkx_, dky_, dkz_;
72 int prtlev_;
73};
74
75
76// -- MassDist2D class : 2D mass distribution
77class MassDist2D {
78public:
79// Constructor
80 MassDist2D(GenericFunc& pk, int size=1024, double meandens=1.);
81// Do the computation
82 void Compute();
83// Return the array size
84 inline sa_size_t ArrSize() { return sizeA; }
85// Return the fourier amplitude matrix
86 TMatrix< complex<r_8> > GetFourierAmp()
87 { if (!fg_fourAmp) ComputeFourierAmp(); return fourAmp; }
88// Return the mass density matrix
89 Matrix GetMassDens()
90 { if (!fg_massDens) ComputeMassDens(); return massDens; }
91
92// Return the reconstructed power spectrum as a profile histogram
93 HProf ReconstructPk(int nbin=0);
94protected:
95 void ComputeFourierAmp();
96 void ComputeMassDens();
97
98// member attribute
99 GenericFunc& pkSpec; // The spectralShape
100 sa_size_t sizeA; // 2D array size
101 double meanRho; // Mean Density
102 bool fg_fourAmp; // true -> fourAmp computed
103 TMatrix< complex<r_8> > fourAmp; // complex array of fourier coefficients
104 bool fg_massDens; // true -> MassDens computed
105 TMatrix< r_8 > massDens; // real array of d rho/rho
106};
107
108
109#endif
Note: See TracBrowser for help on using the repository browser.