GLAMERDOC++
Gravitational Lensing Code Library
|
The ImageFinding namespace is for functions related to finding and mapping images. More...
Functions | |
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. | |
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. | |
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() | |
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. | |
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. | |
void | find_crit (Lens &lens, GridMap &gridmap, std::vector< CriticalCurve > &crtcurves, bool verbose=false) |
void | find_magnification_contour (Lens &lens, GridMap &gridmap, double invmag, std::vector< std::vector< RAY > > &contour, std::vector< bool > &hits_boundary) |
CritType | find_pseudo (ImageInfo &pseudocurve, ImageInfo &negimage, PosType pseudolimit, LensHndl lens, GridHndl grid, PosType resolution, Kist< Point > &paritypoints, bool TEST=false) |
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. | |
void | printCriticalCurves (std::string filename, const std::vector< ImageFinding::CriticalCurve > &critcurves) |
template<typename T > | |
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 the caustic type + 1 ( 2=radial,3=tangential,4=pseudo ) | |
template<typename T > | |
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 the caustic type + 1 ( 2=radial,3=tangential,4=pseudo ) | |
void | map_images (LensHndl lens, Source *source, GridHndl grid, int *Nimages, std::vector< ImageInfo > &imageinfo, double xmax, double xmin, double initial_size, ExitCriterion criterion, bool FindCenter, bool divide_images) |
void | map_images_fixedgrid (Source *source, GridHndl grid, int *Nimages, std::vector< ImageInfo > &imageinfo, double xmax, bool divide_images, bool find_borders) |
Find the images without any additional grid refinement or ray shooting. | |
void | map_imagesISOP (LensHndl lens, Source *source, GridHndl grid, int *Nimages, std::vector< ImageInfo > &imageinfo, double rmax, double res_min, double initial_size, ExitCriterion criterion, bool divide_images, bool int_on=true, bool verbos=false) |
Find images and refine them based on their surface brightness distribution. | |
short | find_peaks (LensHndl lens, GridHndl grid, PosType rEinsteinMin, PosType kappa_max, std::vector< ImageInfo > &imageinfo, int *Nimages) |
Refines the grid based on the convergence so that high density regions have high resolution. | |
The ImageFinding namespace is for functions related to finding and mapping images.
void ImageFinding::find_contour | ( | LensHndl | lens, |
GridHndl | grid, | ||
std::vector< CriticalCurve > & | crtcurve, | ||
int * | Ncrits, | ||
PosType | resolution, | ||
bool * | orderingsuccess, | ||
bool | ordercurve, | ||
bool | dividecurves, | ||
double | contour_value, | ||
LensingVariable | contour_type, | ||
bool | verbose = false ) |
Finds iso kappa contours.
Finding
lens | The lens model. |
grid | The grid. It must be initialized. |
crtcurve | Structure to hold critical curve. Must be pre-allocated with maxNcrit elements. Stored in critcurve[i].imagekist. |
Ncrits | The number of critical curves found. |
resolution | The target resolution that the critical curve is mapped on the image plane. |
orderingsuccess | true if ordering was successful. |
ordercurve | Order the curve so that it can be drawn or used to find the winding number. |
dividecurves | Divide the critical curves into seporate curves by whether they are attached |
contour_value | value at which the contour is wanted |
contour_type | KAPPA, INVMAG or DELAYT |
void ImageFinding::find_crit | ( | Lens & | lens, |
GridMap & | gridmap, | ||
std::vector< CriticalCurve > & | critcurves, | ||
bool | verbose = false ) |
lens | The lens model. |
gridmap | The grid. It must be initialized. |
critcurves | Structure to hold critical curve. |
void ImageFinding::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.
Finding
The critical curve is found by refining the edges of regions of negative magnification. If there are no regions of negative magnification in the original grid the grid is refined around the point of highest kappa. If there are other points of high kappa that are not of interest one should be careful that the region of interest is not missed. For this reason critical curves that are smaller than the grid resolution (could be un-uniform) are not guaranteed to be found.
After the borders of the negative regions are found the code looks for radial and pseudo caustics within the island. It usually finds at least one, but if there are more than one per island some might be missed.
All the critical curve / caustic pairs are classified as radial, tangential or pseudo. small enough radial critical curve could be miss classified as a pseudo caustic.
Structure to hold critical curve. Must be pre-
make some figures
make some figures
make some figures
make some figures
lens | The lens model. |
grid | The grid. It must be initialized. |
crtcurve | Structure to hold critical curve. |
Ncrits | The number of critical curves found. |
resolution | The target resolution that the critical curve is mapped on the image plane. |
invmag_min | finds regions with 1/magnification < invmag_min, set to zero for caustics |
void ImageFinding::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.
Finding
find_images_kist returns finite refined images in images[0...*Nimages-1].imagekist It starts with a large source and reduces down to the right size refining at each step. It should not miss any image larger than ~ munin*r_source linear size, but seems to do much better than that. It does nothing with the surface brightnesses.
The routine can follow three different strategies for refining each image controlled by edge_refinement.
edge_refinement
y_source | contains the lens/es and source/sources position of source center |
r_source | radius of source |
grid | grid provided to routine |
Nimages | number of images found |
imageinfo | information on each image |
Nimagepoints | number of points in final images |
initial_size | Initial size of source for telescoping, 0 to start from the initial grid size. |
splitimages | true each image is refined to target accuracy, otherwise all images are treated as one |
edge_refinement | see comment |
verbose | verbose |
void ImageFinding::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.
Finding
ImageFinding::find_images_kist returns finite refined images in images[0...*Nimages-1].imagekist It starts with a large source and reduces down to the right size refining at each step. It should not miss any image larger than ~ munin*r_source linear size, but seems to do much better than that. It does nothing with the surface brightnesses.
The routine can follow three different strategies for refining each image controlled by edge_refinement.
edge_refinement
When finding a finite sized source these quantities are generally not required and slow down the routine.
y_source | contains the lens/es and source/sources position of source center |
r_source | radius of source |
grid | grid provided to routine |
Nimages | number of images found |
imageinfo | information on each image |
Nimagepoints | number of points in final images |
initial_size | Initial size of source for telescoping, 0 to start from the initial grid size. |
splitimages | true each image is refined to target accuracy, otherwise all images are treated as one |
edge_refinement | see comment |
verbose | verbose |
void ImageFinding::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()
y_source | contains the lens/es and source/sources position of source center |
r_source | radius of source |
grid | grid provided to routine |
Nimages | number of images found |
imageinfo | information on each image |
Nimagepoints | number of points in final images |
initial_size | Initial size of source for telescoping, 0 to start from the initial grid size. |
splitimages | TRUE each image is refined to target accuracy, otherwise all images are treated as one |
edge_refinement | see comment |
verbose | verbose |
short ImageFinding::find_peaks | ( | LensHndl | lens, |
GridHndl | grid, | ||
PosType | rEinsteinMin, | ||
PosType | kappa_max, | ||
std::vector< ImageInfo > & | imageinfo, | ||
int * | Nimages ) |
Refines the grid based on the convergence so that high density regions have high resolution.
Finding
No source is used in this process. The code acts as if all the mass is in SIS halos iteratively increasing the resolution and kappa threshhold until the desired resolution is found.
CritType ImageFinding::find_pseudo | ( | ImageInfo & | pseudocurve, |
ImageInfo & | negimage, | ||
PosType | pseudolimit, | ||
LensHndl | lens, | ||
GridHndl | grid, | ||
PosType | resolution, | ||
Kist< Point > & | paritypoints, | ||
bool | TEST = false ) |
remove all but the points below tmp_pseudolimit
void ImageFinding::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.
image points are put into imageinfo[].imagekist imageinfo[].points and imageinfo[].Npoints are not changed
splitparities= 0 don't split attached negative and positive parity images = 1 do split parities NOTE: this is now obsolete = -1 doesn't slit into images at all , also does not find borders or change in_image markers true_images = 1 gives just the points that are in the image = 0 if there are not enough points in images this will include close points to be refined
side-effects : Will make in_image = true for all image points if splitparities == 0
< >
void ImageFinding::map_images_fixedgrid | ( | Source * | source, |
GridHndl | grid, | ||
int * | Nimages, | ||
std::vector< ImageInfo > & | imageinfo, | ||
double | xmax, | ||
bool | divide_images, | ||
bool | find_borders ) |
Find the images without any additional grid refinement or ray shooting.
Finding
The images and surface brighnesses are found. This will be much faster than map_images(), but will miss images that are not resolved on the current grid.
The surface brightnesses on all of the grid are refreshed. The images centroids and gridranges are maintained.
grid | Tree of grid points |
Nimages | number of images found |
imageinfo | information on each image |
xmax | Maximum size of source on image plane. The entire source must be within this distance from source->getTheta()[]. Decreasing it will make the code run faster. Making xmax much bigger than the grid boundaries will check all points for surface brightness. |
divide_images | if true will divide images. |
find_borders | if true will find the inner and outer borders of each image |
void ImageFinding::map_imagesISOP | ( | LensHndl | lens, |
Source * | source, | ||
GridHndl | grid, | ||
int * | Nimages, | ||
std::vector< ImageInfo > & | imageinfo, | ||
double | rmax, | ||
double | res_min, | ||
double | initial_size, | ||
ExitCriterion | criterion, | ||
bool | divide_images, | ||
bool | int_on = true, | ||
bool | verbose = false ) |
Find images and refine them based on their surface brightness distribution.
Finding
Uses ImageFinding::find_images_kist() to initially find and refine images and then using IF_routines::IntegrateFluxInCell(). If cells cannot be integrated refiments are madebased on a surface brightness based criterion to refine the most important parts of the lens.
map_images is intended for mapping images of sources more complicated than simple circles.
lens | model |
grid | Tree of grid points |
Nimages | number of images found |
imageinfo | information on each image |
rmax | Maximum size of source on souce plane. The entire source must be within this distance from source->getTheta()[] |
res_min | requred resolution of image, typically the pixel size of the final image |
initial_size | Initial size of source for telescoping, 0 to start from the initial grid size. If < 0 no telescoping is used and only the already existing points are used to to initiate the image finding. |
criterion | see data type |
divide_images | if true will divide images and apply the exit criterion to them separately. |
int_on | if true the flux in each cell is integrated, if false the surface brightness at the center point of the cell is used |
PixelMap< T > ImageFinding::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 the caustic type + 1 ( 2=radial,3=tangential,4=pseudo )
critcurves | list of critical curves |
Nx | number of pixels to each size |
PixelMap< T > ImageFinding::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 the caustic type + 1 ( 2=radial,3=tangential,4=pseudo )
critcurves | list of critical curves |
Nx | number of pixels to each size |