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  ,Band band
33  );
35  double my_mag
36  ,double my_Reff
37  ,double my_PA
38  ,double my_index
39  ,double my_q
40  ,double my_z
41  ,double my_zeropoint
42  ,Band band
43  );
44  ~SourceSersic();
45 
46  SourceSersic(const SourceSersic &p);
47  SourceSersic & operator=(const SourceSersic &p);
48 
49 
50  void ReSet(PosType mag,Band band,PosType Reff,PosType PA,PosType my_index,PosType my_q,PosType my_z,const PosType *theta=0);
51 
53  inline PosType FractionRadius (PosType f) {return Reff*pow(-log (f)/bn,index);}
54 
55  inline PosType getSersicIndex() const { return index; }
56  inline PosType getAxesRatio() const { return q; }
58  inline PosType getReff() const { return Reff/arcsecTOradians; }
59  //inline PosType getMag() const { return mag; }
60  inline PosType getPA() const { return PA; }
61 
62  inline void setSersicIndex(PosType x)
63  {
64  index = x;
65  bn = 1.9992*index - 0.3271; // approximation valid for 0.5 < n < 8
66  I_n = 1./index*pow(bn,2*index)/tgamma(2*index);
67  updateRadius();
68  }
69 
70  inline void setAxesRatio(PosType x)
71  {
72  q = x;
73  I_q = 1./q;
74  }
75 
76  inline void setReff(PosType x // in arcseconds
77  )
78  {
79  Reff = x*arcsecTOradians;
80  I_r = 1./2./PI/Reff/Reff;
81  updateRadius();
82  }
83 
84  inline void setPA(PosType x)
85  {
86  PA = x;
87  cosPA = cos(x);
88  sinPA = sin(x);
89  }
90 
91  void rotate(PosType theta){
92  PA = PA + theta;
93  cosPA = cos(PA);
94  sinPA = sin(PA);
95  }
96 
97  //inline PosType getTotalFlux() const { return flux_total; }
98 
99  PosType SurfaceBrightness(const PosType *x) const;
100  void printSource();
101 
102 private:
103  inline void updateRadius()
104  {
105  // radius in Source
106  // approximation of the radius that encloses 99% of the flux
107  setRadius((3.73 - 0.926*index + 1.164*index*index)*Reff);
108  }
109 
110  void assignParams(InputParams& params);
111 
112  PosType Reff; // in radians
113  //PosType mag;
114  PosType PA;
115  PosType index;
116  PosType bn;
117  PosType q;
118  //PosType flux;
119  PosType I_r, I_n, I_q;
120  PosType cosPA,sinPA;
121 };
122 
123 #endif /* GALAXIES_SERSIC_H_ */
Source::setRadius
void setRadius(PosType my_radius)
Reset the radius of the source in radians.
Definition: source.h:105
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:53
SourceSersic::getReff
PosType getReff() const
in arcseconds
Definition: sersic_source.h:58
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:120
InputParams
Structure for reading and writing parameters to and from a parameter file as well as a container for ...
Definition: InputParams.h:99