37
37
- obj = galsim.Sersic(n, half_light_radius, trunc)
38
38
- psf = galsim.OpticalPSF(..., aberrations=aberrations, ...)
39
39
- obj = obj.dilate(scale)
40
+ - str(obj)
40
41
- image.scale = pixel_scale
41
42
- obj.drawImage(image, method='fft')
42
43
- obj.drawImage(image, method='phot', max_extra_noise, rng)
@@ -69,6 +70,9 @@ def main(argv):
69
70
# To turn off logging:
70
71
#logger.propagate = False
71
72
73
+ # To turn on the debugging messages:
74
+ #logger.setLevel(logging.DEBUG)
75
+
72
76
# Define some parameters we'll use below.
73
77
74
78
# Make output directory if not already present.
@@ -200,11 +204,23 @@ def main(argv):
200
204
for ipsf in range (len (psfs )):
201
205
psf = psfs [ipsf ]
202
206
psf_name = psf_names [ipsf ]
207
+ logger .info ('psf %d: %s' ,ipsf + 1 ,psf )
208
+ # Note that this implicitly calls str(psf). We've made an effort to give all GalSim
209
+ # objects an informative but relatively succinct str representation. Some details may
210
+ # be missing, but it should look essentially like how you would create the object.
211
+ logger .debug ('repr = %r' ,psf )
212
+ # The repr() version are a bit more pedantic in form and should be completely informative,
213
+ # to the point where two objects that are not identical should never have equal repr
214
+ # strings. As such the repr strings may in some cases be somewhat unwieldy. For instance,
215
+ # since we set non-default gsparams in these, the repr includes that information, but
216
+ # it is omitted from the str for brevity.
203
217
for igal in range (len (gals )):
204
218
gal = gals [igal ]
205
219
gal_name = gal_names [igal ]
220
+ logger .info (' galaxy %d: %s' ,igal + 1 ,gal )
221
+ logger .debug (' repr = %r' ,gal )
206
222
for i in range (4 ):
207
- logger .debug ('Start work on image %d' ,i )
223
+ logger .debug (' Start work on image %d' ,i )
208
224
t1 = time .time ()
209
225
210
226
# Initialize the random number generator we will be using.
@@ -240,7 +256,7 @@ def main(argv):
240
256
fft_image = image [galsim .BoundsI (1 , nx , 1 , ny )]
241
257
phot_image = image [galsim .BoundsI (nx + 3 , 2 * nx + 2 , 1 , ny )]
242
258
243
- logger .debug (' Read in training sample galaxy and PSF from file' )
259
+ logger .debug (' Read in training sample galaxy and PSF from file' )
244
260
t2 = time .time ()
245
261
246
262
# Draw the profile
@@ -252,7 +268,7 @@ def main(argv):
252
268
# for illustrative purposes.)
253
269
final .drawImage (fft_image , method = 'fft' )
254
270
255
- logger .debug (' Drew fft image. Total drawn flux = %f. .flux = %f' ,
271
+ logger .debug (' Drew fft image. Total drawn flux = %f. .flux = %f' ,
256
272
fft_image .array .sum (),final .getFlux ())
257
273
t3 = time .time ()
258
274
@@ -285,17 +301,17 @@ def main(argv):
285
301
# image, we need to subtract the mean back off when we are done.
286
302
phot_image -= sky_level_pixel
287
303
288
- logger .debug (' Added Poisson noise. Image fluxes are now %f and %f' ,
304
+ logger .debug (' Added Poisson noise. Image fluxes are now %f and %f' ,
289
305
fft_image .array .sum (), phot_image .array .sum ())
290
306
t6 = time .time ()
291
307
292
308
# Store that into the list of all images
293
309
all_images += [image ]
294
310
295
311
k = k + 1
296
- logger .info ('%d: %s * %s, flux = %.2e, hlr = %.2f, ellip = (%.2f,%.2f)' ,
297
- k ,gal_name , psf_name , flux , hlr , gal_shape .getE1 (), gal_shape .getE2 ())
298
- logger .debug (' Times: %f, %f, %f, %f, %f' ,t2 - t1 , t3 - t2 , t4 - t3 , t5 - t4 , t6 - t5 )
312
+ logger .info (' %d: flux = %.2e, hlr = %.2f, ellip = (%.2f,%.2f)' ,
313
+ k , flux , hlr , gal_shape .getE1 (), gal_shape .getE2 ())
314
+ logger .debug (' Times: %f, %f, %f, %f, %f' ,t2 - t1 , t3 - t2 , t4 - t3 , t5 - t4 , t6 - t5 )
299
315
300
316
psf_times [ipsf ] += t6 - t1
301
317
psf_fft_times [ipsf ] += t3 - t2
0 commit comments