Skip to content

Commit

Permalink
try block fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mpaillassa committed Jun 17, 2022
1 parent 0866e46 commit 5457bf2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions btk/draw_blends.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,9 +616,10 @@ def render_single(self, entry, filt, psf, survey, extra_data):
# get galaxy flux
try:
mag_name = f"{survey.name}_{filt.name}"
gal_flux = mag2counts(entry[mag_name], survey, filt).to_value("electron")
gal_mag = entry[mag_name]
except KeyError:
gal_flux = mag2counts(entry["ref_mag"], survey, filt).to_value("electron")
gal_mag = entry["ref_mag"]
gal_flux = mag2counts(gal_mag, survey, filt).to_value("electron")

gal = galsim_catalog.makeGalaxy(
entry["btk_index"], gal_type=self.gal_type, noise_pad_size=0
Expand Down

0 comments on commit 5457bf2

Please sign in to comment.