GLAMERDOC++
Gravitational Lensing Code Library
Loading...
Searching...
No Matches
overzier_source.h
1/*
2 * overzier_source.h
3 *
4 * Created on: Mar 6, 2010
5 * Author: R.B. Metcalf
6 */
7#ifndef OVERZIER_SOURCE_H_
8#define OVERZIER_SOURCE_H_
9
10#include "source.h"
11#include "sersic_source.h"
12
13// define PI here if not done via include
14#ifndef PI
15#define PI 3.141592653589793238462643383279502884
16#endif
17
22class SourceOverzier : public Source
23{
24public:
25 //SourceOverzier();
26 SourceOverzier(PosType mag,PosType mag_bulge,Band band,double zero_point,PosType Reff,PosType Rdisk,PosType PA,PosType inclination,unsigned long my_id,PosType my_z,const PosType *theta);
27
29 SourceOverzier& operator=(const SourceOverzier &s);
30 virtual ~SourceOverzier();
31
32 void setInternals(PosType mag,PosType mag_bulge,Band band,PosType Reff,PosType Rdisk,PosType PA,PosType inclination,unsigned long my_id,PosType my_z,const PosType *my_theta);
33 virtual PosType SurfaceBrightness(const PosType *x) const;
34 PosType getTotalFlux() const;
35 void printSource();
36
38 PosType getMag() const { return current.mag; }
39 PosType getMag(Band band) const ;
40 PosType getMagBulge() const { return current.mag_bulge; }
41 PosType getMagBulge(Band band) const;
42
43 /*
45 void setUMag(PosType m) { mag_u = m; }
47 void setGMag(PosType m) { mag_g = m; }
49 void setRMag(PosType m) { mag_r = m; }
51 void setIMag(PosType m) { mag_i = m; }
53 void setZMag(PosType m) { mag_z = m; }
55 void setJMag(PosType m) { mag_J = m; }
57 void setHMag(PosType m) { mag_H = m; }
59 void setKMag(PosType m) { mag_Ks = m; }
60 */
61
63 virtual void setMag(PosType my_mag,Band band,PosType zero_point){
64 current.mag_map[band] = my_mag;
65 zeropoints[band] = zero_point;
66 }
67
68 virtual void setMagBulge(PosType my_mag,Band band,PosType zero_point){
69 current.bulge_mag_map[band] = my_mag;
70 zeropoints[band] = zero_point;
71 }
72
74 PosType getReff() const { return current.Reff/arcsecTOradians; }
76 PosType getRdisk() const { return current.Rdisk/arcsecTOradians; }
77
79 PosType getBtoT() const { return pow(10,(-current.mag_bulge + current.mag)/2.5); }
81 PosType getPA() const { return current.PA; }
83 PosType getInclination() const { return current.inclination;}
84 float getSEDtype() const {return sedtype;}
85 void setSEDtype(float s){ sedtype = s;}
86
88 virtual void changeBand(Band band);
89
93 inline PosType getMinSize(PosType f) {return std::min(1.678*current.Reff*fabs(cos(current.inclination))*pow(-log (f)/7.67,4),current.Rdisk*(-log (f)/1.67));}
94
95 static PosType *getx(SourceOverzier &sourceo){return sourceo.source_x.x;}
96
97protected:
98
99 SourceSersic spheroid;
100 static std::map<Band,PosType> zeropoints;
101
102 float sedtype = -1;
103 // renormalize the disk and bulge to agree with current mag and mag_bulge
104 void renormalize_current();
105 void assignParams(InputParams& params);
106
107 struct Params{
108
110 PosType Reff=0;
112 PosType Rdisk=0;
113
114 //PosType BtoT;
115 PosType PA=0;
116 PosType inclination=0;
117
118 double cosPA;
119 double sinPA;
120
121 PosType cxx=0,cyy=0;
122 PosType sbDo=0;
123 PosType mag=0;
124 PosType mag_bulge=0;
125
126 // colors
127 std::map<Band,double> mag_map;
128 std::map<Band,double> bulge_mag_map;
129 Band band;
130
131 void print(){
133 std::cout << "Reff :" << Reff/arcsecTOradians << " arcsec ";
134 std::cout << "Rdisk :" << Rdisk/arcsecTOradians << " arcsec ";
135 std::cout << "PA :" << PA << " ";
136 std::cout << "inclination :" << inclination << " radians";
137 std::cout << "sbDo :" << sbDo << " ";
138 std::cout << "mag :" << mag << " ";
139 std::cout << "mag_bulge :" << mag_bulge << " ";
140
141 std::cout << "BtoT :" << pow(10,(-mag_bulge + mag)/2.5) << std::endl;
142 }
143 };
144
145 Params current;
146 // optional position variables
147};
148
153
155{
156public:
157
159 PosType my_mag
160 ,PosType my_mag_bulge
161 ,Band band
162 ,PosType mag_zero_point
163 ,PosType my_Reff
164 ,PosType my_bulge_q
165 ,PosType my_bulge_index
166 ,PosType my_Rdisk
167 ,PosType my_PA
168 ,PosType inclination
169 ,unsigned long my_id
170 ,PosType my_z
171 ,const PosType *theta
173 );
174
177 PosType my_mag
178 ,PosType my_mag_bulge
179 ,Band band
180 ,PosType mag_zero_point
181 ,PosType my_Reff
182 ,PosType my_Rdisk
183 ,PosType my_PA
184 ,PosType inclination
185 ,unsigned long my_id
186 ,PosType my_z
187 ,const PosType *theta
188 ,PosType my_sersic_index_max
189 ,PosType my_sersic_index_min
191);
192
193
195
197 SourceOverzierPlus & operator=(const SourceOverzierPlus &p);
198
199 //*** meed to be able to change band
200 //*** put modes and phases into surface brightness
201 //*** possible put gaussian texture on disk
202
203 PosType SurfaceBrightness(const PosType *y) const;
204
206 void setMag(PosType my_mag,Band band,double zeropoint){
207 current.mag_map[band] = my_mag;
208 original.mag_map[band] = my_mag;
209 zeropoints[band] = zeropoint;
210 }
211
212 void setMagBulge(PosType my_mag,Band band,double zeropoint){
213 current.bulge_mag_map[band] = my_mag;
214 original.bulge_mag_map[band] = my_mag;
215 zeropoints[band] = zeropoint;
216 spheroid.setMag(my_mag,band,zeropoint);
217 }
218
220 PosType getPA() const { return PA; }
221 void setPA(double pa); // in radians
222
223 int getNarms() const {return Narms;}
224 PosType getArmAmplitude() const {return Ad;}
225 PosType getArmAlpha() const {return arm_alpha;}
226 PosType getSphIndex() const {return spheroid.getSersicIndex();}
227 PosType getSphAxisRatio() const {return spheroid.getAxesRatio();}
228 //PosType getSphPA() const {return spheroid.getPA();}
229
230 void changeBand(Band band);
231 static PosType* getx(SourceOverzierPlus &sourceo){return sourceo.source_x.x;}
232
234 virtual inline void setTheta(PosType *xx){
235 source_x[0] = xx[0];
236 source_x[1] = xx[1];
237 }
238 virtual void setTheta(PosType my_x,PosType my_y){
239 source_x[0] = my_x;
240 source_x[1] = my_y;
241 }
242 virtual void setTheta(const Point_2d &p){
243 source_x = p;
244 }
245 void setBulgeAxisRatio(PosType q){
246 spheroid.setAxesRatio(q);
247 }
248 void setBulgeSersicIndex(double index){
249 spheroid.setSersicIndex(index);
250 }
252 void randomize(Utilities::RandomNumbers_NR &ran);
253private:
254 int Narms;
255 PosType Ad,mctalpha,arm_alpha;
256 SourceSersic spheroid;
257 std::vector<PosType> modes;
258 PosType disk_phase;
259 PosType cosPA,sinPA,cosi,PA;
260
261 SourceOverzier::Params original; // original parameters
262
263 PosType sersic_index_max;
264 PosType sersic_index_min;
265};
266#endif /* GALAXIES_OVERZIER_H_ */
Band
Photometric bands.
Definition InputParams.h:79
Point_2d source_x
center of source
Definition source.h:173
Source(PosType r, Point_2d x, PosType z, PosType SBlimit, PosType zero_point)
shell constructor
Definition source.h:48
Structure for holding parameters for one or more galaxy images according to the Overzier model.
Definition overzier_source.h:23
PosType getPA() const
position angle in radians
Definition overzier_source.h:81
virtual void setMag(PosType my_mag, Band band, PosType zero_point)
magnitude in specific band
Definition overzier_source.h:63
PosType getMinSize(PosType f)
Definition overzier_source.h:93
void setInternals(PosType mag, PosType mag_bulge, Band band, PosType Reff, PosType Rdisk, PosType PA, PosType inclination, unsigned long my_id, PosType my_z, const PosType *my_theta)
Sets internal variables. If default constructor is used this must be called before the surface bright...
Definition overzier.cpp:69
SourceOverzier(PosType mag, PosType mag_bulge, Band band, double zero_point, PosType Reff, PosType Rdisk, PosType PA, PosType inclination, unsigned long my_id, PosType my_z, const PosType *theta)
Definition overzier.cpp:14
PosType getInclination() const
inclination in radians
Definition overzier_source.h:83
PosType getReff() const
bulge half light radius in arcseconds
Definition overzier_source.h:74
virtual void setMagBulge(PosType my_mag, Band band, PosType zero_point)
magnitude in specific band
Definition overzier_source.h:68
virtual void changeBand(Band band)
change the working band
Definition overzier.cpp:160
PosType getMag() const
get magnitude of whole galaxy. Which band this is in depends on which was passed in the constructor
Definition overzier_source.h:38
PosType getRdisk() const
disk scale height in arcseconds
Definition overzier_source.h:76
PosType getBtoT() const
the bulge to total flux ratio
Definition overzier_source.h:79
virtual PosType SurfaceBrightness(const PosType *x) const
Surface brightness in erg/cm^2/sec/rad^2/Hz.
Definition overzier.cpp:113
void randomize(Utilities::RandomNumbers_NR &ran)
Randomly change some of the internal paramters and angles of the source.
Definition overzier.cpp:413
void setMagBulge(PosType my_mag, Band band, double zeropoint)
magnitude in specific band
Definition overzier_source.h:212
virtual void setTheta(PosType *xx)
Reset the position of the source in radians.
Definition overzier_source.h:234
PosType getPA() const
position angle in radians
Definition overzier_source.h:220
SourceOverzierPlus(PosType my_mag, PosType my_mag_bulge, Band band, PosType mag_zero_point, PosType my_Reff, PosType my_bulge_q, PosType my_bulge_index, PosType my_Rdisk, PosType my_PA, PosType inclination, unsigned long my_id, PosType my_z, const PosType *theta, Utilities::RandomNumbers_NR &ran)
Definition overzier.cpp:232
void changeBand(Band band)
change the working band
Definition overzier.cpp:400
void setMag(PosType my_mag, Band band, double zeropoint)
magnitude in specific band
Definition overzier_source.h:206
PosType SurfaceBrightness(const PosType *y) const
Surface brightness in erg/cm^2/sec/rad^2/Hz.
Definition overzier.cpp:336
This is a class for generating random numbers. It simplifies and fool proofs initialization and allow...
Definition utilities_slsim.h:1059