@@ -371,12 +371,6 @@ class InsertFakesConfig(PipelineTaskConfig,
371
371
default = "disk_n" ,
372
372
)
373
373
374
- bulge_disk_flux_ratio_col = pexConfig .Field (
375
- doc = "Source catalog column name for the bulge/disk flux ratio." ,
376
- dtype = str ,
377
- default = "bulge_disk_flux_ratio" ,
378
- )
379
-
380
374
mag_col = pexConfig .Field (
381
375
doc = "Source catalog column name template for magnitudes, in the format "
382
376
"``filter name``_mag_col. E.g., if this config variable is set to "
@@ -386,6 +380,13 @@ class InsertFakesConfig(PipelineTaskConfig,
386
380
default = "%s_mag"
387
381
)
388
382
383
+ bulge_flux_fraction_col = pexConfig .Field (
384
+ doc = "Source catalog column name for fraction of flux in bulge "
385
+ "component." ,
386
+ dtype = str ,
387
+ default = "%s_bulge_flux_fraction"
388
+ )
389
+
389
390
select_col = pexConfig .Field (
390
391
doc = "Source catalog column name to be used to select which sources to "
391
392
"add." ,
@@ -407,6 +408,13 @@ class InsertFakesConfig(PipelineTaskConfig,
407
408
408
409
# Deprecated config variables
409
410
411
+ bulge_disk_flux_ratio_col = pexConfig .Field (
412
+ doc = "Source catalog column name for the bulge/disk flux ratio." ,
413
+ dtype = str ,
414
+ default = "bulge_disk_flux_ratio" ,
415
+ deprecated = "Use `bulge_flux_fraction_col` instead."
416
+ )
417
+
410
418
raColName = pexConfig .Field (
411
419
doc = "RA column name used in the fake source catalog." ,
412
420
dtype = str ,
@@ -789,16 +797,23 @@ def add_to_replace_dict(new_name, depr_name, std_name):
789
797
"axis ratio."
790
798
)
791
799
792
- # Process the bulge/disk flux ratio if possible.
793
- if cfg .bulge_disk_flux_ratio_col in fakeCat .columns :
800
+ # Populate bulge_flux_fraction using either new-style with string interpolation,
801
+ # or old-style from b/d flux ratio. If neither are available, fall back to
802
+ # deprecated behavior of bd flux ratio = 1.0, or equivalently,
803
+ # bulge_flux_fraction=0.5
804
+ if cfg .bulge_flux_fraction_col % band in fakeCat .columns :
794
805
fakeCat = fakeCat .rename (
795
806
columns = {
796
- cfg .bulge_disk_flux_ratio_col : 'bulge_disk_flux_ratio '
807
+ cfg .bulge_flux_fraction_col % band : 'bulge_flux_fraction '
797
808
},
798
809
copy = False
799
810
)
811
+ elif cfg .bulge_disk_flux_ratio_col in fakeCat .columns :
812
+ fakeCat ['bulge_flux_fraction' ] = (
813
+ fakeCat ['bulge_disk_flux_ratio' ] / (1 + fakeCat ['bulge_disk_flux_ratio' ])
814
+ )
800
815
else :
801
- fakeCat ['bulge_disk_flux_ratio ' ] = 1.0
816
+ fakeCat ['bulge_flux_fraction ' ] = 0.5
802
817
803
818
return fakeCat
804
819
@@ -850,7 +865,7 @@ def _generateGSObjectsFromCatalog(self, exposure, fakeCat, galCheckVal, starChec
850
865
disk = galsim .Sersic (n = row ['disk_n' ], half_light_radius = disk_gs_HLR )
851
866
disk = disk .shear (q = row ['disk_axis_ratio' ], beta = ((90 - row ['disk_pa' ])* galsim .degrees ))
852
867
853
- gal = bulge * row ['bulge_disk_flux_ratio ' ] + disk
868
+ gal = bulge * row ['bulge_flux_fraction ' ] + disk * ( 1 - row [ 'bulge_flux_fraction' ])
854
869
gal = gal .withFlux (flux )
855
870
856
871
yield skyCoord , gal
@@ -1159,7 +1174,7 @@ def mkFakeGalsimGalaxies(self, fakeCat, band, photoCalib, pixelScale, psf, image
1159
1174
disk = galsim .Sersic (n = row ['disk_n' ], half_light_radius = disk_gs_HLR )
1160
1175
disk = disk .shear (q = row ['disk_axis_ratio' ], beta = ((90 - row ['disk_pa' ])* galsim .degrees ))
1161
1176
1162
- gal = bulge * row ['bulge_disk_flux_ratio ' ] + disk
1177
+ gal = bulge * row ['bulge_flux_fraction ' ] + disk * ( 1 - row [ 'bulge_flux_fraction' ])
1163
1178
gal = gal .withFlux (flux )
1164
1179
1165
1180
psfIm = galsim .InterpolatedImage (galsim .Image (psfKernel ), scale = pixelScale )
0 commit comments