|
def | makeGalaxy (flux, gal, psfImage, galType='sersic', cosmosCat=None, drawMethod='no_pixel', trunc=10.0, transform=None, addShear=False, calib=None, sersic_prec=0.01, addPoisson=False) |
|
def | parseRealGalaxy (gal) |
|
def | parseDoubleSersic (tflux, gal) |
|
def | arrayToGSObj (imgArr, scale=1.0, norm=False) |
|
def | galSimDrawImage (galObj, size=0, scale=1.0, method="no_pixel", addPoisson=False) |
|
def | galSimConvolve (galObj, psfObj, size=0, scale=1.0, method="no_pixel", returnObj=False) |
|
def | galSimAdd (galObjList, size=0, scale=1.0, method="no_pixel", returnArr=False) |
|
def | plotFakeGalaxy (galObj, galID=None, suffix=None, size=0, addPoisson=False) |
|
def | galSimFakeCosmos (cosmosCat, calib, gal, psfImage=None, plotFake=False, returnObj=True, sersic_prec=0.02, drawMethod='no_pixel', scale=1.0, transform=None, addShear=False, addPoisson=False) |
|
def | galSimFakeSersic (flux, gal, psfImage=None, scaleRad=False, returnObj=True, expAll=False, devAll=False, plotFake=False, trunc=0, drawMethod="no_pixel", addPoisson=False, scale=1.0, transform=None, addShear=False) |
|
def | galSimFakeDoubleSersic (comp1, comp2, psfImage=None, trunc=0, returnObj=True, devExp=False, plotFake=False, drawMethod='auto', addPoisson=False, scale=1.0, transform=None, addShear=False) |
|
def | galSimRealGalaxy (flux, real_galaxy_catalog, index=None, psfImage=None, random=False, returnObj=True, plotFake=False, drawMethod='auto', addPoisson=False, scale=1.0, transform=None) |
|
def | testMakeFake (galList, asciiTab=False, single=True, double=True, real=True) |
|
def lsst.synpipe.makeFakeGalaxy.galSimDrawImage |
( |
|
galObj, |
|
|
|
size = 0 , |
|
|
|
scale = 1.0 , |
|
|
|
method = "no_pixel" , |
|
|
|
addPoisson = False |
|
) |
| |
"Draw" a GalSim Object into an GalSim Image using certain method, and with
certain size
TODO : Think about the scale here:
By default scale=None
According to GalSim Doxygen :
If provided, use this as the pixel scale for the image. If scale is None
and image != None, then take the provided image's pixel scale.
If scale is None and image == None, then use the Nyquist scale.
If scale <= 0 (regardless of image), then use the Nyquist scale.
Definition at line 186 of file makeFakeGalaxy.py.
188 "Draw" a GalSim Object into an GalSim Image using certain method, and with 191 TODO : Think about the scale here: 192 By default scale=None 193 According to GalSim Doxygen : 194 If provided, use this as the pixel scale for the image. If scale is None 195 and image != None, then take the provided image's pixel scale. 196 If scale is None and image == None, then use the Nyquist scale. 197 If scale <= 0 (regardless of image), then use the Nyquist scale. 202 imgTemp = galsim.image.Image(size, size)
203 galImg = galObj.drawImage(imgTemp, scale=scale, method=method)
205 galImg = galObj.drawImage(scale=scale, method=method)
209 galImg.addNoise(galsim.PoissonNoise())
def lsst.synpipe.makeFakeGalaxy.galSimFakeDoubleSersic |
( |
|
comp1, |
|
|
|
comp2, |
|
|
|
psfImage = None , |
|
|
|
trunc = 0 , |
|
|
|
returnObj = True , |
|
|
|
devExp = False , |
|
|
|
plotFake = False , |
|
|
|
drawMethod = 'auto' , |
|
|
|
addPoisson = False , |
|
|
|
scale = 1.0 , |
|
|
|
transform = None , |
|
|
|
addShear = False |
|
) |
| |
Make a fake double Sersic galaxy using the galSim.Sersic function
Inputs: total flux of the galaxy, and a record array that stores the
necessary parameters [reffPix, nSersic, axisRatio, posAng]
Output: a 2-D image array of the galaxy model OR
a GalSim object of the model
Options:
psfImage: PSF image for convolution
trunc: Flux of Sersic models will truncate at trunc * reffPix
radius; trunc=0 means no truncation
drawMethod: The method for drawImage: ['auto', 'fft', 'real_space']
addPoisson: Add Poisson noise
plotFake: Generate a PNG figure of the model
devexp: The first component will be seen as a nSersic=4 bulge;
And, the second one will be seen as a nSersic=1 disk
returnObj: If TRUE, will return the GSObj
Definition at line 479 of file makeFakeGalaxy.py.
481 Make a fake double Sersic galaxy using the galSim.Sersic function 483 Inputs: total flux of the galaxy, and a record array that stores the 484 necessary parameters [reffPix, nSersic, axisRatio, posAng] 486 Output: a 2-D image array of the galaxy model OR 487 a GalSim object of the model 490 psfImage: PSF image for convolution 491 trunc: Flux of Sersic models will truncate at trunc * reffPix 492 radius; trunc=0 means no truncation 493 drawMethod: The method for drawImage: ['auto', 'fft', 'real_space'] 494 addPoisson: Add Poisson noise 495 plotFake: Generate a PNG figure of the model 496 devexp: The first component will be seen as a nSersic=4 bulge; 497 And, the second one will be seen as a nSersic=1 disk 498 returnObj: If TRUE, will return the GSObj 502 flux1 =
float(comp1[
'mag'])
503 flux2 =
float(comp2[
'mag'])
510 trunc=trunc, addShear=addShear)
512 trunc=trunc, addShear=addShear)
520 doubleSersic =
galSimAdd([serModel1, serModel2])
523 if transform
is not None:
524 doubleSersic = doubleSersic.transform(*tuple(transform.ravel()))
527 if psfImage
is not None:
531 dserFinal = galsim.Convolve([doubleSersic, psfObj])
533 dserFinal = doubleSersic
547 addPoisson=addPoisson)
def galSimFakeSersic(flux, gal, psfImage=None, scaleRad=False, returnObj=True, expAll=False, devAll=False, plotFake=False, trunc=0, drawMethod="no_pixel", addPoisson=False, scale=1.0, transform=None, addShear=False)
def galSimAdd(galObjList, size=0, scale=1.0, method="no_pixel", returnArr=False)
def plotFakeGalaxy(galObj, galID=None, suffix=None, size=0, addPoisson=False)
def arrayToGSObj(imgArr, scale=1.0, norm=False)
def galSimDrawImage(galObj, size=0, scale=1.0, method="no_pixel", addPoisson=False)
def lsst.synpipe.makeFakeGalaxy.galSimFakeSersic |
( |
|
flux, |
|
|
|
gal, |
|
|
|
psfImage = None , |
|
|
|
scaleRad = False , |
|
|
|
returnObj = True , |
|
|
|
expAll = False , |
|
|
|
devAll = False , |
|
|
|
plotFake = False , |
|
|
|
trunc = 0 , |
|
|
|
drawMethod = "no_pixel" , |
|
|
|
addPoisson = False , |
|
|
|
scale = 1.0 , |
|
|
|
transform = None , |
|
|
|
addShear = False |
|
) |
| |
Make a fake single Sersic galaxy using the galSim.Sersic function
Inputs: total flux of the galaxy, and a record array that stores the
necessary parameters [reffPix, nSersic, axisRatio, posAng]
Output: a 2-D image array of the galaxy model OR
a GalSim object of the model
Options:
psfImage: PSF image for convolution
trunc: Flux of Sersic models will truncate at trunc * reffPix
radius; trunc=0 means no truncation
drawMethod: The method for drawImage: ['auto', 'fft', 'real_space']
addPoisson: Add Poisson noise
plotFake: Generate a PNG figure of the model
expAll: Input model will be seen as nSersic=1
devAll: Input model will be seen as nSersic=4
returnObj: If TRUE, will return the GSObj
Definition at line 374 of file makeFakeGalaxy.py.
374 transform=
None, addShear=
False):
376 Make a fake single Sersic galaxy using the galSim.Sersic function 378 Inputs: total flux of the galaxy, and a record array that stores the 379 necessary parameters [reffPix, nSersic, axisRatio, posAng] 381 Output: a 2-D image array of the galaxy model OR 382 a GalSim object of the model 385 psfImage: PSF image for convolution 386 trunc: Flux of Sersic models will truncate at trunc * reffPix 387 radius; trunc=0 means no truncation 388 drawMethod: The method for drawImage: ['auto', 'fft', 'real_space'] 389 addPoisson: Add Poisson noise 390 plotFake: Generate a PNG figure of the model 391 expAll: Input model will be seen as nSersic=1 392 devAll: Input model will be seen as nSersic=4 393 returnObj: If TRUE, will return the GSObj 395 reff =
float(gal[
"reff"])
396 posAng =
float(gal[
"theta"])
397 axisRatio =
float(gal[
"b_a"])
398 nSersic =
float(gal[
"sersic_n"])
406 raise ValueError(
"Sersic index is too large! Should be <= 6.0")
408 if axisRatio <= 0.05:
409 raise ValueError(
"Axis Ratio is too small! Should be >= 0.05")
412 if nSersic == 1.0
or expAll:
414 serObj = galsim.Exponential(scale_radius=reff)
416 serObj = galsim.Exponential(half_light_radius=reff)
418 print(
" * Treated as a n=1 Exponential disk : %d" % (gal[
"ID"]))
419 elif nSersic == 4.0
or devAll:
420 serObj = galsim.DeVaucouleurs(half_light_radius=reff, trunc=trunc)
422 print(
" * Treated as a n=4 De Vaucouleurs model: %d" % (gal[
"ID"]))
424 serObj = galsim.Sersic(nSersic, half_light_radius=reff)
426 serObj = galsim.Sersic(nSersic, half_light_radius=reff,
431 serObj = serObj.shear(q=axisRatio, beta=(0.0 * galsim.degrees))
435 serObj = serObj.rotate((90.0 - posAng) * galsim.degrees)
440 g1 =
float(gal[
'g1'])
441 g2 =
float(gal[
'g2'])
442 serObj = serObj.shear(g1=g1, g2=g2)
444 warnings.warn(
"Can not find g1 or g2 in the input!\n",
445 " No shear has been added!")
448 if transform
is not None:
449 serObj = serObj.transform(*tuple(transform.ravel()))
452 serObj = serObj.withFlux(
float(flux))
455 if psfImage
is not None:
459 serFinal = galsim.Convolve([serObj, psfObj])
472 addPoisson=addPoisson)
def plotFakeGalaxy(galObj, galID=None, suffix=None, size=0, addPoisson=False)
def arrayToGSObj(imgArr, scale=1.0, norm=False)
def galSimDrawImage(galObj, size=0, scale=1.0, method="no_pixel", addPoisson=False)