Skip to content

Commit

Permalink
Let SED config normalization by quantiful
Browse files Browse the repository at this point in the history
  • Loading branch information
jmeyers314 committed Sep 13, 2024
1 parent b5ffdf7 commit 771d45b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 7 additions & 3 deletions galsim/config/sed.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,12 @@ def buildSED(self, config, base, logger):
'wave_type': (Unit, str),
'flux_type': (Unit, str),
}
opt = {'norm_flux_density': float, 'norm_wavelength': float,
'norm_flux': float, 'redshift': float}
opt = {
'norm_flux_density': (float, Quantity),
'norm_wavelength': (float, Quantity),
'norm_flux': float,
'redshift': float
}
ignore = ['norm_bandpass']

kwargs, safe = GetAllParams(config, base, req=req, opt=opt, ignore=ignore)
Expand All @@ -155,7 +159,7 @@ def buildSED(self, config, base, logger):

logger.info("Using SED file: %s",file_name)
sed = read_sed_file(file_name, wave_type, flux_type)
if norm_flux_density:
if norm_flux_density is not None:
sed = sed.withFluxDensity(norm_flux_density, wavelength=norm_wavelength)
elif norm_flux:
bandpass, safe1 = BuildBandpass(config, 'norm_bandpass', base, logger)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_config_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -3289,8 +3289,8 @@ def test_sensor():
'file_name': 'CWW_E_ext.sed',
'wave_type': 'Ang',
'flux_type': 'flambda',
'norm_flux_density': 1.0,
'norm_wavelength': 500,
'norm_flux_density': 1.0*u.erg/u.s/u.cm**2/u.nm,
'norm_wavelength': 500*u.nm,
'redshift' : '@gal.redshift',
},
},
Expand Down

0 comments on commit 771d45b

Please sign in to comment.