GLAMERDOC++
Gravitational Lensing Code Library
analytic_lens.h
1 /*
2  * nsie.h
3  *
4  * Created on: Dec 8, 2009
5  * Author: R.B. Metcalf
6  */
7 
8 #ifndef analens_declare
9 #define analens_declare
10 
11 #include "Tree.h"
12 #include "source.h"
13 #include "base_analens.h"
14 
19 // TODO: BEN finish this documentation for perturbation parameters.
20 class LensHaloFit : public LensHaloBaseNSIE{
21 
22  void abstractfunction(){}; // pure virtual
23 
24 public:
25  //LensHaloAnaNSIE(InputParams& params,bool verbose = false);
27  LensHaloFit(const COSMOLOGY& cosmo, int MyNmodes, PosType beta,PosType zlensref, PosType zsourceref);
28  ~LensHaloFit();
29 
30  void PrintLens(bool show_substruct,bool show_stars);
31 
32  void FindLensSimple(int Nimages,Point *image_positions,double *y,double **dx_sub);
33  bool SafeFindLensSimple(int Nimages,Point *image_positions,double *y,double **dx_sub,int SafetyNum,PosType PixelSizeRad,std::vector<std::vector<PosType>> & PrecisionBackTracedPos,std::vector<std::vector<PosType>> & alphaTab,bool verbose);
34  void FindLensSimple(ImageInfo *imageinfo ,int Nimages ,double *y,double **dx_sub);
35 
36  // these need to be written so that they translate between modes and these quantities
38  virtual PosType get_sigma(){return 0.0;};
40  virtual PosType get_fratio(){return 0.0;};
42  virtual PosType get_pa(){return 0.0;};
44  virtual PosType get_rcore(){return 0.0;};
45 
46 
48  void setNmodes(int my_Nmodes){perturb_Nmodes = my_Nmodes;};
49 
51  int getNmodes(){return perturb_Nmodes;};
53  void set_perturbmodes(PosType * ListModes, const int Nmodes);
55  void get_perturbmodes(PosType * ListModes, const int Nmodes);
56  void get_perturbmodes(std::vector<PosType> & ListModes);
58  double * getq() { return qpriv; };
59 
61  void set_sigma(PosType my_sigma){sigma = my_sigma; };
62 
63 private:
64 
65  // Things added to manipulate and fit lenses.
66  int check_model(int Nimages,int Nsources,int Nlenses,int *pairing,double **xob,double *x_center
67  ,int Nmod,double *mod,double **xg,double Re2,double **dx_sub,double **Amag,double ytol);
68  double find_axis(double *mod,int Nmod);
69  double deflect_translated(double beta,double *mod,double *x,double *y,double *mag,int N
70  ,int Nlenses,double Re2,double *x2);
71  double ElliptisizeLens(int Nimages,int Nsources,int Nlenses,int *pairing,double **xob
72  ,double *xc,double **xg,double sigG,double beta,int Nmod
73  ,double *mod,double **dx,double *re2,double *q);
74  void setCosmology(const COSMOLOGY& cosmo);
75  // output of ElliptisizeLens
76  double qpriv[7];
77 
78  //void find_lens(int Nimages,int Nsources,int *pairing,double **xob,double *xg,double beta
79  // ,int N,int *degen,double *mod,double **v,double **dx);
80 
81  //void assignParams(InputParams& params);
82 
83  // Copied from lens_expand.c
84  double lens_expand(double beta,double *mod,int Nmodes,PosType const *x,PosType *alpha,KappaType *gamma,KappaType *phi);
85 };
86 
132 // TODO: BEN finish this documentation for perturbation parameters.
133 class LensHaloAnaNSIE : public LensHaloBaseNSIE{
134 
135  void abstractfunction(){}; // pure virtual
136 
137 public:
138  //LensHaloAnaNSIE(InputParams& params,const COSMOLOGY &cosmo,bool verbose = false);
140  //LensHaloAnaNSIE(const COSMOLOGY& cosmo);
142 
143  void assignParams(InputParams& params);
144  //double FractionWithinRe(double rangeInRei);
145  void PrintLens(bool show_substruct,bool show_stars);
146 
147  void setCosmology(const COSMOLOGY& cosmo);
148 
149  // in randoimize_lens.c
150  void RandomizeHost(long *seed,bool tables);
151  void RandomizeSigma(long *seed,bool tables);
152  void RandomlyDistortLens(long *seed,int Nmodes);
153  void AlignedRandomlyDistortLens(long *seed,double theta,int n);
154  //void RandomizeSubstructure(double rangeInRei,long *seed);
155  //void RandomizeSubstructure2(double rangeInRei,long *seed);
156  //void RandomizeSubstructure3(double rangeInRei,long *seed);
157 
159  virtual PosType get_sigma(){return sigma;};
161  //PosType getRsize(){return Rsize;};
163  virtual PosType get_fratio(){return fratio;};
165  virtual PosType get_pa(){return pa;};
167  virtual PosType get_rcore(){return rcore;};
168 
169 
170 private:
171 
172  // Things added to manipulate and fit lenses.
173  int check_model(int Nimages,int Nsources,int Nlenses,int *pairing,double **xob,double *x_center
174  ,int Nmod,double *mod,double **xg,double Re2,double **dx_sub,double **Amag,double ytol);
175  double find_axis(double *mod,int Nmod);
176  double deflect_translated(double beta,double *mod,double *x,double *y,double *mag,int N
177  ,int Nlenses,double Re2,double *x2);
178 
179 };
180 
181 
182 // in mark_points.c
183 void MarkPoints(TreeHndl s_tree,LensHaloAnaNSIE *lens,bool sb_cut,short invert);
184 void _MarkPoints(TreeHndl s_tree,LensHaloAnaNSIE *lens,bool *sbcut);
185 bool InSource(double *ray,LensHaloAnaNSIE *lens,bool surfacebright);
186 
187 
188 #endif
LensHaloAnaNSIE::AlignedRandomlyDistortLens
void AlignedRandomlyDistortLens(long *seed, double theta, int n)
Definition: randomize_lens.cpp:158
LensHaloAnaNSIE::RandomlyDistortLens
void RandomlyDistortLens(long *seed, int Nmodes)
Definition: randomize_lens.cpp:104
LensHaloAnaNSIE::assignParams
void assignParams(InputParams &params)
Reads in a parameter file and sets up an analytic lens.
Definition: readfiles_ana.cpp:22
LensHaloFit::FindLensSimple
void FindLensSimple(int Nimages, Point *image_positions, double *y, double **dx_sub)
Wrapper that allows simple lens to be found with a single lens with a single source and translates re...
Definition: fitlens.cpp:22
LensHaloAnaNSIE::get_sigma
virtual PosType get_sigma()
get the velocity dispersion
Definition: analytic_lens.h:159
LensHaloFit::SafeFindLensSimple
bool SafeFindLensSimple(int Nimages, Point *image_positions, double *y, double **dx_sub, int SafetyNum, PosType PixelSizeRad, std::vector< std::vector< PosType >> &PrecisionBackTracedPos, std::vector< std::vector< PosType >> &alphaTab, bool verbose)
Same as FindLensSimple but with some tests in it.
Definition: fitlens.cpp:54
LensHaloFit::set_sigma
void set_sigma(PosType my_sigma)
set the velocity dispersion
Definition: analytic_lens.h:61
LensHaloAnaNSIE::get_pa
virtual PosType get_pa()
get the position angle
Definition: analytic_lens.h:165
LensHaloAnaNSIE
A NSIE lens with distortions in shape, substructures and stars included.
Definition: analytic_lens.h:133
LensHaloFit::getq
double * getq()
get the ouput of ElliptisizeLens :
Definition: analytic_lens.h:58
LensHaloFit::get_pa
virtual PosType get_pa()
get the position angle
Definition: analytic_lens.h:42
TreeStruct
Tree: Exported struct.
Definition: Tree.h:31
LensHaloFit
LensHalo class primarily used for fitting point source lenses.
Definition: analytic_lens.h:20
LensHaloFit::get_fratio
virtual PosType get_fratio()
get the axis ratio
Definition: analytic_lens.h:40
LensHaloFit::get_rcore
virtual PosType get_rcore()
get the core radius
Definition: analytic_lens.h:44
LensHaloFit::LensHaloFit
LensHaloFit(const COSMOLOGY &cosmo, int MyNmodes, PosType beta, PosType zlensref, PosType zsourceref)
Creates a AnaLens which initially has no mass, Use FindLensSimple() to give it mass.
Definition: readfiles_ana.cpp:115
LensHaloAnaNSIE::setCosmology
void setCosmology(const COSMOLOGY &cosmo)
Sets parameters within BaseLens that depend on the source redshift - Dl,Sigma_crit,...
Definition: base_analens.cpp:248
LensHaloAnaNSIE::~LensHaloAnaNSIE
~LensHaloAnaNSIE()
Creates a AnaLens which initially has no mass, Use FindLensSimple() to give it mass.
Definition: readfiles_ana.cpp:111
LensHaloFit::get_sigma
virtual PosType get_sigma()
get the velocity dispersion
Definition: analytic_lens.h:38
LensHaloFit::set_perturbmodes
void set_perturbmodes(PosType *ListModes, const int Nmodes)
set the perturbation modes
Definition: fitlens.cpp:882
Point
A point on the source or image plane that contains a position and the lensing quantities.
Definition: point.h:459
LensHaloAnaNSIE::get_fratio
virtual PosType get_fratio()
get the NSIE radius
Definition: analytic_lens.h:163
LensHaloFit::getNmodes
int getNmodes()
get the number of perturbation modes
Definition: analytic_lens.h:51
InputParams
Structure for reading and writing parameters to and from a parameter file as well as a container for ...
Definition: InputParams.h:99
LensHaloFit::setNmodes
void setNmodes(int my_Nmodes)
set the number of perturbation modes – Does the same as LensHaloBaseNSIE::getPerturb_Nmodes().
Definition: analytic_lens.h:48
ImageInfo
Structure for storing information about images or curves.
Definition: image_info.h:20
LensHaloAnaNSIE::get_rcore
virtual PosType get_rcore()
get the core radius
Definition: analytic_lens.h:167
LensHaloFit::get_perturbmodes
void get_perturbmodes(PosType *ListModes, const int Nmodes)
get the perturbation modes
Definition: fitlens.cpp:893