@@ -79,7 +79,7 @@ def _add_fake_sources(exposure, objects, calibFluxRadius=12.0, logger=None):
79
79
posd = galsim .PositionD (pt .x , pt .y )
80
80
posi = galsim .PositionI (pt .x // 1 , pt .y // 1 )
81
81
if logger :
82
- logger .debug (f"Adding fake source at { pt } " )
82
+ logger .debug (f"Adding fake source { gsObj } at { pt } " )
83
83
84
84
mat = wcs .linearizePixelToSky (spt , geom .arcseconds ).getMatrix ()
85
85
gsWCS = galsim .JacobianWCS (mat [0 , 0 ], mat [0 , 1 ], mat [1 , 0 ], mat [1 , 1 ])
@@ -762,6 +762,8 @@ def add_to_replace_dict(new_name, depr_name, std_name):
762
762
cfg .sourceSelectionColName ,
763
763
'select'
764
764
)
765
+ if replace_dict :
766
+ self .log .debug ("Replacing columns:" , replace_dict )
765
767
fakeCat = fakeCat .rename (columns = replace_dict , copy = False )
766
768
767
769
# Handling the half-light radius and axis-ratio are trickier, since we
@@ -772,15 +774,18 @@ def add_to_replace_dict(new_name, depr_name, std_name):
772
774
cfg .bulge_semimajor_col in fakeCat .columns
773
775
and cfg .bulge_axis_ratio_col in fakeCat .columns
774
776
):
777
+ replace_dict = {
778
+ cfg .bulge_semimajor_col : 'bulge_semimajor' ,
779
+ cfg .bulge_axis_ratio_col : 'bulge_axis_ratio' ,
780
+ cfg .disk_semimajor_col : 'disk_semimajor' ,
781
+ cfg .disk_axis_ratio_col : 'disk_axis_ratio' ,
782
+ }
775
783
fakeCat = fakeCat .rename (
776
- columns = {
777
- cfg .bulge_semimajor_col : 'bulge_semimajor' ,
778
- cfg .bulge_axis_ratio_col : 'bulge_axis_ratio' ,
779
- cfg .disk_semimajor_col : 'disk_semimajor' ,
780
- cfg .disk_axis_ratio_col : 'disk_axis_ratio' ,
781
- },
784
+ columns = replace_dict ,
782
785
copy = False
783
786
)
787
+ if replace_dict :
788
+ self .log .debug ("Replacing columns:" , replace_dict )
784
789
elif (
785
790
cfg .bulgeHLR in fakeCat .columns
786
791
and cfg .aBulge in fakeCat .columns
@@ -798,6 +803,12 @@ def add_to_replace_dict(new_name, depr_name, std_name):
798
803
fakeCat ['disk_semimajor' ] = (
799
804
fakeCat [cfg .diskHLR ]/ np .sqrt (fakeCat ['disk_axis_ratio' ])
800
805
)
806
+ self .log .debug (
807
+ f"Replacing ({ cfg .bBulge } , { cfg .aBulge } , { cfg .bulgeHLR } , "
808
+ f"{ cfg .bDisk } , { cfg .aDisk } , { cfg .diskHLR } ) with "
809
+ "(bulge_axis_ratio, bulge_semimajor, disk_axis_ratio, "
810
+ "disk_semimajor)"
811
+ )
801
812
else :
802
813
raise ValueError (
803
814
"Could not determine columns for half-light radius and "
@@ -816,12 +827,19 @@ def add_to_replace_dict(new_name, depr_name, std_name):
816
827
},
817
828
copy = False
818
829
)
830
+ self .log .debug (
831
+ f"Replacing { cfg .bulge_flux_fraction_col % band } with "
832
+ " 'bulge_flux_fraction."
833
+ )
819
834
elif cfg .bulge_disk_flux_ratio_col in fakeCat .columns :
835
+ bdfr = cfg .bulge_disk_flux_ratio_col
820
836
fakeCat ['bulge_flux_fraction' ] = (
821
- fakeCat ['bulge_disk_flux_ratio' ] / (1 + fakeCat ['bulge_disk_flux_ratio' ])
837
+ fakeCat [bdfr ] / (1 + fakeCat [bdfr ])
822
838
)
839
+ self .log .debug (f"Replacing { bdfr } with bulge_flux_fraction." )
823
840
else :
824
841
fakeCat ['bulge_flux_fraction' ] = 0.5
842
+ self .log .debug ("Asserting bulge_flux_fraction = 0.5" )
825
843
826
844
return fakeCat
827
845
0 commit comments