8#ifndef _grid_maintenance_declare_
9#define _grid_maintenance_declare_
16#include <utilities_slsim.h>
17#include "concave_hull.h"
19class LensHaloBaseNSIE;
26 Grid(LensHndl lens,
unsigned long N1d,
const double center[2],
double range);
27 Grid(LensHndl lens ,
unsigned long Nx ,
const PosType center[2] ,PosType rangeX ,PosType rangeY);
32 void zoom(LensHndl lens,
double *center,
double scale,
Branch *top = NULL);
52 ,std::vector<RAY> &images
63 double refine_on_surfacebrightness(
Lens &lens,
Source &source);
89 void writeFits(
const double center[],
size_t Nx,
size_t Ny,
double resolution,
LensingVariable lensvar,std::string filename);
101 ,std::string filename
103 template <
typename T>
105 template <
typename T>
107 template <
typename T>
111 template <
typename T>
121 template <
typename T>
124 template <
typename T>
129 template <
typename T>
136 ,std::vector<ImageInfo> &imageinfo
137 ,
unsigned long &Nimagepoints
144 ,std::vector<ImageInfo> &imageinfo
147 ,PosType initial_size
148 ,ExitCriterion criterion
154 *
this = std::move(grid);
157 Grid operator=(
Grid &grid) =
delete;
161 assert(&grid !=
this);
164 grid.i_tree =
nullptr;
166 grid.s_tree =
nullptr;
167 neighbors = grid.neighbors;
168 grid.neighbors =
nullptr;
172 Ngrid_init = grid.Ngrid_init;
173 Ngrid_init2 = grid.Ngrid_init2;
174 Ngrid_block = grid.Ngrid_block;
175 initialized = grid.initialized;
176 maglimit = grid.maglimit;
177 pointID = grid.pointID;
178 axisratio = grid.axisratio;
180 point_factory.clear();
181 point_factory=std::move(grid.point_factory);
188 PosType UnlensedFlux(
double sblimit=-1.0e12)
const;
189 PosType LensedFlux(
double sblimit=-1.0e12)
const;
197 void xygridpoints(Point *points,
double range,
const double *center,
long Ngrid
198 ,
short remove_center);
210 Kist<Point> * neighbors;
211 bool find_mag_matrix(
double *a,Point *p0,Point *p1,Point *p2);
213 bool uniform_mag_from_deflect(
double *a,Point *point);
216 double mag_from_deflect(Point *point)
const;
218 unsigned long pointID;
221 template <
typename T>
222 void writePixelMapUniform_(Point *head,
size_t N
226 Point * NewPointArray(
size_t N){
227 Point * p = point_factory(N);
229 for(
size_t i=1; i < N ; ++i) p[i].head = 0;
232 MemmoryBank<Point> point_factory;
233 static std::mutex grid_mutex;
236typedef struct Grid* GridHndl;
239std::string to_string(CritType crit);
244 struct CriticalCurve{
247 critical_center[0] = critical_center[1] = 0.0;
248 caustic_center[0] = caustic_center[1] = 0.0;
255 caustic_intersections = -1;
256 touches_edge =
false;
259 CriticalCurve(
const CriticalCurve &p){
260 critcurve = p.critcurve;
262 caustic_curve_outline = p.caustic_curve_outline;
263 caustic_curve_intersecting = p.caustic_curve_intersecting;
264 critical_center = p.critical_center;
265 caustic_center = p.caustic_center;
266 critical_area = p.critical_area;
267 caustic_area = p.caustic_area;
268 ellipse_curve = p.ellipse_curve;
269 contour_ell = p.contour_ell;
270 ellipse_area = p.ellipse_area;
271 z_source = p.z_source;
273 caustic_intersections = p.caustic_intersections;
274 touches_edge = p.touches_edge;
277 CriticalCurve & operator=(
const CriticalCurve &p){
278 if(
this == &p)
return *
this;
280 critcurve = p.critcurve;
282 caustic_curve_outline = p.caustic_curve_outline;
283 caustic_curve_intersecting = p.caustic_curve_intersecting;
284 critical_center = p.critical_center;
285 caustic_center = p.caustic_center;
286 critical_area = p.critical_area;
287 caustic_area = p.caustic_area;
288 ellipse_curve = p.ellipse_curve;
289 contour_ell = p.contour_ell;
290 ellipse_area = p.ellipse_area;
291 z_source = p.z_source;
293 caustic_intersections = p.caustic_intersections;
294 touches_edge = p.touches_edge;
298 std::vector<RAY> critcurve;
299 std::vector<Point_2d> caustic_curve_outline;
300 std::vector<Point_2d> caustic_curve_intersecting;
301 std::vector<Point_2d> ellipse_curve;
307 int caustic_intersections;
315 PosType critical_area;
317 PosType caustic_area;
322 PosType ellipse_area;
330 return Utilities::inhull(x.x,caustic_curve_outline);
334 bool intersectingCausticCurve(
Point_2d &x,
double r){
345 bool EntirelyinCausticCurve(
Point_2d &x, PosType sourceRadius)
352 PosType DistSourceToCautic;
354 if(IsInCurve ==
true)
356 while(i<caustic_curve_outline.size())
358 DistSourceToCautic = sqrt((caustic_curve_outline[i].x[0] - x.x[0])*(caustic_curve_outline[i].x[0] - x.x[0]) + (caustic_curve_outline[i].x[1] - x.x[1])*(caustic_curve_outline[i].x[1] - x.x[1]));
359 if (DistSourceToCautic < sourceRadius)
return false ;
368 bool EntirelyinCriticalCurve(
Point_2d x, PosType sourceRadius)
375 PosType DistSourceToCritCurve;
377 if(IsInCurve ==
true)
379 while(i<critcurve.size())
381 DistSourceToCritCurve = sqrt((critcurve[i].x[0] - x.x[0])*(critcurve[i].x[0] - x.x[0]) + (critcurve[i].x[1] - x.x[1])*(critcurve[i].x[1] - x.x[1]));
382 if (DistSourceToCritCurve < sourceRadius)
return false ;
393 void RandomSourcesWithinCaustic(
395 ,std::vector<Point_2d> &y
405 void RandomSourcesNearCaustic(
double R
407 ,std::vector<Point_2d> &y
412 Point_2d RandomSourceNearCaustic(
double R
419 void RandomSourceStrictlyWithinCaustic(
int N
420 ,std::vector<Point_2d> &y
422 ,PosType sourceRadius
423 ,PosType distSourceToCaustic
431 void CriticalRadius(PosType &rmax,PosType &rmin,PosType &rave)
const{
432 if(critcurve.size() < 2){
433 rave = rmax = rmin = 0.0;
437 rave = rmin = rmax = (critical_center - critcurve[0].x).length();
440 for(
size_t ii=1; ii< critcurve.size(); ++ii){
441 rad = (critical_center - critcurve[ii].x).length();
444 if(rad < rmin) rmin = rad;
445 if(rad > rmax) rmax = rad;
448 rave /= critcurve.size();
451 void CausticRadius(PosType &rmax,PosType &rmin,PosType &rave)
const{
452 if(caustic_curve_outline.size() < 2){
453 rave = rmax = rmin = 0.0;
457 rave = rmin = rmax = (caustic_center - caustic_curve_outline[0]).length();
461 for(
size_t ii=1; ii< caustic_curve_outline.size(); ++ii){
462 rad = (caustic_center - caustic_curve_outline[ii]).length();
465 if(rad < rmin) rmin = rad;
466 if(rad > rmax) rmax = rad;
469 rave /= caustic_curve_outline.size();
473 double AreaNearCaustic(
double R
480 void find_images_kist(LensHndl lens,PosType *y_source,PosType r_source,GridHndl grid
481 ,
int *Nimages,std::vector<ImageInfo> &imageinfo,
unsigned long *Nimagepoints
482 ,PosType initial_size,
bool splitimages,
short edge_refinement
483 ,
bool verbose =
false);
489 ,
int *Nimages,std::vector<ImageInfo> &imageinfo,
unsigned long *Nimagepoints
490 ,
double initial_size,
double mu_min,
bool splitimages,
short edge_refinement
494 ,GridHndl grid,
int *Nimages,std::vector<ImageInfo> &imageinfo,
unsigned long *Nimagepoints,PosType initial_size ,PosType mu_min
495 ,
bool splitimages,
short edge_refinement,
bool verbose);
497 void image_finder_kist(LensHndl lens, PosType *y_source,PosType r_source,GridHndl grid
498 ,
int *Nimages,std::vector<ImageInfo> &imageinfo,
unsigned long *Nimagepoints
499 ,
short splitparities,
short true_images);
502 void find_crit(LensHndl lens,GridHndl grid,std::vector<CriticalCurve> &crtcurve,
int *Ncrits
503 ,
double resolution,
double invmag_min = 0.0,
bool verbose =
false,
bool test=
false);
504 void find_crit(
Lens &lens,
GridMap &gridmap,std::vector<CriticalCurve> &crtcurves,
bool verbose =
false);
507 void find_magnification_contour(
511 ,std::vector<std::vector<RAY> > &contour
512 ,std::vector<bool> &hits_boundary
519 ,PosType pseudolimit,LensHndl lens,GridHndl grid
520 ,PosType resolution,Kist<Point> &paritypoints,
bool TEST=
false);
522 void find_contour(LensHndl lens,GridHndl grid,std::vector<CriticalCurve> &contour,
int *Ncrits,PosType resolution,
bool *orderingsuccess,
bool ordercurve,
bool dividecurves,
double contour_value,
LensingVariable contour_type,
bool verbose =
false);
529 PosType mindyfunc(PosType *x);
532 namespace IF_routines{
533 int refine_grid_kist(LensHndl lens,GridHndl grid,
ImageInfo *imageinfo
534 ,
int Nimages,
double res_target,
short criterion
535 ,Kist<Point> * newpointkist = NULL,
bool batch=
true);
538 void refine_crit_in_image(LensHndl lens,GridHndl grid,
double r_source,
double x_source[],
double resolution);
540 int refine_grid(LensHndl lens,GridHndl grid,
OldImageInfo *imageinfo
541 ,
unsigned long Nimages,
double res_target,
short criterion,
bool batch=
true);
543 long refine_edges(LensHndl lens,GridHndl grid,
ImageInfo *imageinfo
544 ,
int Nimages,
double res_target,
short criterion
545 ,Kist<Point> * newpointkist = NULL,
bool batch=
true);
547 long refine_edges2(LensHndl lens,
double *y_source,
double r_source,GridHndl grid
548 ,
ImageInfo *imageinfo,
bool *image_overlap,
int Nimages,
double res_target
549 ,
short criterion,
bool batch=
true);
551 void sort_out_points(
Point *i_points,
ImageInfo *imageinfo,
double r_source,
double y_source[]);
555 void printCriticalCurves(std::string filename
556 ,
const std::vector<ImageFinding::CriticalCurve> &critcurves);
564 const std::vector<ImageFinding::CriticalCurve> &critcurves,
579std::ostream &operator<<(std::ostream &os,
const ImageFinding::CriticalCurve &p);
584 const PosType center[]
588 ,std::string filename
590 writeFits<T>(center,Npixels,Npixels,resolution,lensvar,filename);
595 const PosType center[]
600 ,std::string filename
610 tag =
".alpha1.fits";
613 tag =
".alpha2.fits";
622 tag =
".gamma1.fits";
625 tag =
".gamma2.fits";
628 tag =
".gamma3.fits";
634 tag =
".invmag.fits";
637 tag =
".surfbright.fits";
652 const PosType center[]
663 const PosType center[]
681 double resolution = (branch->boundary_p2[0] - branch->boundary_p1[0])/Ngrid_init;
682 PixelMap<T> map(branch->center, Ngrid_init, Ngrid_init2, resolution);
691 int Nx = (int)( (branch->boundary_p2[0] - branch->boundary_p1[0])/resolution );
692 int Ny = (int)( (branch->boundary_p2[1] - branch->boundary_p1[1])/resolution );
706 ,std::string filename
711 size_t Ny = (size_t)(Nx*axisratio);
712 writeFits<T>(center.x,Nx,Ny,resolution, lensvar, filename);
726 const PosType center[]
730 ,std::string filename
739 tag =
".alpha1.fits";
742 tag =
".alpha2.fits";
751 tag =
".gamma1.fits";
754 tag =
".gamma2.fits";
757 tag =
".gamma3.fits";
763 tag =
".invmag.fits";
766 tag =
".surfbright.fits";
785 const PosType center[]
800 std::vector<Point *> heads(Nblocks);
801 std::vector<size_t> sizes(Nblocks,0);
808 if((*i_tree_it)->level == 4){
810 heads[i] = (*i_tree_it)->points;
811 sizes[i] = (*i_tree_it)->npoints;
820 }
while(i_tree_it.
TreeWalkStep(allowDecent) && i < Nblocks);
822 std::vector<std::thread> thrs;
823 for(
int ii = 0; ii < i ;++ii){
827 thrs.push_back(std::thread(&Grid::writePixelMapUniform_<T>,
this,heads[ii],sizes[ii],&map,lensvar));
829 for(
int ii = 0; ii < i ;++ii) thrs[ii].join();
847 std::vector<Point *> heads(Nblocks);
848 std::vector<size_t> sizes(Nblocks,0);
855 if((*i_tree_it)->level == 4){
859 heads[i] = (*i_tree_it)->points;
860 sizes[i] = (*i_tree_it)->npoints;
867 }
while(i_tree_it.
TreeWalkStep(allowDecent) && i < Nblocks);
869 std::vector<std::thread> thr;
870 for(
int ii = 0; ii < i ;++ii){
871 thr.push_back(std::thread(&Grid::writePixelMapUniform_<T>,
this,heads[ii],sizes[ii],&map,lensvar));
873 for(
auto &t : thr) t.join();
882 Point *ppoint = head;
884 for(
size_t i = 0; i< N; ++i){
888 tmp2[0] = ppoint->x[0] - ppoint->image->x[0];
889 tmp2[1] = ppoint->x[1] - ppoint->image->x[1];
890 tmp = sqrt(tmp2[0]*tmp2[0] + tmp2[1]*tmp2[1]);
893 tmp = (ppoint->x[0] - ppoint->image->x[0]);
896 tmp = (ppoint->x[1] - ppoint->image->x[1]);
899 tmp = ppoint->kappa();
902 tmp2[0] = ppoint->gamma1();
903 tmp2[1] = ppoint->gamma2();
904 tmp = sqrt(tmp2[0]*tmp2[0] + tmp2[1]*tmp2[1]);
907 tmp = ppoint->gamma1();
910 tmp = ppoint->gamma2();
913 tmp = ppoint->gamma3();
916 tmp = ppoint->invmag();
922 tmp = ppoint->surface_brightness;
925 std::cerr <<
"PixelMap<T>::AddGrid() does not work for the input LensingVariable" << std::endl;
926 throw std::runtime_error(
"PixelMap<T>::AddGrid() does not work for the input LensingVariable");
932 if(index != -1)(*map)[index] = tmp;
934 ppoint = ppoint->next;
941 const PosType center[]
945 ,std::string filename
949 PosType range = Npixels*resolution,tmp_x[2];
955 i_tree->PointsWithinKist(center,range/sqrt(2.),tmp_image_theta.
imagekist,0);
957 std::vector<PosType> tmp_sb_vec(tmp_image.
imagekist->Nunits());
959 for(tmp_image.
imagekist->MoveToTop(),i=0;i<tmp_sb_vec.size();++i,tmp_image.
imagekist->Down()){
960 tmp_sb_vec[i] = tmp_image.
imagekist->getCurrent()->surface_brightness;
963 tmp_x[0] = tmp_image.
imagekist->getCurrent()->x[0]
964 - tmp_image.
imagekist->getCurrent()->image->x[0];
966 tmp_x[1] = tmp_image.
imagekist->getCurrent()->x[1]
967 - tmp_image.
imagekist->getCurrent()->image->x[1];
969 tmp_image.
imagekist->getCurrent()->surface_brightness = sqrt( tmp_x[0]*tmp_x[0] + tmp_x[1]*tmp_x[1]);
970 tmp_image_theta.
imagekist->getCurrent()->surface_brightness = atan2(tmp_x[1],tmp_x[0]);
972 tag =
".alphaV.fits";
976 tmp_x[0] = tmp_image.
imagekist->getCurrent()->gamma1();
977 tmp_x[1] = tmp_image.
imagekist->getCurrent()->gamma2();
979 tmp_image.
imagekist->getCurrent()->surface_brightness = sqrt( tmp_x[0]*tmp_x[0] + tmp_x[1]*tmp_x[1]);
980 tmp_image_theta.
imagekist->getCurrent()->surface_brightness = atan2(tmp_x[1],tmp_x[0])/2;
982 tag =
".gammaV.fits";
985 std::cout <<
"Grid::writeFitsVector() does not support the LensVariable you are using." << std::endl;
990 PixelMap<T> map_m(center, Npixels, resolution),map_t(center,Npixels,resolution);
993 map_m.AddImages(&tmp_image,1,-1);
1000 map_m.printFITS(filename + tag);
1002 for(tmp_image.
imagekist->MoveToTop(),i=0;i<tmp_sb_vec.size();++i,tmp_image.
imagekist->Down())
1003 tmp_image.
imagekist->getCurrent()->surface_brightness = tmp_sb_vec[i];
1006template <
typename T>
1009 size_t N1 = (size_t)(strech*Ngrid_init);
1010 size_t N2 = (size_t)(strech*Ngrid_init2);
A class to represents a lens with multiple planes.
Definition lens.h:71
Image structure that can be manipulated and exported to/from fits files.
Definition pixelmap.h:42
void AddGridBrightness(Grid &grid)
Add an image from a the surface brightnesses of a Grid to the PixelMap.
Definition pixelmap.cpp:685
void AddImages(ImageInfo *imageinfo, int Nimages, float rescale=1.)
Add an image to the map.
Definition pixelmap.cpp:641
long find_index(PosType const x[], long &ix, long &iy) const
get the index for a position, returns -1 if out of map, this version returns the 2D grid coordinates
Definition pixelmap.cpp:2227
void AddGrid(const Grid &grid, T value=1.0)
Fills in pixels where the image plane points in the grid are located with the value given.
Definition pixelmap.cpp:1936
void printFITS(std::string filename, bool Xflip=false, bool ctype=false, bool verbose=false)
Output the pixel map as a fits file.
Definition pixelmap.cpp:1318
Base class for all sources.
Definition source.h:44
A iterator class fore TreeStruct that allows for movement through the tree without changing anything ...
Definition Tree.h:47
bool TreeWalkStep(bool allowDescent)
step for walking tree by iteration instead of recursion.
Definition tree_maintenance.cpp:1610
This is a class for generating random numbers. It simplifies and fool proofs initialization and allow...
Definition utilities_slsim.h:1059
The ImageFinding namespace is for functions related to finding and mapping images.
Definition grid_maintenance.h:242
PixelMap< T > mapCausticCurves(const std::vector< ImageFinding::CriticalCurve > &critcurves, int Nx)
Makes an image of the caustic curves. The map will encompose all curves found. The pixel values are t...
Definition Tree.cpp:1064
void find_images_microlens(LensHndl lens, double *y_source, double r_source, GridHndl grid, int *Nimages, std::vector< ImageInfo > &imageinfo, unsigned long *Nimagepoints, double initial_size, double mu_min, bool splitimages, short edge_refinement, bool verbose)
Finds images given a source position and size.
Definition image_finder_kist.cpp:465
void find_images_kist(LensHndl lens, PosType *y_source, PosType r_source, GridHndl grid, int *Nimages, std::vector< ImageInfo > &imageinfo, unsigned long *Nimagepoints, PosType initial_size, bool splitimages, short edge_refinement, bool verbose=false)
Finds images given a source position and size.
Definition image_finder_kist.cpp:41
PixelMap< T > mapCriticalCurves(const std::vector< ImageFinding::CriticalCurve > &critcurves, int Nx)
Makes an image of the critical curves. The map will encompose all curves found. The pixel values are ...
Definition Tree.cpp:1026
void image_finder_kist(LensHndl lens, PosType *y_source, PosType r_source, GridHndl grid, int *Nimages, std::vector< ImageInfo > &imageinfo, unsigned long *Nimagepoints, short splitparities, short true_images)
Finds images for a given source position and size. Not meant for high level user.
Definition image_finder_kist.cpp:1530
CritType find_pseudo(ImageInfo &pseudocurve, ImageInfo &negimage, PosType pseudolimit, LensHndl lens, GridHndl grid, PosType resolution, Kist< Point > &paritypoints, bool TEST=false)
Definition find_crit.cpp:1122
void find_contour(LensHndl lens, GridHndl grid, std::vector< CriticalCurve > &contour, int *Ncrits, PosType resolution, bool *orderingsuccess, bool ordercurve, bool dividecurves, double contour_value, LensingVariable contour_type, bool verbose=false)
Finds iso kappa contours.
Definition find_crit.cpp:1912
void find_images_microlens_exper(LensHndl lens, PosType *y_source, PosType r_source, GridHndl grid, int *Nimages, std::vector< ImageInfo > &imageinfo, unsigned long *Nimagepoints, PosType initial_size, PosType mu_min, bool splitimages, short edge_refinement, bool verbose)
experimental version of find_image_microlens()
Definition image_finder_kist.cpp:1027
void find_crit(LensHndl lens, GridHndl grid, std::vector< CriticalCurve > &crtcurve, int *Ncrits, double resolution, double invmag_min=0.0, bool verbose=false, bool test=false)
Finds critical curves and caustics.
Definition find_crit.cpp:37
bool inhull< RAY >(PosType x[], const std::vector< RAY > &H)
finds in x is within the curve discribed by the H[].x points ie image points
Definition concave_hull.h:1131
bool circleIntersetsCurve(const Point_2d &x, double r, const std::vector< Point_2d > &v)
returns true if a circle of radius r around the point x intersects with the curve v....
Definition curve_routines.cpp:2936
bool inCurve(const Ptype &x, const std::vector< Ptype > &H)
returns true if x is within the polygon H
Definition concave_hull.h:1021
LensingVariable
output lensing variables
Definition standard.h:89
@ ALPHA
magnitude of deflection in radians
Definition standard.h:91
@ GAMMA2
second component of shear
Definition standard.h:97
@ DELAYT
time delay
Definition standard.h:90
@ GAMMA3
third component of shear
Definition standard.h:98
@ ALPHA2
y component of deflection
Definition standard.h:93
@ SurfBrightness
Surface brightness.
Definition standard.h:101
@ GAMMA1
first component of shear
Definition standard.h:96
@ GAMMA
magnitude of shear
Definition standard.h:95
@ KAPPA
convergence
Definition standard.h:94
@ ALPHA1
x component of deflection
Definition standard.h:92
@ INVMAG
inverse of magnification
Definition standard.h:99
The box representing a branch of a binary tree structure. Used specifically in TreeStruct for organiz...
Definition point.h:638
Structure to contain both source and image trees.
Definition grid_maintenance.h:24
void map_images(Lens *lens, Source *source, int *Nimages, std::vector< ImageInfo > &imageinfo, PosType xmax, PosType xmin, PosType initial_size, ExitCriterion criterion, bool FindCenter, bool divide_images)
Find images and refine them based on their surface brightness distribution.
Definition map_images.cpp:27
double RefreshSurfaceBrightnesses(Source *source)
Reshoot the rays with the same image postions.
Definition grid_maintenance.cpp:315
void zoom(LensHndl lens, double *center, double scale, Branch *top=NULL)
Test if point is in a region of uniform magnification using the kappa and gamma calculated from the r...
Definition grid_maintenance.cpp:1233
double ClearSurfaceBrightnesses()
Reset the surface brightness and in_image flag in every point on image and source planes to zero (fal...
Definition grid_maintenance.cpp:500
double AddSurfaceBrightnesses(Source *source)
Recalculate surface brightness just like Grid::RefreshSurfaceBrightness but the new source is added t...
Definition grid_maintenance.cpp:344
PosType EinsteinArea() const
area of region with negative magnification
Definition grid_maintenance.cpp:368
PixelMap< T > writePixelMap(const double center[], size_t Npixels, double resolution, LensingVariable lensvar)
Outputs a PixelMap of the lensing quantities of a fixed grid.
Definition grid_maintenance.h:651
int getInitNgrid()
return initial number of grid points in each direction
Definition grid_maintenance.h:75
~Grid()
Destructor for a Grid. Frees all memory.
Definition grid_maintenance.cpp:136
void ClearAllMarks()
Rest all in_image markers to False.
Definition grid_maintenance.cpp:984
void writeFitsUniform(const PosType center[], size_t Nx, size_t Ny, LensingVariable lensvar, std::string filename)
Output a fits map of the without distribution the pixels.
Definition grid_maintenance.h:725
void MapSurfaceBrightness(PixelMap< T > &map)
make image of surface brightness
Definition grid_maintenance.h:116
unsigned long getNumberOfPoints() const
Returns number of points on image plane.
Definition grid_maintenance.cpp:518
void find_point_source_images(Point_2d y_source, PosType r_source, PosType z_source, std::vector< RAY > &images, bool verbose=false)
This function finds all the images for a circular source of radius r_source, then finds the points wi...
Definition image_finder.cpp:1094
void writeFits(const double center[], size_t Npixels, double resolution, LensingVariable lensvar, std::string filename)
Outputs a fits image of a lensing variable of choice.
Definition grid_maintenance.h:583
Grid(LensHndl lens, unsigned long N1d, const double center[2], double range)
Constructor for initializing square grid.
Definition grid_maintenance.cpp:22
Point * RefineLeaves(LensHndl lens, std::vector< Point * > &points)
Same as RefineLeaf() but multiple points can be passed. The rays are shot all together so that more p...
Definition grid_maintenance.cpp:681
double mark_closest_point_source_images(Point_2d y_source, PosType r_source_max, PosType luminosity, bool verbose=false)
This function finds all the images for a circular source of radius r_source, then finds the points wi...
Definition image_finder.cpp:1061
Grid ReInitialize(LensHndl lens)
Returns a new grid that has not been refined but has the same intial image grid, but calculated with ...
Definition grid_maintenance.cpp:148
double getInitRange()
return initial range of gridded region
Definition grid_maintenance.h:79
void find_images(PosType *y_source, PosType r_source, int &Nimages, std::vector< ImageInfo > &imageinfo, unsigned long &Nimagepoints)
Finds images for a given source position and size. It seporates images of different pairities.
Definition image_finder.cpp:951
TreeHndl s_tree
tree on source plane
Definition grid_maintenance.h:72
PosType magnification(double sblimit=-1.0e12) const
flux weighted local magnification that does not take multiple imaging into effect
Definition grid_maintenance.cpp:398
TreeHndl i_tree
tree on image plane
Definition grid_maintenance.h:70
Point_2d centroid() const
centroid of flux
Definition grid_maintenance.cpp:456
void writePixelFits(size_t Nx, LensingVariable lensvar, std::string filename)
Make a fits map that is automatically centered on the grid and has approximately the same range as th...
Definition grid_maintenance.h:703
Point * RefineLeaf(LensHndl lens, Point *point)
Fundamental function used to divide a leaf in the tree into nine subcells.
Definition grid_maintenance.cpp:543
void writeFitsVector(const double center[], size_t Npixels, double resolution, LensingVariable lensvar, std::string filename)
Outputs a fits file for making plots of vector fields.
Definition grid_maintenance.h:940
PixelMap< T > writePixelMapUniform(const PosType center[], size_t Nx, size_t Ny, LensingVariable lensvar)
Make a Pixel map of the without distribution the pixels.
Definition grid_maintenance.h:784
int getNgrid_block()
return number of cells in each dimension into which each cell is divided when a refinement is made
Definition grid_maintenance.h:77
A simplified version of the Grid structure for making non-adaptive maps of the lensing quantities (ka...
Definition gridmap.h:31
Structure for storing information about images or curves.
Definition image_info.h:20
Kist< Point > * imagekist
Array of points in image, SHOULD NOT BE USED IN FAVOR OF imagekist! Still used by caustic finding rou...
Definition image_info.h:47
This is an old version that should not be used anymore in favor of ImageInfo.
Definition image_info.h:109
Class for representing points or vectors in 2 dimensions. Not that the dereferencing operator is over...
Definition point.h:48
A point on the source or image plane that contains a position and the lensing quantities.
Definition point.h:421