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

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

Ajout des programmes de calcul de la sensibilite de l'interfero (plan(u,v), PNoise(k)) , Reza 28/04/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 int typ_;
34};
35
36
37#define TF r_4
38
39// -- Four3DPk class : 3D fourier amplitudes and power spectrum
40class Four3DPk {
41public:
42// Constructor
43 Four3DPk(TArray< complex<TF> > & fourcoedd, RandomGeneratorInterface& rg);
44 Four3DPk(RandomGeneratorInterface& rg, sa_size_t szx=128, sa_size_t szy=256, sa_size_t szz=128);
45 inline void SetCellSize(double dkx=DeuxPI, double dky=DeuxPI, double dkz=DeuxPI)
46 { dkx_=dkx; dky_=dky; dkz_=dkz; }
47 inline int SetPrtLevel(int lev=0)
48 { int olev=prtlev_; prtlev_=lev; return olev; }
49 void ComputeFourierAmp(SpectralShape& pk);
50 void ComputeNoiseFourierAmp(Four2DResponse& resp, bool crmask=false);
51// Return the array size
52 inline sa_size_t NCells() { return fourAmp.Size(); }
53// Set the cell size/step in Fourier Space
54// Return the fourier amplitude matrix
55 TArray< complex<TF> > GetFourierAmp()
56 { return fourAmp; }
57// Return the mass density matrix
58 TArray<TF> ComputeMassDens();
59
60// Return the reconstructed power spectrum as a profile histogram
61// HProf ComputePk(double s2cut=0., double kmin=-0.5*DeuxPI, double kmax=127.5*DeuxPI, int nbin=256);
62 HProf ComputePk(double s2cut=0., double kmin=-DeuxPI, double kmax=255*DeuxPI, int nbin=256);
63 void ComputePkCumul(HProf& hp, double s2cut=0.);
64
65protected:
66 // member attribute
67 RandomGeneratorInterface& rg_;
68 TArray< complex<TF> > fourAmp; // complex array of fourier coefficients
69 double dkx_, dky_, dkz_;
70 int prtlev_;
71};
72
73
74// -- MassDist2D class : 2D mass distribution
75class MassDist2D {
76public:
77// Constructor
78 MassDist2D(GenericFunc& pk, int size=1024, double meandens=1.);
79// Do the computation
80 void Compute();
81// Return the array size
82 inline sa_size_t ArrSize() { return sizeA; }
83// Return the fourier amplitude matrix
84 TMatrix< complex<r_8> > GetFourierAmp()
85 { if (!fg_fourAmp) ComputeFourierAmp(); return fourAmp; }
86// Return the mass density matrix
87 Matrix GetMassDens()
88 { if (!fg_massDens) ComputeMassDens(); return massDens; }
89
90// Return the reconstructed power spectrum as a profile histogram
91 HProf ReconstructPk(int nbin=0);
92protected:
93 void ComputeFourierAmp();
94 void ComputeMassDens();
95
96// member attribute
97 GenericFunc& pkSpec; // The spectralShape
98 sa_size_t sizeA; // 2D array size
99 double meanRho; // Mean Density
100 bool fg_fourAmp; // true -> fourAmp computed
101 TMatrix< complex<r_8> > fourAmp; // complex array of fourier coefficients
102 bool fg_massDens; // true -> MassDens computed
103 TMatrix< r_8 > massDens; // real array of d rho/rho
104};
105
106
107#endif
Note: See TracBrowser for help on using the repository browser.