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 }
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
155{
156public:
157 //SourceOverzierPlus();
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
176 PosType my_mag
177 ,PosType my_mag_bulge
178 ,Band band
179 ,PosType mag_zero_point
180 ,PosType my_Reff
181 ,PosType my_Rdisk
182 ,PosType my_PA
183 ,PosType inclination
184 ,unsigned long my_id
185 ,PosType my_z
186 ,const PosType *theta
188);
189
190
192
194 SourceOverzierPlus & operator=(const SourceOverzierPlus &p);
195
196 //*** meed to be able to change band
197 //*** put modes and phases into surface brightness
198 //*** possible put gaussian texture on disk
199
200 PosType SurfaceBrightness(const PosType *y) const;
201
203 void setMag(PosType my_mag,Band band,double zeropoint){
204 current.mag_map[band] = my_mag;
205 original.mag_map[band] = my_mag;
206 zeropoints[band] = zeropoint;
207 }
209 void setMagBulge(PosType my_mag,Band band,double zeropoint){
210 current.bulge_mag_map[band] = my_mag;
211 original.bulge_mag_map[band] = my_mag;
212 zeropoints[band] = zeropoint;
213 spheroid.setMag(my_mag,band,zeropoint);
214 }
215
217 PosType getPA() const { return PA; }
218 void setPA(double pa); // in radians
219
220 int getNarms() const {return Narms;}
221 PosType getArmAmplitude() const {return Ad;}
222 PosType getArmAlpha() const {return arm_alpha;}
223 PosType getSphIndex() const {return spheroid.getSersicIndex();}
224 PosType getSphAxisRatio() const {return spheroid.getAxesRatio();}
225 //PosType getSphPA() const {return spheroid.getPA();}
226
227 void changeBand(Band band);
228 static PosType* getx(SourceOverzierPlus &sourceo){return sourceo.source_x.x;}
229
231 virtual inline void setTheta(PosType *xx){
232 source_x[0] = xx[0];
233 source_x[1] = xx[1];
234 }
235 virtual void setTheta(PosType my_x,PosType my_y){
236 source_x[0] = my_x;
237 source_x[1] = my_y;
238 }
239 virtual void setTheta(const Point_2d &p){
240 source_x = p;
241 }
242 void setBulgeAxisRatio(PosType q){
243 spheroid.setAxesRatio(q);
244 }
245 void setBulgeSersicIndex(double index){
246 spheroid.setSersicIndex(index);
247 }
250private:
251 int Narms;
252 PosType Ad,mctalpha,arm_alpha;
253 SourceSersic spheroid;
254 std::vector<PosType> modes;
255 PosType disk_phase;
256 PosType cosPA,sinPA,cosi,PA;
257
258 SourceOverzier::Params original; // original parameters
259};
260#endif /* GALAXIES_OVERZIER_H_ */
Band
Photometric bands.
Definition InputParams.h:79
Structure for reading and writing parameters to and from a parameter file as well as a container for ...
Definition InputParams.h:99
Base class for all sources.
Definition source.h:44
Point_2d source_x
center of source
Definition source.h:173
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
Adds some extra features to the SourceOverzier source like spiral arms, and randomizations.
Definition overzier_source.h:155
void randomize(Utilities::RandomNumbers_NR &ran)
Randomly change some of the internal paramters and angles of the source.
Definition overzier.cpp:414
void setMagBulge(PosType my_mag, Band band, double zeropoint)
magnitude in specific band
Definition overzier_source.h:209
virtual void setTheta(PosType *xx)
Reset the position of the source in radians.
Definition overzier_source.h:231
PosType getPA() const
position angle in radians
Definition overzier_source.h:217
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:234
void changeBand(Band band)
change the working band
Definition overzier.cpp:401
void setMag(PosType my_mag, Band band, double zeropoint)
magnitude in specific band
Definition overzier_source.h:203
PosType SurfaceBrightness(const PosType *y) const
Surface brightness in erg/cm^2/sec/rad^2/Hz.
Definition overzier.cpp:337
Class for sources described by a Sersic profile.
Definition sersic_source.h:21
This is a class for generating random numbers. It simplifies and fool proofs initialization and allow...
Definition utilities_slsim.h:1059
Class for representing points or vectors in 2 dimensions. Not that the dereferencing operator is over...
Definition point.h:48