16#include "image_processing.h" 
   25#include <eigen3/Eigen/Dense> 
   26#include <eigen3/Eigen/StdVector> 
   27#include <boost/math/special_functions/gamma.hpp> 
   81  inline float getRsize()
 const { 
return Rsize; }
 
   87 inline PosType 
getZlens()
 const { 
return zlens; }
 
   95  void getX(PosType * MyPosHalo)
 const {
 
   97    MyPosHalo[0] = posHalo[0]*Dist;
 
   98    MyPosHalo[1] = posHalo[1]*Dist;
 
 
  105  void setTheta(PosType PosX, PosType PosY) { posHalo[0] = PosX ; posHalo[1] = PosY ; }
 
  107  void setTheta(PosType *PosXY) { posHalo[0] = PosXY[0] ; posHalo[1] = PosXY[1] ; }
 
  111  void getTheta(PosType * MyPosHalo)
 const { MyPosHalo[0] = posHalo[0] ; MyPosHalo[1] = posHalo[1]; }
 
  122  void displayPos() { std::cout << 
"Halo PosX = " << posHalo[0] << 
" ; Halo PosY = " << posHalo[1] << std::endl; }
 
  125 virtual void initFromFile(
float my_mass, 
long *seed, 
float vmax, 
float r_halfmass){};
 
  127 virtual void initFromMassFunc(
float my_mass, 
float my_Rsize, 
float my_rscale, PosType my_slope, 
long *seed);
 
  130  virtual void set_RsizeRmax(
float my_Rsize){Rmax = Rmax*my_Rsize/Rsize; Rsize = my_Rsize; xmax = Rsize/
rscale;};
 
  141  void setRsize(PosType R){Rsize = R;}
 
  144  void setZlensDist(PosType my_zlens,
const COSMOLOGY &cos){
 
  148  void setMass(PosType m){mass = m;}
 
  152 virtual void set_slope(PosType my_slope){beta=my_slope;};
 
  157  void set_flag_elliptical(
bool ell){elliptical_flag=ell;};
 
  158  bool get_switch_flag(){
return switch_flag;}; 
 
  188      ,
bool subtract_point=
false  
  189      ,PosType screening=1.0   
 
  213  std::vector<double> 
get_mod() { std::vector<double> fmodes(Nmod); 
for(
int i=0;i<Nmod;i++){fmodes[i]= mod[i] ;}  ;
return fmodes;}
 
  218 virtual std::size_t 
Nparams() 
const;
 
  220 virtual PosType 
getParam(std::size_t p) 
const;
 
  222 virtual PosType 
setParam(std::size_t p, PosType value);
 
  225 virtual void printCSV(std::ostream&, 
bool header = 
false) 
const;
 
  233  PosType test_average_kappa(PosType R);
 
  241 float get_rsize(){
return Rsize;};
 
  248  size_t getID()
 const {
return idnumber;}
 
  249  void setID(
size_t id){idnumber = id;}
 
  251  PosType renormalization(PosType r_max);
 
  295  PosType norm_int(PosType r_max);
 
  297  void force_halo_sym(PosType *alpha,KappaType *kappa,KappaType *gamma,KappaType *phi,PosType 
const *xcm,
bool subtract_point=
false,PosType screening = 1.0);
 
  298  void force_halo_asym(PosType *alpha,KappaType *kappa,KappaType *gamma,KappaType *phi,PosType 
const *xcm,
bool subtract_point=
false,PosType screening = 1.0);
 
  300  bool force_point(PosType *alpha,KappaType *kappa,KappaType *gamma
 
  301                   ,KappaType *phi,PosType 
const *xcm,PosType rcm2
 
  302                   ,
bool subtract_point,PosType screening);
 
  305    norm_func(
LensHalo& halo, PosType my_r_max): halo(halo), r_max(my_r_max){};
 
  309    PosType operator ()(PosType theta) {
return halo.alpha_ell(r_max, theta);}
 
  313    Ialpha_func(
LensHalo& halo): halo(halo){};
 
  315    PosType operator ()(PosType x) {
return halo.alpha_h(x)/x ;}
 
  319    Ig_func(
const LensHalo& halo): halo(halo){};
 
  321    PosType operator ()(PosType x) {
return halo.gfunction(x)/x ;}
 
  377  virtual PosType 
inline alpha_h(PosType x)
 const {
return -1;};
 
  378  virtual KappaType 
inline kappa_h(PosType x)
 const {
return 0;};
 
  379  virtual KappaType 
inline gamma_h(PosType x)
 const {
return -2;};
 
  380  virtual KappaType 
inline phi_h(PosType x)
 const {
return 1;};
 
  381  virtual KappaType 
inline phi_int(PosType x)
 const {
return 1;};
 
  382  virtual PosType 
inline ffunction(PosType x)
const {
return 0;};
 
  383  virtual PosType 
inline gfunction(PosType x)
 const {
return -1;};
 
  384  virtual PosType 
inline dgfunctiondx(PosType x){
return 0;};
 
  385  virtual PosType 
inline bfunction(PosType x){
return -1;};
 
  386  virtual PosType 
inline dhfunction(PosType x)
 const {
return 1;};
 
  387  virtual PosType 
inline ddhfunction(PosType x, 
bool numerical){
return 0;};
 
  388  virtual PosType 
inline dddhfunction(PosType x, 
bool numerical){
return 0;};
 
  389  virtual PosType 
inline bnumfunction(PosType x){
return -1;};
 
  390  virtual PosType 
inline dbfunction(PosType x){
return 0;};
 
  391  virtual PosType 
inline ddbfunction(PosType x){
return 0;};
 
  392  virtual PosType 
inline dmoddb(
int whichmod, PosType q, PosType b){
return 0;};
 
  393  virtual PosType 
inline ddmoddb(
int whichmod, PosType q, PosType b){
return 0;};
 
  394  virtual PosType 
inline dmoddq(
int whichmod, PosType q, PosType b){
return 0;};
 
  395  virtual PosType 
inline ddmoddq(
int whichmod, PosType q, PosType b){
return 0;};
 
  404  bool elliptical_flag = 
false;
 
  405  bool switch_flag = 
false; 
 
  408  void faxial(PosType x,PosType theta,PosType f[]);
 
  409  void faxial0(PosType theta,PosType f0[]);
 
  410  void faxial1(PosType theta,PosType f1[]);
 
  411  void faxial2(PosType theta,PosType f2[]);
 
  412  void gradial(PosType r,PosType g[]);
 
  413  void gradial2(PosType r,PosType mu, PosType sigma,PosType g[]);
 
  415  void felliptical(PosType x, PosType q, PosType theta, PosType f[], PosType g[]);
 
  417  virtual void gamma_asym(PosType x,PosType theta, PosType gamma[]);
 
  418  virtual PosType 
kappa_asym(PosType x,PosType theta);
 
  420                                    ,PosType *kappa,PosType gamma[],PosType *phi);
 
  422                                    ,PosType *kappa,PosType gamma[],PosType *phi);
 
  423  virtual void alphakappagamma2asym(PosType x,PosType theta, PosType alpha[2]
 
  424                                    ,PosType *kappa,PosType gamma[],PosType *phi);
 
  425  virtual void alphakappagamma3asym(PosType x,PosType theta, PosType alpha[2]
 
  426                                    ,PosType *kappa,PosType gamma[],PosType *phi);
 
  428  virtual PosType alpha_ell(PosType x,PosType theta);
 
  431  double IDAXDM(
double lambda, 
double a2, 
double b2, 
double x[], 
double rmax, 
double mo);
 
  432  double IDAYDM(
double lambda, 
double a2, 
double b2, 
double x[], 
double rmax, 
double mo);
 
  433  double SCHRAMMKN(
double n, 
double x[], 
double rmax);
 
  434  double SCHRAMMJN(
double n, 
double x[], 
double rmax);
 
  435  double SCHRAMMI(
double x[], 
double rmax);
 
  438  void calcModes(
double q, 
double beta, 
double rottheta, PosType newmod[]);
 
  439  void calcModesB(PosType x, 
double q, 
double beta, 
double rottheta, PosType newmod[]);
 
  440  void calcModesC(PosType beta_r, 
double q, 
double rottheta, PosType newmod[]);
 
  442  virtual PosType 
inline InterpolateModes(
int whichmod, PosType q, PosType b){
return 0;};
 
  444  void analModes(
int modnumber, PosType my_beta, PosType q, PosType amod[3]);
 
  447    fourier_func(
double my_n, 
double my_q, 
double my_beta): n(my_n),q(my_q),beta(my_beta){};
 
  451    double operator ()(
double theta) {
return cos(n*theta)/pow(cos(theta)*cos(theta) + 1/q/q*sin(theta)*sin(theta),beta/2) ;}
 
  454  struct SCHRAMMJ_func{
 
  455    SCHRAMMJ_func(
double my_n, 
double my_x[], 
double my_rmax, 
LensHalo *my_halo): n(my_n), x(my_x), rmx(my_rmax), halo(my_halo){};
 
  457    double operator ()(
double u) {
 
  460      PosType xisq=sqrt((x[0]*x[0]+x[1]*x[1]/(1-u*(1-halo->fratio*halo->fratio))));
 
  462      if(xisq*xisq < 1e-20) xisq = 1.0e-10;
 
  463      KappaType kappa=halo->kappa_h(xisq)/PI/xisq/xisq;
 
  465      return kappa*halo->mass/pow((1.-(1.-halo->fratio*halo->fratio)*u),n+0.5);
 
  471  struct SCHRAMMK_func{
 
  472    SCHRAMMK_func(
double my_n, 
double my_x[], 
double my_rmax, 
LensHalo *my_halo): n(my_n), x(my_x), rmx(my_rmax), halo(my_halo){};
 
  474    double operator ()(
double u) {
 
  477      PosType xisq=sqrt((x[0]*x[0]+x[1]*x[1]/(1-u*(1-halo->fratio*halo->fratio))));
 
  478      if(xisq*xisq < 1e-20) xisq = 1.0e-10;
 
  480      PosType kp1=halo->kappa_h(xisq+h)/((xisq+h)*(xisq+h));
 
  481      PosType km1=halo->kappa_h(xisq-h)/((xisq-h)*(xisq-h));
 
  482      PosType kp2=halo->kappa_h(xisq+2*h)/((xisq+2*h)*(xisq+2*h));
 
  483      PosType km2=halo->kappa_h(xisq-2*h)/((xisq-2*h)*(xisq-2*h));
 
  484      PosType dkdxi=(8*kp1-8*km1-kp2+km2)/12/h/PI;
 
  489      return u*dkdxi/pow((1.-(1.-halo->fratio*halo->fratio)*u),n+0.5);
 
  496  struct SCHRAMMI_func{
 
  497    SCHRAMMI_func(
double my_x[], 
double my_rmax, 
LensHalo *my_halo): x(my_x), rmx(my_rmax), halo(my_halo){};
 
  499    double operator ()(
double u) {
 
  502      PosType xisq=sqrt((x[0]*x[0]+x[1]*x[1]/(1-u*(1-halo->fratio*halo->fratio))));
 
  504      if(xisq*xisq < 1e-20) xisq = 1.0e-10;
 
  505      PosType alpha=halo->alpha_h(xisq)/PI/xisq;
 
  507      return xisq*alpha*halo->mass/pow((1.-(1.-halo->fratio*halo->fratio)*u),0.5);
 
  515    IDAXDM_func(
double my_lambda,
double my_a2, 
double my_b2, 
double my_x[], 
double my_rmax, 
LensHalo *my_halo): lambda(my_lambda), a2(my_a2), b2(my_b2), x(my_x), rmx(my_rmax), halo(my_halo){};
 
  516    double lambda, a2,b2, *x, rmx;
 
  517    double operator ()(
double m) {
 
  518      double ap = m*m*a2 + lambda,bp = m*m*b2 + lambda;
 
  519      double p2 = x[0]*x[0]/ap/ap/ap/ap + x[1]*x[1]/bp/bp/bp/bp;  
 
  521      if(tmp*tmp < 1e-20) tmp = 1.0e-10;
 
  522      PosType xiso=tmp/halo->rscale;
 
  523      KappaType kappa=halo->kappa_h(xiso)/PI/xiso/xiso;
 
  525      PosType alpha[2]={0,0},tm[2] = {m*rmx,0};
 
  526      KappaType kappam=0,gamma[2]={0,0},phi=0;
 
  527      halo->force_halo_sym(alpha,&kappam,gamma,&phi,tm);
 
  531      double integrandA=m*kappa/(ap*ap*ap*bp*p2)*halo->mass;
 
  532      double integrandB=m*kappam/(ap*ap*ap*bp*p2);
 
  534      assert( std::abs((integrandA - integrandB)/integrandA)<1E-5);
 
  536      assert(kappa >= 0.0);
 
  546    IDAYDM_func(
double my_lambda,
double my_a2, 
double my_b2, 
double my_x[], 
double my_rmax, 
LensHalo *my_halo): lambda(my_lambda), a2(my_a2), b2(my_b2), x(my_x), rmx(my_rmax), halo(my_halo){};
 
  547    double lambda, a2,b2, *x, rmx;
 
  548    double operator ()(
double m) {
 
  549      double ap = m*m*a2 + lambda,bp = m*m*b2 + lambda;
 
  550      double p2 = x[0]*x[0]/ap/ap/ap/ap + x[1]*x[1]/bp/bp/bp/bp;  
 
  552      if(tmp*tmp < 1e-20) tmp = 1.0e-10;
 
  553      PosType xiso=tmp/halo->rscale;
 
  554      KappaType kappa=halo->kappa_h(xiso)/PI/xiso/xiso;
 
  556      PosType alpha[2]={0,0},tm[2] = {m*rmx,0};
 
  557      KappaType kappam=0,gamma[2]={0,0},phi=0;
 
  558      halo->force_halo_sym(alpha,&kappam,gamma,&phi,tm);
 
  560      double integrandA=m*kappa/(ap*ap*ap*bp*p2)*halo->mass;
 
  561      double integrandB=m*kappam/(ap*bp*bp*bp*p2);
 
  562      assert( std::abs((integrandA - integrandB)/integrandA)<1E-5);
 
  564      assert(kappa >= 0.0);
 
  573  const static int Nmod = 32;
 
  598    test_gt_func(PosType my_r,
LensHalo *halo): r(my_r),halo(halo){};
 
  599    double operator ()(PosType t) {
 
  600      PosType alpha[2] = {0,0},x[2] = {0,0};
 
  601      KappaType kappa = 0,gamma[3] = {0,0,0},phi =0 ;
 
  604      halo->force_halo(alpha,&kappa,gamma,&phi,x);
 
  605      assert(gamma[0]==gamma[0]);
 
  606      assert(gamma[1]==gamma[1]);
 
  607       return (gamma[0]*cos(2*t)+gamma[1]*sin(2*t));}
 
  625  struct test_kappa_func{
 
  626    test_kappa_func(PosType my_r,
LensHalo *halo): r(my_r),halo(halo){};
 
  627    double operator ()(PosType t) {
 
  628      PosType alpha[2] = {0,0},x[2] = {0,0};
 
  629      KappaType kappa = 0,gamma[3] = {0,0,0},phi =0 ;
 
  632      halo->force_halo(alpha,&kappa,gamma,&phi,x);
 
  633      assert(kappa==kappa);
 
  641    DMDTHETA(PosType R,
LensHalo *halo): R(R),halo(halo){};
 
  642    PosType operator()(PosType theta){
 
  643      PosType alpha[2] = {0,0},x[2] = {0,0};
 
  644      KappaType kappa = 0,gamma[3] = {0,0,0},phi =0 ;
 
  649      halo->force_halo(alpha,&kappa,gamma,&phi,x);
 
  651      PosType alpha_r = -alpha[0]*cos(theta) - alpha[1]*sin(theta);
 
  653      assert( alpha_r == alpha_r );
 
  663    DMDRDTHETA(PosType R,
LensHalo *halo): R(R),halo(halo){};
 
  664    PosType operator()(PosType theta){
 
  666      PosType alpha[2] = {0,0},x[2] = {0,0};
 
  667      KappaType kappa = 0,gamma[3] = {0,0,0} ,phi=0;
 
  672      halo->force_halo(alpha,&kappa,gamma,&phi,x);
 
  673      assert(kappa == kappa);
 
  674      assert(kappa != INFINITY);
 
  684    PosType operator()(PosType logR){
 
  686        LensHalo::DMDRDTHETA dmdrdtheta(exp(logR),halo);
 
  689        if(exp(2*logR) == 0.0) 
return 0.0;
 
  690         return Utilities::nintegrate<LensHalo::DMDRDTHETA,PosType>(dmdrdtheta,0,2*PI,1.0e-7)
 
  709    DALPHAXDM(PosType lambda,PosType a2,PosType b2,PosType X[],
LensHalo* myisohalo)
 
  710    :lambda(lambda),a2(a2),b2(b2),x(X),isohalo(myisohalo){};
 
  712    PosType operator()(PosType m);
 
  721    DALPHAYDM(PosType lambda,PosType a2,PosType b2,PosType X[],
LensHalo* isohalo)
 
  722    :lambda(lambda),a2(a2),b2(b2),x(X),isohalo(isohalo){};
 
  724    PosType operator()(PosType m);
 
 
  752              ,
float my_concentration
 
  785 PosType ffunction(PosType x) 
const;
 
  786 PosType gfunction(PosType x) 
const;
 
  787  PosType dgfunctiondx(PosType x);
 
  788 PosType g2function(PosType x) 
const;
 
  789 PosType hfunction(PosType x) 
const;
 
  790  PosType dhfunction(PosType x) 
const;
 
  791  PosType ddhfunction(PosType x, 
bool numerical);
 
  792  PosType dddhfunction(PosType x, 
bool numerical);
 
  793  PosType bfunction(PosType x);
 
  794  PosType dbfunction(PosType x);
 
  795  PosType ddbfunction(PosType x);
 
  796  PosType 
dmoddb(
int whichmod, PosType q, PosType b);
 
  797  PosType ddmoddb(
int whichmod, PosType q, PosType b);
 
  798  PosType dmoddq(
int whichmod, PosType q, PosType b);
 
  799  PosType ddmoddq(
int whichmod, PosType q, PosType b);
 
  806 void alphaNFW(PosType *alpha,PosType *x,PosType Rtrunc,PosType mass,PosType r_scale
 
  807                ,PosType *center,PosType Sigma_crit);
 
  808 KappaType 
kappaNFW(PosType *x,PosType Rtrunc,PosType mass,PosType r_scale
 
  809                     ,PosType *center,PosType Sigma_crit);
 
  810 void gammaNFW(KappaType *gamma,PosType *x,PosType Rtrunc,PosType mass,PosType r_scale
 
  811                ,PosType *center,PosType Sigma_crit);
 
  813 void initFromFile(
float my_mass, 
long *seed, 
float vmax, 
float r_halfmass);
 
  814 void initFromMassFunc(
float my_mass, 
float my_Rsize, 
float my_rscale, PosType my_slope, 
long *seed);
 
  830 static PosType *
ftable,*gtable,*g2table,*htable,*xtable,*xgtable,***modtable; 
 
  835  PosType InterpolateModes(
int whichmod, PosType q, PosType b);
 
  847 inline KappaType kappa_h(PosType x)
 const{
 
  850 inline KappaType gamma_h(PosType x)
 const{
 
  854 inline KappaType phi_h(PosType x)
 const{
 
  858  inline KappaType phi_int(PosType x)
 const{
 
 
  884  LensHaloPseudoNFW(
float my_mass,
float my_Rsize,PosType my_zlens,
float my_rscale,PosType my_beta,
float my_fratio,
float my_pa,
const COSMOLOGY &cosmo, 
EllipMethod my_ellip_method=EllipMethod::Pseudo);
 
  888 PosType 
mhat(PosType y, PosType beta) 
const;
 
  889  PosType gfunction(PosType x) 
const;
 
  892 void set_slope(PosType my_slope){beta=my_slope; make_tables();};
 
  898 void initFromMassFunc(
float my_mass, 
float my_Rsize, 
float my_rscale, PosType my_slope, 
long *seed);
 
  902 static const long NTABLE;
 
  904 static const PosType maxrm;
 
  909 static PosType *mhattable,*xtable;
 
  913 PosType InterpolateFromTable(PosType y) 
const;
 
  923 inline PosType alpha_h(PosType x)
 const {
 
  924  return -1.0*InterpolateFromTable(x)/InterpolateFromTable(xmax);
 
  926 inline KappaType kappa_h(PosType x)
 const {
 
  927  return 0.5*x*x/InterpolateFromTable(xmax)/pow(1+x,beta);
 
  929 inline KappaType gamma_h(PosType x)
 const {
 
  931  return (x*x/pow(1+x,beta) - 2*InterpolateFromTable(x))/InterpolateFromTable(xmax);
 
  933 inline KappaType phi_h(PosType x)
 const {
 
  934  return -1.0*
alpha_int(x)/InterpolateFromTable(xmax) ;
 
  940    inline KappaType phi_int(PosType x)
 const{
 
  941        return -1.0*
alpha_int(x)/InterpolateFromTable(xmax) ;
 
 
  955  LensHaloPowerLaw(
float my_mass,
float my_Rsize,PosType my_zlens,PosType my_beta
 
  956                   ,
float my_fratio,
float my_pa,
const COSMOLOGY &cosmo
 
  968 void initFromMassFunc(
float my_mass, 
float my_Rsize, 
float my_rscale, PosType my_slope, 
long *seed);
 
  979 inline PosType alpha_h(
 
  982  if(x<xmax*1.0e-6) x=1e-6*xmax;
 
  983  return -1.0*pow(x/xmax,-beta+2);
 
  986 inline KappaType kappa_h(
 
  989  if(x==0) x=1e-6*xmax;
 
  991  return 0.5*(-beta+2)*pow(tmp,2-beta);
 
  994 inline KappaType gamma_h(PosType x)
 const {
 
  995  if(x==0) x=1e-6*xmax;
 
  996    return -beta*pow(x/xmax,-beta+2);
 
  999  inline KappaType phi_h(PosType x)
 const {
 
 1000  if(x==0) x=1e-6*xmax;
 
 1003  inline KappaType phi_int(PosType x)
 const{
 
 1005    return -1.0*pow(x/xmax,-beta+2)/(2-beta);
 
 
 1028                   ,
float my_rcore,
float my_fratio,
float my_pa,
const COSMOLOGY &cosmo);
 
 1045    if(&h == 
this) 
return *
this;
 
 1058 void force_halo(PosType *alpha,KappaType *kappa,KappaType *gamma,KappaType *phi,PosType 
const *xcm,
bool subtract_point=
false,PosType screening = 1.0);
 
 1082  void setZlens(PosType my_zlens,
const COSMOLOGY &cosmo){
 
 1091  static size_t objectCount;
 
 1092  static std::vector<double> q_table;
 
 1093  static std::vector<double> Fofq_table;
 
 1116  void construct_ellip_tables();
 
 1119    NormFuncer(
double my_q):q(my_q){};
 
 1121    double operator()(
double t){
 
 1122      return 1.0/sqrt( 1 + (q*q-1)*sin(t)*sin(t));
 
 
 1160    if(&h == 
this) 
return *
this;
 
 1175    return lightspeed*sqrt( Grav*mass*sqrt(
fratio) / (Rtrunc-Rcore) / PI);
 
 
 1179  void force_halo(PosType *alpha,KappaType *kappa,KappaType *gamma,KappaType *phi,PosType 
const *xcm,
bool subtract_point=
false,PosType screening = 1.0);
 
 1194  void setZlens(PosType my_zlens,
const COSMOLOGY &cosmo){
 
 
 1243    q_prime = h.q_prime;
 
 1246    mass_pi = h.mass_pi;
 
 1251    if(&h == 
this) 
return *
this;
 
 1257    q_prime = h.q_prime;
 
 1260    mass_pi = h.mass_pi;
 
 1270  void force_halo(PosType *alpha,KappaType *kappa,KappaType *gamma,KappaType *phi,PosType 
const *xcm,
bool subtract_point=
false,PosType screening = 1.0);
 
 1281  void set_pa(
double p){pa = p;}
 
 1283  void deflection(std::complex<double> &z
 
 1284                  ,std::complex<double> &a
 
 1285                  ,std::complex<double> &g
 
 1286                  ,KappaType &sigma) 
const;
 
 1299  std::complex<double> R; 
 
 1301  std::complex<double> F(
double r_e,
double t,std::complex<double> z) 
const;
 
 
 1307class LensHaloTEBPL : 
public LensHalo{
 
 1310  LensHaloTEBPL(
float my_mass  
 
 1318                ,
const COSMOLOGY &cosmo  
 
 1324  LensHaloTEBPL(
const LensHaloTEBPL &h):
 
 1325  LensHalo(h),h1(h.h1),h2(h.h2),h3(h.h3)
 
 1339  LensHaloTEBPL &operator=(
const LensHaloTEBPL &h){
 
 1340    if(&h == 
this) 
return *
this;
 
 1361  float get_fratio(){
return q;};
 
 1363  float get_pa(){
return pa;};
 
 1365  float get_rtrunc(){
return rt;};
 
 1367  float get_rbreak(){
return rb;};
 
 1369  float get_t1(){
return h1.get_t();}
 
 1371  float get_t2(){
return h2.get_t();}
 
 1373  void set_pa(
double p){pa = p;}
 
 1375  void force_halo(PosType *alpha,KappaType *kappa,KappaType *gamma,KappaType *phi,PosType 
const *xcm,
bool subtract_point=
false,PosType screening = 1.0);
 
 1391  std::complex<PosType> R;
 
 1402class LensHaloGaussian : 
public LensHalo{
 
 1405  LensHaloGaussian(
float my_mass  
 
 1410                ,
const COSMOLOGY &cosmo  
 
 1414  LensHaloGaussian(
const LensHaloGaussian &h):
 
 1419    q_prime = h.q_prime;
 
 1429    one_sqpi = h.one_sqpi;
 
 1432  LensHaloGaussian &operator=(
const LensHaloGaussian &h){
 
 1433    if(&h == 
this) 
return *
this;
 
 1438    q_prime = h.q_prime;
 
 1448    one_sqpi = h.one_sqpi;
 
 1453  ~LensHaloGaussian(){};
 
 1457  void force_halo(PosType *alpha,KappaType *kappa,KappaType *gamma,KappaType *phi,PosType 
const *xcm,
bool subtract_point=
false,PosType screening = 1.0);
 
 1460  float get_fratio(){
return q;};
 
 1462  float get_pa(){
return pa;};
 
 1464  float get_scalehight(){
return Rhight;};
 
 1467  float get_SigmaCentral(){
return SigmaO;};
 
 1469  void set_pa(
double p){pa = p;}
 
 1471  void deflection(std::complex<double> &z
 
 1472                  ,std::complex<double> &a
 
 1473                  ,std::complex<double> &g
 
 1474                  ,KappaType &sigma) 
const;
 
 1479  std::complex<double> dwdz(std::complex<double> z)
 const{
 
 1480    return 2.0*(I_sqpi - z*wF(z));
 
 1483  std::complex<double> wF(std::complex<double> z) 
const;
 
 1484  std::complex<double> my_erfc(std::complex<double> z) 
const;
 
 1503  std::complex<double> R; 
 
 1510  std::complex<double> erfi(std::complex<double> z)
 const{
 
 1511    return I*(1. - exp(z*z)*wF(z));
 
 1564  std::complex<double> I;
 
 1565  std::complex<double> I_sqpi;
 
 1577namespace MultiGauss{
 
 1580  virtual double operator()(
double r) = 0;
 
 1581  virtual double cum(
double r) = 0;
 
 1584struct POWERLAW : 
public PROFILE
 
 1590      std::cerr << 
"power-law index <= 2 give unbounded mass!" << std::endl;
 
 1591      throw std::runtime_error(
"bad mass");
 
 1595  double operator()(
double r){
return pow(r,gamma);}
 
 1596  double cum(
double r){
return 2*PI*pow(r,gamma + 2)/(gamma+2);}
 
 1598  void reset(
float g){gamma = g;}
 
 1602struct SERSIC : 
public PROFILE
 
 1604  SERSIC(){reset(0,0);}
 
 1605  SERSIC(
float nn,
float Re){
 
 1608  double cum(
double r){
 
 1609    return cum_norm * boost::math::tgamma_lower(2*n, bn*pow(r/re,t) );
 
 1611  double operator()(
double r){ 
 
 1612    return exp(-bn*pow(r/re,t) );
 
 1615  void reset(
float nn,
float Re){
 
 1618    bn = 1.9992*n - 0.3271;  
 
 1620    cum_norm = 2*PI*n/pow(bn,2*n)*re*re;
 
 1631struct NFW: 
public PROFILE
 
 1633  NFW(
float rs):rs(rs){
 
 1635  double cum(
double r){
 
 1638    double ans=log(x/2);
 
 1639    if(x==1.0) ans += 1.0;
 
 1640    if(x>1.0) ans += 2*atan(sqrt((x-1)/(x+1)))/sqrt(x*x-1);
 
 1641    if(x<1.0) ans += 2*atanh(sqrt((1-x)/(x+1)))/sqrt(1-x*x);
 
 1643    return 2*PI*rs*rs*ans;
 
 1645  double operator()(
double r){ 
 
 1648    if(x==1.0){
return 1.0/3.0;}
 
 1649    if(x>1.0) 
return (1-2*atan(sqrt((x-1)/(x+1)))/sqrt(x*x-1))/(x*x-1);
 
 1650    return (1-2*atanh(sqrt((1-x)/(x+1)))/sqrt(1-x*x))/(x*x-1);
 
 1653  void reset(
double Rs){rs = Rs;}
 
 1673class LensHaloMultiGauss: 
public LensHalo{
 
 1683  std::vector<double> sigmas;
 
 1684  std::vector<double> radii;
 
 1685  std::complex<double> Rotation;
 
 1686  std::vector<LensHaloGaussian> gaussians;
 
 1687  std::vector<double> A;
 
 1697                     ,MultiGauss::PROFILE &profile  
 
 1705                     ,
const COSMOLOGY &cosmo  
 
 1707                     ,
bool verbose = 
false 
 1715                     ,
const std::vector<double> &relative_scales
 
 1716                     ,
const std::vector<double> &relative_masses
 
 1720                     ,
const COSMOLOGY &cosmo  
 
 1722                     ,
bool verbose = 
false 
 1727  LensHaloMultiGauss(LensHaloMultiGauss &&halo);
 
 1728  LensHaloMultiGauss(
const LensHaloMultiGauss &halo);
 
 1730  LensHaloMultiGauss & operator=(
const LensHaloMultiGauss &&halo);
 
 1731  LensHaloMultiGauss & operator=(
const LensHaloMultiGauss &halo);
 
 1733  ~LensHaloMultiGauss(){};
 
 1736  void set_pa(
double my_pa);
 
 1755  static void calc_masses_scales(MultiGauss::PROFILE &profile  
 
 1762                                 ,
double &totalmass_out
 
 1763                                 ,std::vector<double> &scales
 
 1764                                 ,std::vector<double> &masses
 
 1769    scales.resize(Ngaussians);
 
 1771      double tmp = pow(r_max/r_min,1.0/(Ngaussians-2));
 
 1772      scales[0] = r_min/5;
 
 1774      for(
int i=2 ; i < Ngaussians ; ++i){
 
 1775        scales[i] = tmp*scales[i-1];
 
 1779    std::vector<double> radii(Nradii);
 
 1781      double tmp = pow(r_max/r_min,1.0/(Nradii-1));
 
 1783      for(
int i=1 ; i < Nradii ; ++i){
 
 1784        radii[i] = tmp*radii[i-1];
 
 1788    Eigen::MatrixXd M(Nradii,Ngaussians);
 
 1792      double cp = profile.cum(radii[0]);
 
 1793      for(
int n=0 ; n < Ngaussians ; ++n){
 
 1794        M(0,n) = 2*PI*scales[n] * scales[n]
 
 1795        * ( 1 -exp(-radii[0]*radii[0] / 2 / scales[n] /scales[n]) )
 
 1801    for(
int m=1 ; m < Nradii ; ++m){
 
 1802      double p = profile(radii[m]);
 
 1803      for(
int n=0 ; n < Ngaussians ; ++n){
 
 1804        M(m,n) = exp( - radii[m]*radii[m] / 2 / scales[n] /scales[n])
 
 1811    masses.resize(Ngaussians);
 
 1813      std::vector<double> b(Nradii,1);
 
 1814      Eigen::Map<Eigen::VectorXd> v(b.data(),Nradii);
 
 1815      Eigen::Map<Eigen::VectorXd> a(masses.data(),Ngaussians);
 
 1818      a = M.bdcSvd(Eigen::ComputeThinU | Eigen::ComputeThinV).solve(v);
 
 1820      if(verbose) std::cout << 
"test in LensHaloMultiGauss::calc_masses_scales()" << std::endl << M*a << std::endl;
 
 1826      for(
int m=0 ; m < 1 ; ++m){
 
 1828        for(
int n=0 ; n < Ngaussians ; ++n){
 
 1829          surf += masses[n] * scales[n] * scales[n]
 
 1830          * 2*PI*( 1 - exp(-radii[m]*radii[m] / 2 / scales[n] /scales[n]) );
 
 1832        double tmp = profile.cum(radii[m]);
 
 1833        if(verbose) std::cout << tmp << 
" "  << surf << std::endl;
 
 1835        rms_error += (surf - tmp )*(surf - tmp) / tmp / tmp;
 
 1838      for(
int m=1 ; m < Nradii ; ++m){
 
 1840        for(
int n=0 ; n < Ngaussians ; ++n){
 
 1841          surf += masses[n] * exp(-radii[m]*radii[m] / 2 / scales[n] /scales[n]) ;
 
 1843        double tmp = profile(radii[m]);
 
 1844        if(verbose) std::cout << tmp << 
" "  << surf << std::endl;
 
 1846        rms_error += (surf - tmp )*(surf - tmp ) / tmp /tmp;
 
 1848      rms_error = sqrt(rms_error)/Ngaussians;
 
 1849      if(verbose) std::cout << 
" MSE error " << rms_error << std::endl;
 
 1854      double mass_tmp = 0;
 
 1855      for(
int n=0 ; n<Ngaussians ; ++n){
 
 1856        mass_tmp += scales[n]*scales[n]*masses[n]
 
 1857        *( 1 - exp(-r_norm*r_norm / 2 / scales[n] /scales[n]) );
 
 1861        double tmp = (mass_norm/mass_tmp);
 
 1863        for(
int n=0 ; n<Ngaussians ; ++n) masses[n] *= tmp*scales[n]*scales[n];
 
 1868    for(
int n=0 ; n<Ngaussians ; ++n) totalmass_out += masses[n];
 
 1871  double profile(
double r);
 
 1874  double mass_cum(
double r);
 
 1879  void force_halo(PosType *alpha,KappaType *kappa,KappaType *gamma,KappaType *phi,PosType 
const *xcm,
bool subtract_point=
false,PosType screening = 1);
 
 1897class LensHaloHernquist: 
public LensHalo{
 
 1900  LensHaloHernquist(
float my_mass,
float my_Rsize,PosType my_zlens,
float my_rscale,
float my_fratio,
float my_pa,
const COSMOLOGY &cosmo, 
EllipMethod my_ellip_method=EllipMethod::Pseudo);
 
 1902 virtual ~LensHaloHernquist();
 
 1904  PosType ffunction(PosType x) 
const;
 
 1905 PosType gfunction(PosType x) 
const;
 
 1906 PosType hfunction(PosType x) 
const;
 
 1907 PosType g2function(PosType x) 
const;
 
 1925 static const long NTABLE;
 
 1927 static const PosType maxrm;
 
 1932 static PosType *ftable,*gtable,*g2table,*htable,*xtable,*xgtable;
 
 1936 PosType InterpolateFromTable(PosType *table, PosType y) 
const;
 
 1939 void assignParams(InputParams& params);
 
 1943 inline PosType alpha_h(PosType x)
 const {
 
 1944  return -0.25*InterpolateFromTable(gtable,x)/gmax;
 
 1946 inline KappaType kappa_h(PosType x)
 const {
 
 1947  return 0.25*x*x*InterpolateFromTable(ftable,x)/gmax; 
 
 1949 inline KappaType gamma_h(PosType x)
 const {
 
 1950  return -0.5*x*x*InterpolateFromTable(g2table,x)/gmax;
 
 1952 inline KappaType phi_h(PosType x)
 const {
 
 1953  return -0.25*InterpolateFromTable(htable,x)/gmax;
 
 1956    inline KappaType phi_int(PosType x)
 const{
 
 1957  return -0.25*InterpolateFromTable(xgtable,x)/gmax;
 
 1975class LensHaloJaffe: 
public LensHalo{
 
 1978  LensHaloJaffe(
float my_mass,
float my_Rsize,PosType my_zlens,
float my_rscale,
float my_fratio
 
 1979                ,
float my_pa,
const COSMOLOGY &cosmo
 
 1980                , 
EllipMethod my_ellip_method=EllipMethod::Pseudo);
 
 1982 virtual ~LensHaloJaffe();
 
 1987  PosType ffunction(PosType x) 
const;
 
 1988 PosType gfunction(PosType x) 
const;
 
 1989 PosType hfunction(PosType x) 
const;
 
 1990 PosType g2function(PosType x) 
const;
 
 1991  PosType bfunction(PosType x);
 
 1992  PosType dbfunction(PosType x);
 
 1993  PosType ddbfunction(PosType x);
 
 1998 static const long NTABLE;
 
 2000 static const PosType maxrm;
 
 2005 static PosType *ftable,*gtable,*g2table,*htable,*xtable,*xgtable;
 
 2009 PosType InterpolateFromTable(PosType *table, PosType y) 
const;
 
 2012 void assignParams(InputParams& params);
 
 2016 inline PosType alpha_h(PosType x)
 const{
 
 2017  return -0.25*InterpolateFromTable(gtable,x)/gmax;
 
 2019 inline KappaType kappa_h(PosType x)
 const {
 
 2020  return 0.125*x*x*InterpolateFromTable(ftable,x)/gmax;
 
 2022 inline KappaType gamma_h(PosType x)
 const {
 
 2024  return -0.25*x*x*InterpolateFromTable(g2table,x)/gmax;
 
 2027 inline KappaType phi_h(PosType x)
 const {
 
 2028        return -0.25*InterpolateFromTable(xgtable,x)/gmax;
 
 2030    inline KappaType phi_int(PosType x)
 const{
 
 2031  return -0.25*InterpolateFromTable(xgtable,x)/gmax;
 
 2054  LensHaloDummy(
float my_mass,
float my_Rsize,PosType my_zlens,
float my_rscale,
const COSMOLOGY &cosmo);
 
 2059 void force_halo(PosType *alpha,KappaType *kappa,KappaType *gamma,KappaType *phi,PosType 
const *xcm,
bool subtract_point=
false,PosType screening = 1.0);
 
 2063 void initFromMassFunc(
float my_mass, 
float my_Rsize, 
float my_rscale, PosType my_slope, 
long *seed);
 
 2069 inline PosType alpha_h(PosType x)
 const {
return  0.;}
 
 2070 inline KappaType kappa_h(PosType x)
 const {
return  0.;}
 
 2071 inline KappaType gamma_h(PosType x)
 const {
return  0.;}
 
 
The cosmology and all the functions required to calculated quantities based on the cosmology.
Definition cosmo.h:52
 
double angDist(double zo, double z) const
The angular size distance in units Mpc.
Definition cosmo.cpp:704
 
void force_halo(PosType *alpha, KappaType *kappa, KappaType *gamma, KappaType *phi, PosType const *xcm, bool subtract_point=false, PosType screening=1.0)
overridden function to calculate the lensing properties
Definition lens_halos.cpp:2398
 
void initFromMassFunc(float my_mass, float my_Rsize, float my_rscale, PosType my_slope, long *seed)
initialize from a mass function
Definition lens_halos.cpp:2388
 
A base class for all types of lensing "halos" which are any mass distribution that cause lensing.
Definition lens_halos.h:56
 
PosType getZlens() const
get the redshift
Definition lens_halos.h:87
 
void getX(PosType *MyPosHalo) const
get the position of the Halo in physical Mpc on the lens plane
Definition lens_halos.h:95
 
PixelMap< double > map_variables(LensingVariable lensvar, size_t Nx, size_t Ny, double res)
Map a PixelMap of the surface, density, potential and potential gradient centred on (0,...
Definition lens_halos.cpp:269
 
bool get_flag_elliptical()
flag=True if halo elliptical
Definition lens_halos.h:156
 
void assignParams(InputParams ¶ms, bool needRsize)
read in parameters from a parameterfile in InputParams params
Definition lens_halos.cpp:243
 
PosType operator[](int i) const
returns position of the Halo in physical Mpc on the lens plane
Definition lens_halos.h:102
 
float getRsize() const
get the Rsize which is the size of the halo in Mpc
Definition lens_halos.h:81
 
virtual PosType get_slope()
get slope
Definition lens_halos.h:154
 
virtual std::size_t Nparams() const
get the number of halo parameters
Definition lens_halos.cpp:2440
 
void force_halo_sym(PosType *alpha, KappaType *kappa, KappaType *gamma, KappaType *phi, PosType const *xcm, bool subtract_point=false, PosType screening=1.0)
returns the lensing quantities of a ray in center of mass coordinates for a symmetric halo
Definition lens_halos.cpp:1616
 
static const int get_Nmod()
get length of mod array, which is Nmod. Not to be confused with getNmodes in the class LensHaloFit
Definition lens_halos.h:215
 
void setZlens(PosType my_zlens, const COSMOLOGY &cosmo)
set redshift
Definition lens_halos.h:137
 
PosType alpha_int(PosType x) const
Calculates potential (phi_int) from alpha_h. If flag is_alphah_a_table is True it takes and integrate...
Definition base_analens.cpp:589
 
void calcModes(double q, double beta, double rottheta, PosType newmod[])
Calculates the modes for fourier expansion of power law halo. All the modes are relative to the zero ...
Definition base_analens.cpp:605
 
PosType mass_norm_factor
This is Rsize/rscale !!
Definition lens_halos.h:399
 
virtual void force_halo(PosType *alpha, KappaType *kappa, KappaType *gamma, KappaType *phi, PosType const *xcm, bool subtract_point=false, PosType screening=1.0)
Definition lens_halos.cpp:1536
 
void setTheta(PosType PosX, PosType PosY)
set the position of the Halo in radians
Definition lens_halos.h:105
 
PosType getDist() const
Definition lens_halos.h:118
 
virtual PosType setParam(std::size_t p, PosType value)
set the value of a scaled halo parameter by index
Definition lens_halos.cpp:2454
 
void set_mass(float my_mass)
set mass (in solar masses)
Definition lens_halos.h:132
 
void setTheta(PosType *PosXY)
set the position of the Halo in radians
Definition lens_halos.h:107
 
float get_mass() const
get the mass solar units
Definition lens_halos.h:83
 
virtual void initFromFile(float my_mass, long *seed, float vmax, float r_halfmass)
initialize from a simulation file
Definition lens_halos.h:125
 
void getTheta(PosType *MyPosHalo) const
get the position of the Halo in radians
Definition lens_halos.h:111
 
virtual void set_rscale(float my_rscale)
set scale radius (in Mpc)
Definition lens_halos.h:134
 
void error_message1(std::string name, std::string filename)
read in star parameters. This is valid for all halos and not overloaded.
Definition lens_halos.cpp:237
 
float get_Rmax() const
this can be used to tag types of LensHalos
Definition lens_halos.h:79
 
void felliptical(PosType x, PosType q, PosType theta, PosType f[], PosType g[])
Calculate the derivatives of the G function = r*sqrt(cos(theta)^2 + q(r)^2 sin(theta))
Definition base_analens.cpp:982
 
PosType MassBy2DIntegation(PosType R)
Prints star parameters; if show_stars is true, prints data for single stars.
Definition lens_halos.cpp:2471
 
void force_halo_asym(PosType *alpha, KappaType *kappa, KappaType *gamma, KappaType *phi, PosType const *xcm, bool subtract_point=false, PosType screening=1.0)
Definition lens_halos.cpp:1682
 
virtual PosType getParam(std::size_t p) const
get the value of a scaled halo parameter by index
Definition lens_halos.cpp:2445
 
virtual void alphakappagamma_asym(PosType x, PosType theta, PosType alpha[], PosType *kappa, PosType gamma[], PosType *phi)
Pseudo-elliptical profiles by Phi(G)-Ansatz.
Definition base_analens.cpp:752
 
LensHalo()
Shell constructor.
Definition lens_halos.cpp:14
 
void displayPos()
Definition lens_halos.h:122
 
void faxial(PosType x, PosType theta, PosType f[])
If set to true the correct normalization is applied for asymmetric NFW profiles, the mass_norm_factor...
Definition base_analens.cpp:470
 
void setDist(COSMOLOGY &co)
Set the angular size distance to the halo. This should be the distance to the lens plane.
Definition lens_halos.h:114
 
virtual void initFromMassFunc(float my_mass, float my_Rsize, float my_rscale, PosType my_slope, long *seed)
initialize from a mass function
Definition lens_halos.cpp:229
 
void set_switch_flag(bool swt)
flag permits case distinction in force_halo_asym for elliptical NFWs only (get_switch_flag==true),...
Definition lens_halos.h:159
 
bool compareZ(PosType z)
force tree calculation for stars
Definition lens_halos.h:196
 
virtual PosType alpha_h(PosType x) const
Definition lens_halos.h:377
 
void setTheta(const Point_2d &p)
set the position of the Halo in radians
Definition lens_halos.h:109
 
bool test()
perform some basic consistancy checks for halo
Definition lens_halos.cpp:2496
 
LensHalo & operator=(const LensHalo &h)
Definition lens_halos.cpp:169
 
void set_rsize(float my_rsize)
set radius rsize beyond which interpolation values between alpha_ellip and alpha_iso are computed
Definition lens_halos.h:240
 
virtual void printCSV(std::ostream &, bool header=false) const
print the halo parameters in CSV format
Definition lens_halos.cpp:2463
 
virtual void alphakappagamma1asym(PosType x, PosType theta, PosType alpha[2], PosType *kappa, PosType gamma[], PosType *phi)
Elliptical profiles by Fourier-Ansatz.
Definition base_analens.cpp:798
 
virtual void set_slope(PosType my_slope)
set slope
Definition lens_halos.h:152
 
float Rmax_to_Rsize_ratio
The factor by which Rmax is larger than Rsize.
Definition lens_halos.h:353
 
virtual PosType kappa_asym(PosType x, PosType theta)
Definition base_analens.cpp:1033
 
virtual void set_RsizeRmax(float my_Rsize)
set Rsize (in Mpc) and reset Rmax
Definition lens_halos.h:130
 
PosType test_average_gt(PosType R)
calculates the average gamma_t for LensHalo::test()
Definition lens_halos.cpp:2484
 
float rscale
scale length or core size. Different meaning in different cases. Not used in NSIE case.
Definition lens_halos.h:356
 
float get_rscale() const
get the scale radius in Mpc
Definition lens_halos.h:85
 
std::vector< double > get_mod()
get vector of Fourier modes, which are calculated in the constructors of the LensHaloes when main_ell...
Definition lens_halos.h:213
 
EllipMethod getEllipMethod() const
stars
Definition lens_halos.h:211
 
virtual void setCosmology(const COSMOLOGY &cosmo)
used for elliptical NFWs only, in that case get_switch_flag==true
Definition lens_halos.h:163
 
void gradial(PosType r, PosType g[])
Derivatives of the potential damping factor with respect to r ... TODO: come up with a better damping...
Definition base_analens.cpp:554
 
double fourier_coeff(double n, double q, double beta)
Calculates fourier-coefficients for power law halo.
Definition base_analens.cpp:583
 
PosType MassBy1DIntegation(PosType R)
calculates the mass within radius R by integating alpha on a ring and using Gauss' law,...
Definition lens_halos.cpp:2477
 
void analModes(int modnumber, PosType my_beta, PosType q, PosType amod[3])
Definition modes_ana.cpp:156
 
void initFromFile(float my_mass, long *seed, float vmax, float r_halfmass)
Sets the profile to match the mass, Vmax and R_halfmass.
Definition lens_halos.cpp:618
 
void gammaNFW(KappaType *gamma, PosType *x, PosType Rtrunc, PosType mass, PosType r_scale, PosType *center, PosType Sigma_crit)
Shear for and NFW halo. this might have a flaw in it.
Definition nfw_lens.cpp:56
 
void initFromMassFunc(float my_mass, float my_Rsize, float my_rscale, PosType my_slope, long *seed)
initialize from a mass function
Definition lens_halos.cpp:633
 
void set_RsizeXmax(float my_Rsize)
set Rsize, xmax and gmax
Definition lens_halos.h:816
 
static const PosType maxrm
maximum Rsize/rscale
Definition lens_halos.h:825
 
KappaType kappaNFW(PosType *x, PosType Rtrunc, PosType mass, PosType r_scale, PosType *center, PosType Sigma_crit)
Convergence for an NFW halo.
Definition nfw_lens.cpp:36
 
void set_rscaleXmax(float my_rscale)
Definition lens_halos.h:819
 
LensHaloNFW()
Shell constructor. Sets the halo to zero mass.
Definition lens_halos.cpp:365
 
PosType InterpolateFromTable(PosType *table, PosType y) const
interpolates from the specific tables
Definition lens_halos.cpp:566
 
static const long NTABLE
table size
Definition lens_halos.h:823
 
PosType dmoddb(int whichmod, PosType q, PosType b)
dbfunction and ddbfunction are approximation formulae for dbeta/dr and d^2beta/dr^2 whereas dbnum and...
Definition nfw_lens.cpp:205
 
static PosType * ftable
tables for lensing properties specific functions
Definition lens_halos.h:830
 
void assignParams(InputParams ¶ms)
read in parameters from a parameterfile in InputParams params
Definition lens_halos.cpp:583
 
PosType alpha_h(PosType x) const
r |alpha(r = x*rscale)| PI Sigma_crit / Mass
Definition lens_halos.h:842
 
void make_tables()
make the specific tables
Definition lens_halos.cpp:482
 
static int count
keeps track of how many time the tables are created, default is just once
Definition lens_halos.h:827
 
void alphaNFW(PosType *alpha, PosType *x, PosType Rtrunc, PosType mass, PosType r_scale, PosType *center, PosType Sigma_crit)
deflection caused by NFW halo
Definition nfw_lens.cpp:9
 
void initFromMassFunc(float my_mass, float my_Rsize, float my_rscale, PosType my_slope, long *seed)
set the slope of the surface density profile
Definition lens_halos.cpp:903
 
void set_slope(PosType my_slope)
set the slope of the surface density profile
Definition lens_halos.h:892
 
PosType mhat(PosType y, PosType beta) const
Auxiliary function for PseudoNFW profile.
Definition lens_halos.cpp:724
 
void initFromMassFunc(float my_mass, float my_Rsize, float my_rscale, PosType my_slope, long *seed)
set Rsize
Definition lens_halos.cpp:770
 
LensHaloPseudoNFW()
shell constructor, should be avoided
Definition lens_halos.cpp:646
 
PosType get_slope()
initialize from a mass function
Definition lens_halos.h:894
 
void set_fratio(float my_fratio)
set the axis ratio
Definition lens_halos.h:1076
 
float get_pa()
get the position angle
Definition lens_halos.h:1067
 
PosType rmax_calc()
for the set fratio, sigma and rcore calculate the radius that contains the correct mass
Definition lens_halos.cpp:1162
 
void set_rcore(float my_rcore)
set the core radius Einstein radius
Definition lens_halos.h:1080
 
float rcore
core size of NSIE
Definition lens_halos.h:1112
 
float sigma
velocity dispersion of NSIE
Definition lens_halos.h:1106
 
void set_pa(float my_pa)
set the position angle
Definition lens_halos.h:1078
 
LensHaloRealNSIE(float my_mass, PosType my_zlens, float my_sigma, float my_rcore, float my_fratio, float my_pa, const COSMOLOGY &cosmo)
explicit constructor, Warning: If my_rcore > 0.0 and my_fratio < 1 then the mass will be somewhat les...
Definition lens_halos.cpp:1051
 
float get_sigma()
get the velocity dispersion
Definition lens_halos.h:1061
 
void force_halo(PosType *alpha, KappaType *kappa, KappaType *gamma, KappaType *phi, PosType const *xcm, bool subtract_point=false, PosType screening=1.0)
overridden function to calculate the lensing properties
Definition lens_halos.cpp:1946
 
float get_rcore()
get the core radius
Definition lens_halos.h:1069
 
float pa
position angle on sky, radians
Definition lens_halos.h:1110
 
void set_sigma(float my_sigma)
set the velocity dispersion
Definition lens_halos.h:1072
 
void assignParams(InputParams ¶ms)
initialize from a simulation file
Definition lens_halos.cpp:1116
 
float fratio
axis ratio of surface mass distribution
Definition lens_halos.h:1108
 
float get_fratio()
get the axis ratio
Definition lens_halos.h:1065
 
LensHaloTEPL(float my_mass, PosType my_zlens, PosType r_trunc, PosType gamma, float my_fratio, float my_pa, const COSMOLOGY &cosmo, float f=10)
Definition lens_halos.cpp:1181
 
float get_rtrunc()
get the truncation radius
Definition lens_halos.h:1277
 
float get_pa()
get the position angle
Definition lens_halos.h:1275
 
float get_fratio()
get the axis ratio
Definition lens_halos.h:1273
 
float get_t()
get the power-law index
Definition lens_halos.h:1279
 
void force_halo(PosType *alpha, KappaType *kappa, KappaType *gamma, KappaType *phi, PosType const *xcm, bool subtract_point=false, PosType screening=1.0)
overridden function to calculate the lensing properties
Definition lens_halos.cpp:1217
 
float get_pa()
get the position angle
Definition lens_halos.h:1188
 
static double calc_sigma(float mass, float Rtrunc, float Rcore, float fratio)
returns the sigma in km / s for the other parameters fixed
Definition lens_halos.h:1174
 
float get_rcore()
get the core radius
Definition lens_halos.h:1190
 
float rcore
core size of NSIE
Definition lens_halos.h:1214
 
void force_halo(PosType *alpha, KappaType *kappa, KappaType *gamma, KappaType *phi, PosType const *xcm, bool subtract_point=false, PosType screening=1.0)
overridden function to calculate the lensing properties
Definition lens_halos.cpp:952
 
float rtrunc
core size of NSIE
Definition lens_halos.h:1216
 
void set_pa(float my_pa)
set the position angle
Definition lens_halos.h:1199
 
float fratio
axis ratio of surface mass distribution
Definition lens_halos.h:1210
 
float pa
position angle on sky, radians
Definition lens_halos.h:1212
 
float get_fratio()
get the axis ratio
Definition lens_halos.h:1186
 
float sigma
velocity dispersion of TNSIE
Definition lens_halos.h:1208
 
void assignParams(InputParams ¶ms)
read-in parameters from a parameter file
 
LensHaloTNSIE(float my_mass, PosType my_zlens, float my_sigma, float my_rcore, float my_fratio, float my_pa, const COSMOLOGY &cosmo, float f=20)
Definition lens_halos.cpp:927
 
float get_sigma()
get the velocity dispersion
Definition lens_halos.h:1182
 
float get_rtrunc()
get the truncation radius
Definition lens_halos.h:1192
 
LensingVariable
output lensing variables
Definition standard.h:89
 
Class for representing points or vectors in 2 dimensions. Not that the dereferencing operator is over...
Definition point.h:48