I only see E(B-V) SFD values in the DP1 Object Table. Can anybody recommend a method for de-reddening magnitudes (from the psfFluxes) of objects in the forced source on diaObjects table?
Hi Bob – for extinction coefficients to convert from E(B-V) to extinction values in Rubin filters, I’d suggest:
from rubin_sim.phot_utils import DustValues
DustValues().r_x
When I tried this just now, rubin_sim
was available in my RSP environment without having to specifically install it. I believe that for the above to work you’ll also need to set the RUBIN_SIM_DATA_DIR
environment variable to /rubin/rubin_sim_data
. Thanks!
Thank you Aaron, I’ll play with it this weekend!
Okay, I lied about being productive this weekend, but I did get to it:
import os
os.environ[‘RUBIN_SIM_DATA_DIR’] = ‘/rubin/rubin_sim_data’
from rubin_sim.phot_utils import DustValues
dust_values = DustValues()
print(dust_values.r_x)
{‘u’: np.float64(4.757217815396922),
‘g’: np.float64(3.6605664439892625),
‘r’: np.float64(2.70136780871597),
‘i’: np.float64(2.0536599130965882),
‘z’: np.float64(1.5900964472616756),
‘y’: np.float64(1.3077049588254708)}
Apply dust values (dataFrame name from a Jeff Carlin tutorial)
fsodo_sources[‘umag’] = fsodo_sources[‘umag’] - dust_values.r_x[‘u’]
fsodo_sources[‘gmag’] = fsodo_sources[‘gmag’] - dust_values.r_x[‘g’]
fsodo_sources[‘gmag’] = fsodo_sources[‘gmag’] - dust_values.r_x[‘r’]
fsodo_sources[‘rmag’] = fsodo_sources[‘rmag’] - dust_values.r_x[‘i’]
fsodo_sources[‘imag’] = fsodo_sources[‘imag’] - dust_values.r_x[‘z’]
fsodo_sources[‘zmag’] = fsodo_sources[‘zmag’] - dust_values.r_x[‘y’]
So it’s just one number for each filter for the whole sky?
Thank you again for this help, Aaron!
I think this is the proper way to de-redden objects:
import os
(If you copy this, the quote marks below need to be replaced:
os.environ[‘RUBIN_SIM_DATA_DIR’] = ‘/rubin/rubin_sim_data’
from rubin_sim.phot_utils import DustValues
from astropy.coordinates import SkyCoord
import astropy.units as u
from dustmaps.sfd import SFDQuery
set the A_lamba/E(B-V) values for the six ugrizy LSST filters (what are the values for SDSS?)
For LSST [u, g, r, i, z, y]
dust_values = DustValues()
print(dust_values.r_x)
SFD maps are a function of ra and dec:
coord = SkyCoord(ra=fsodo_sources[‘ra’], dec=fsodo_sources[‘dec’], unit=‘deg’)
sfd = SFDQuery()
ebvvec = sfd(coord)
fsodo_sources[‘ebv’] = ebvvec
fsodo_sources[‘umag’] = fsodo_sources[‘umag’] - fsodo_sources[‘ebv’] * dust_values.r_x[‘u’]
fsodo_sources[‘gmag’] = fsodo_sources[‘gmag’] - fsodo_sources[‘ebv’] * dust_values.r_x[‘g’]
fsodo_sources[‘rmag’] = fsodo_sources[‘rmag’] - fsodo_sources[‘ebv’] * dust_values.r_x[‘r’]
fsodo_sources[‘imag’] = fsodo_sources[‘imag’] - fsodo_sources[‘ebv’] * dust_values.r_x[‘i’]
fsodo_sources[‘zmag’] = fsodo_sources[‘zmag’] - fsodo_sources[‘ebv’] * dust_values.r_x[‘z’]
fsodo_sources[‘ymag’] = fsodo_sources[‘ymag’] - fsodo_sources[‘ebv’] * dust_values.r_x[‘y’]
Hi Bob – You are correct that the first version (fsodo_sources[‘umag’] = fsodo_sources[‘umag’] - dust_values.r_x[‘u’]
) is definitely missing the E(B-V) (“ebv”) value that should be multiplied with R_X.
This latest post is correct. If you are using the Object
table (or any table that can be matched to the Object
table via diaObjectId
), there is already a column in the table with “ebv
” that you can use rather than looking up the SFD values.
Thank you Jeff for confirming my code and for the ebv column in the Object table - I’m gonna use that. And thanks again Aaron.