Skip to content

Commit

Permalink
Add ultrasat to the filter list
Browse files Browse the repository at this point in the history
  • Loading branch information
mcoughlin committed Dec 4, 2023
1 parent 4bfc5ea commit c1b307b
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 23 deletions.
14 changes: 10 additions & 4 deletions tools/make_lcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def parse():
parser.add_argument(
"--filters",
type=str,
default="sdss::u,sdss::g,sdss::r,sdss::i,sdss::z,swope2::y,swope2::J,swope2::H,cspk,bessellux,bessellb,bessellv,bessellr,besselli,uvot::b,uvot::u,uvot::uvm2,uvot::uvw1,uvot::uvw2,uvot::v,uvot::white",
default="sdss::u,sdss::g,sdss::r,sdss::i,sdss::z,swope2::y,swope2::J,swope2::H,cspk,bessellux,bessellb,bessellv,bessellr,besselli,uvot::b,uvot::u,uvot::uvm2,uvot::uvw1,uvot::uvw2,uvot::v,uvot::white,ultrasat",
help="comma-separated list of filters for photometric lcs; must be from the bandpasses listed here: \
https://sncosmo.readthedocs.io/en/stable/bandpass-list.html",
)
Expand Down Expand Up @@ -77,9 +77,9 @@ def parse():
D_cm = dMpc * 3.0857e16 * 100 # 10 pc in cm
H0 = cosmo.H0.value
CLIGHT = 2.99792458e5
ztest = np.arange(0.0001,1,0.00001)
ztest = np.arange(0.0001, 1, 0.00001)
Dtest = np.array(cosmo.luminosity_distance(ztest).to("Mpc").value)
z = ztest[np.argmin(abs(dMpc-Dtest))]
z = ztest[np.argmin(abs(dMpc - Dtest))]
else:
z = args.z
dMpc = cosmo.luminosity_distance(z).to("Mpc").value
Expand Down Expand Up @@ -151,7 +151,13 @@ def parse():

for ifilt, filt in enumerate(filters):
source = sncosmo.TimeSeriesSource(ph, waves[ifilt], fls[ifilt])
m = source.bandmag(filters[ifilt], "ab", ph)

if filters[ifilt] == "ultrasat":
bandpass = sncosmo.get_bandpass(filters[ifilt], 5.0)
else:
bandpass = sncosmo.get_bandpass(filters[ifilt])

m = source.bandmag(bandpass, "ab", ph)

# apply smoothing filter
# if args.doSmoothing:
Expand Down
14 changes: 10 additions & 4 deletions tools/make_lcs_LANL.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def parse():
parser.add_argument(
"--filters",
type=str,
default="bessellux,bessellb,bessellv,bessellr,besselli,sdssu,ps1::g,ps1::r,ps1::i,ps1::z,ps1::y,uvot::b,uvot::u,uvot::uvm2,uvot::uvw1,uvot::uvw2,uvot::v,uvot::white,atlasc,atlaso,2massj,2massh,2massks,ztfg,ztfr,ztfi",
default="bessellux,bessellb,bessellv,bessellr,besselli,sdssu,ps1::g,ps1::r,ps1::i,ps1::z,ps1::y,uvot::b,uvot::u,uvot::uvm2,uvot::uvw1,uvot::uvw2,uvot::v,uvot::white,atlasc,atlaso,2massj,2massh,2massks,ztfg,ztfr,ztfi,ultrasat",
help="comma-separated list of filters for photometric lcs; must be from the bandpasses listed here: \
https://sncosmo.readthedocs.io/en/stable/bandpass-list.html",
)
Expand Down Expand Up @@ -80,9 +80,9 @@ def parse():
D_cm = dMpc * 3.0857e16 * 100 # 10 pc in cm
H0 = cosmo.H0.value
CLIGHT = 2.99792458e5
ztest = np.arange(0.0001,1,0.00001)
ztest = np.arange(0.0001, 1, 0.00001)
Dtest = np.array(cosmo.luminosity_distance(ztest).to("Mpc").value)
z = ztest[np.argmin(abs(dMpc-Dtest))]
z = ztest[np.argmin(abs(dMpc - Dtest))]
else:
z = args.z
dMpc = cosmo.luminosity_distance(z).to("Mpc").value
Expand Down Expand Up @@ -139,7 +139,13 @@ def parse():

source = sncosmo.TimeSeriesSource(ph, wave, fls)
for ifilt, filt in enumerate(filters):
m = source.bandmag(filters[ifilt], "ab", ph)

if filters[ifilt] == "ultrasat":
bandpass = sncosmo.get_bandpass(filters[ifilt], 5.0)
else:
bandpass = sncosmo.get_bandpass(filters[ifilt])

m = source.bandmag(bandpass, "ab", ph)

# apply smoothing filter
# if args.doSmoothing:
Expand Down
14 changes: 10 additions & 4 deletions tools/make_lcs_hdf5.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def parse():
parser.add_argument(
"--filters",
type=str,
default="bessellux,bessellb,bessellv,bessellr,besselli,sdssu,ps1::g,ps1::r,ps1::i,ps1::z,ps1::y,uvot::b,uvot::u,uvot::uvm2,uvot::uvw1,uvot::uvw2,uvot::v,uvot::white,atlasc,atlaso,2massj,2massh,2massks,ztfg,ztfr,ztfi",
default="bessellux,bessellb,bessellv,bessellr,besselli,sdssu,ps1::g,ps1::r,ps1::i,ps1::z,ps1::y,uvot::b,uvot::u,uvot::uvm2,uvot::uvw1,uvot::uvw2,uvot::v,uvot::white,atlasc,atlaso,2massj,2massh,2massks,ztfg,ztfr,ztfi,ultrasat",
help="comma-separated list of filters for photometric lcs; must be from the bandpasses listed here: \
https://sncosmo.readthedocs.io/en/stable/bandpass-list.html",
)
Expand Down Expand Up @@ -78,9 +78,9 @@ def parse():
D_cm = dMpc * 1e6 * 3.0857e18
H0 = cosmo.H0.value
CLIGHT = 2.99792458e5
ztest = np.arange(0.0001,1,0.00001)
ztest = np.arange(0.0001, 1, 0.00001)
Dtest = np.array(cosmo.luminosity_distance(ztest).to("Mpc").value)
z = ztest[np.argmin(abs(dMpc-Dtest))]
z = ztest[np.argmin(abs(dMpc - Dtest))]
else:
z = args.z
dMpc = cosmo.luminosity_distance(z).to("Mpc").value
Expand Down Expand Up @@ -129,7 +129,13 @@ def parse():
m_tot = []
for filt in filters:
source = sncosmo.TimeSeriesSource(ph, wave, fl)
m = source.bandmag(filt, "ab", ph)

if filt == "ultrasat":
bandpass = sncosmo.get_bandpass(filt, 5.0)
else:
bandpass = sncosmo.get_bandpass(filt)

m = source.bandmag(bandpass, "ab", ph)
m_tot.append(m)

for i, t in enumerate(ph):
Expand Down
28 changes: 17 additions & 11 deletions tools/make_lcs_kasen.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def parse():
parser.add_argument(
"--filters",
type=str,
default="bessellux,bessellb,bessellv,bessellr,besselli,sdssu,ps1::g,ps1::r,ps1::i,ps1::z,ps1::y,uvot::b,uvot::u,uvot::uvm2,uvot::uvw1,uvot::uvw2,uvot::v,uvot::white,atlasc,atlaso,2massj,2massh,2massks,ztfg,ztfr,ztfi",
default="bessellux,bessellb,bessellv,bessellr,besselli,sdssu,ps1::g,ps1::r,ps1::i,ps1::z,ps1::y,uvot::b,uvot::u,uvot::uvm2,uvot::uvw1,uvot::uvw2,uvot::v,uvot::white,atlasc,atlaso,2massj,2massh,2massks,ztfg,ztfr,ztfi,ultrasat",
help="comma-separated list of filters for photometric lcs; must be from the bandpasses listed here: \
https://sncosmo.readthedocs.io/en/stable/bandpass-list.html",
)
Expand Down Expand Up @@ -45,10 +45,10 @@ def parse():
default=False,
)
parser.add_argument(
'--doSmoothing',
help='Employ Savitzky-Golay filter for smoothing',
"--doSmoothing",
help="Employ Savitzky-Golay filter for smoothing",
action="store_true",
default=False
default=False,
)
parser.add_argument(
"--dMpc",
Expand Down Expand Up @@ -139,15 +139,21 @@ def parse():
m_tot = []
for filt in filters:
source = sncosmo.TimeSeriesSource(ph, wave, Llam)
m = source.bandmag(filt, "ab", ph)

#apply smoothing filter
if filt == "ultrasat":
bandpass = sncosmo.get_bandpass(filt, 5.0)
else:
bandpass = sncosmo.get_bandpass(filt)

m = source.bandmag(bandpass, "ab", ph)

# apply smoothing filter
if args.doSmoothing:
ii = np.where(~np.isnan(m))[0]
if len(ii) > 1:
f = interp.interp1d(ph[ii], m[ii], fill_value='extrapolate')
f = interp.interp1d(ph[ii], m[ii], fill_value="extrapolate")
m = f(ph)
m = savgol_filter(m,window_length=17,polyorder=3)
m = savgol_filter(m, window_length=17, polyorder=3)

m_tot.append(m)

Expand Down Expand Up @@ -184,9 +190,9 @@ def parse():

if args.doSmoothing:
ii = np.where(np.isfinite(np.log10(Lbol)))[0]
f = interp.interp1d(ph[ii], np.log10(Lbol[ii]), fill_value='extrapolate')
Lbol = 10**f(ph)
Lbol = savgol_filter(Lbol,window_length=17,polyorder=3)
f = interp.interp1d(ph[ii], np.log10(Lbol[ii]), fill_value="extrapolate")
Lbol = 10 ** f(ph)
Lbol = savgol_filter(Lbol, window_length=17, polyorder=3)

for i, t in enumerate(ph):
if t < 0:
Expand Down

0 comments on commit c1b307b

Please sign in to comment.