@@ -60,18 +60,6 @@ def setup(self, config, base, xsize, ysize, ignore, logger):
6060 # or cached by the skyCatalogs code.
6161 gal .flux = gal .calculateFlux (bandpass )
6262 self .flux = gal .flux
63- # Cap (star) flux at 30M photons to avoid gross artifacts when trying
64- # to draw the Roman PSF in finite time and memory
65- flux_cap = 3e7
66- if self .flux > flux_cap :
67- if (
68- hasattr (gal , "original" )
69- and hasattr (gal .original , "original" )
70- and isinstance (gal .original .original , galsim .DeltaFunction )
71- ) or (isinstance (gal , galsim .DeltaFunction )):
72- gal = gal .withFlux (flux_cap , bandpass )
73- self .flux = flux_cap
74- gal .flux = flux_cap
7563 base ["flux" ] = gal .flux
7664 base ["mag" ] = - 2.5 * np .log10 (gal .flux ) + bandpass .zeropoint
7765 # print('stamp setup2',process.memory_info().rss)
@@ -284,9 +272,6 @@ def draw(self, prof, image, method, offset, config, base, logger):
284272 # print('stamp draw2',process.memory_info().rss)
285273
286274 if method == "phot" :
287- # We already calculated realized_flux above. Use that now and tell GalSim not
288- # recalculate the Poisson realization of the flux.
289- gal = gal .withFlux (self .realized_flux , bandpass )
290275 # print('stamp draw3b ',process.memory_info().rss)
291276
292277 if not faint and "photon_ops" in config :
@@ -306,7 +291,7 @@ def draw(self, prof, image, method, offset, config, base, logger):
306291
307292 # print('stamp draw3a',process.memory_info().rss)
308293 gal .drawImage (
309- bandpass ,
294+ bandpass = bandpass ,
310295 method = "phot" ,
311296 offset = offset ,
312297 rng = self .rng ,
@@ -316,7 +301,7 @@ def draw(self, prof, image, method, offset, config, base, logger):
316301 photon_ops = photon_ops ,
317302 sensor = None ,
318303 add_to_image = True ,
319- poisson_flux = False ,
304+ poisson_flux = True ,
320305 )
321306 else :
322307 fft_image = image .copy ()
@@ -337,10 +322,9 @@ def draw(self, prof, image, method, offset, config, base, logger):
337322 )
338323
339324 # Go back to a combined convolution for fft drawing.
340- gal = gal .withFlux (self .flux , bandpass )
341325 prof = galsim .Convolve ([gal ] + psfs )
342326 try :
343- prof .drawImage (bandpass , ** kwargs )
327+ prof .drawImage (bandpass = bandpass , ** kwargs )
344328 except galsim .errors .GalSimFFTSizeError as e :
345329 # I think this shouldn't happen with the updates I made to how the image size
346330 # is calculated, even for extremely bright things. So it should be ok to
0 commit comments