GLAMERDOC++
Gravitational Lensing Code Library
sersic_source.h
1 /*
2  * sersic_source.h
3  *
4  * Created on: Mar 6, 2010
5  * Author: R.B. Metcalf
6  */
7 #ifndef SERSIC_SOURCE_H_
8 #define SERSIC_SOURCE_H_
9 
10 #include "source.h"
11 
12 
20 class SourceSersic : public SourceColored
21 {
22 public:
24  SourceSersic();
26  double my_mag
27  ,double my_Reff
28  ,double my_PA
29  ,double my_index
30  ,double my_q
31  ,double my_z
32  ,double my_zeropoint
33  //,const double *my_theta=0 /// optional angular position on the sky
34  );
36  double my_mag
37  ,Band band
38  ,double my_zeropoint
39  ,double my_Reff
40  ,double my_PA
41  ,double my_index
42  ,double my_q
43  ,double my_z
44  );
45  ~SourceSersic();
46 
47  SourceSersic(const SourceSersic &p);
48  SourceSersic & operator=(const SourceSersic &p);
49 
50 
51  void ReSet(PosType mag,Band band,PosType Reff,PosType PA,PosType my_index,PosType my_q,PosType my_z,const PosType *theta=0);
52 
54  inline PosType FractionRadius (PosType f) {return Reff*pow(-log (f)/bn,index);}
55 
56  inline PosType getSersicIndex() const { return index; }
57  inline PosType getAxesRatio() const { return q; }
59  inline PosType getReff() const { return Reff/arcsecTOradians; }
60  //inline PosType getMag() const { return mag; }
61  inline PosType getPA() const { return PA; }
62 
63  inline void setSersicIndex(PosType x)
64  {
65  index = x;
66  bn = 1.9992*index - 0.3271; // approximation valid for 0.5 < n < 8
67  I_n = 1./index*pow(bn,2*index)/tgamma(2*index);
68  updateRadius();
69  }
70 
71  inline void setAxesRatio(PosType x)
72  {
73  q = x;
74  I_q = 1./q;
75  }
76 
77  inline void setReff(PosType x // in arcseconds
78  )
79  {
80  Reff = x*arcsecTOradians;
81  I_r = 1./2./PI/Reff/Reff;
82  updateRadius();
83  }
84 
85  inline void setPA(PosType x)
86  {
87  PA = x;
88  cosPA = cos(x);
89  sinPA = sin(x);
90  }
91 
92  void rotate(PosType theta){
93  PA = PA + theta;
94  cosPA = cos(PA);
95  sinPA = sin(PA);
96  }
97 
98  //inline PosType getTotalFlux() const { return flux_total; }
99 
100  PosType SurfaceBrightness(const PosType *x) const;
101  void printSource();
102 
103 private:
104  inline void updateRadius()
105  {
106  // radius in Source
107  // approximation of the radius that encloses 99% of the flux
108  setRadius((3.73 - 0.926*index + 1.164*index*index)*Reff);
109  }
110 
111  void assignParams(InputParams& params);
112 
113  PosType Reff; // in radians
114  //PosType mag;
115  PosType PA;
116  PosType index;
117  PosType bn;
118  PosType q;
119  //PosType flux;
120  PosType I_r, I_n, I_q;
121  PosType cosPA,sinPA;
122 };
123 
124 #endif /* GALAXIES_SERSIC_H_ */
Source::setRadius
void setRadius(PosType my_radius)
Reset the radius of the source in radians.
Definition: source.h:106
Band
Band
Photometric bands.
Definition: InputParams.h:79
SourceSersic::FractionRadius
PosType FractionRadius(PosType f)
calculates radius where the surface brightness drops by a factor f with respect to the central peak i...
Definition: sersic_source.h:54
SourceSersic::getReff
PosType getReff() const
in arcseconds
Definition: sersic_source.h:59
SourceSersic
Class for sources described by a Sersic profile.
Definition: sersic_source.h:21
SourceSersic::ReSet
void ReSet(PosType mag, Band band, PosType Reff, PosType PA, PosType my_index, PosType my_q, PosType my_z, const PosType *theta=0)
Reset parameters but not the magnitude.
Definition: sersic.cpp:89
SourceSersic::SourceSersic
SourceSersic()
sets values to invalid values
Definition: sersic.cpp:9
SourceSersic::SurfaceBrightness
PosType SurfaceBrightness(const PosType *x) const
Definition: sersic.cpp:121
InputParams
Structure for reading and writing parameters to and from a parameter file as well as a container for ...
Definition: InputParams.h:99