npars = data.size // infodict['nwave']
data_flat = data.reshape((npars,infodict['nwave']))

# This next bit converts to flambda in vacuum, via the flattened copy:
for i in xrange(npars):
    data_flat[i] *= (hires_dwave_air / hires_dwave)

# What is the resolution that we want to add in order
# to make the SDSS pixel width?
sdss_dloglam = 0.0001
sdss_dwave = sdss_dloglam * hires_wave * n.log(10.)

# This constructs the blurring matrix to SDSS resolution.
# We use hires_dwave_air to avoid the 2000Ang airtovac discontinuity
# without being significantly incorrect about wavelength.
sdss_blur = pxs.gauss_blur_matrix(hires_wavebound, n.sqrt(sdss_dwave**2 - hires_dwave_air**2))

# Wavelength range for rebinned SDSS version to be bounded by
# the following, which at least covers ugriz:
wave_sdss_lo = 2900.
wave_sdss_hi = 12000.
coeff1 = sdss_dloglam
coeff0 = coeff1 * n.floor(n.log10(wave_sdss_lo) / coeff1)
naxis1 = int(n.ceil(1. + (n.log10(wave_sdss_hi) - coeff0) / coeff1))

loglam_sdss = coeff0 + coeff1 * n.arange(naxis1)
logbound_sdss = pxs.cen2bound(loglam_sdss)
wavebound_sdss = 10.**logbound_sdss

# Initialize array for rebinned blurred stars:
cap_sdssbin = n.zeros((npars, naxis1), dtype=float)
# This will work:
#ssp_dwave = 10.**(ssp_loglam + 0.5 * dloglam) - \
#            10.**(ssp_loglam - 0.5 * dloglam)
#ssp_dwave = ssp_wave * (10**(dloglam/2.) - 10.**(-dloglam/2.))

# THIS is the best way to do it!!
ssp_dwave = dloglam * ssp_wave * n.log(10.)

# What is the resolution that we want to add in order
# to make the SDSS pixel width?
sdss_dloglam = 0.0001
sdss_dwave = sdss_dloglam * ssp_wave * n.log(10.)

# This constructs the blurring matrix to SDSS resolution:
sdss_blur = pxs.gauss_blur_matrix(ssp_wavebound, n.sqrt(sdss_dwave**2 - ssp_dwave**2))

# The baseline for log vdisp in km/s:
log_vmin = 2.0
log_vstep = 0.2
log_vnum = 4
log_vbase = log_vmin + log_vstep * n.arange(log_vnum)

# Compute the velocity-broadening matrices:
c_kms = 2.99792458e5
sigma_v_in_ang = ssp_wave.reshape((1,-1)) * (10.**log_vbase).reshape((-1,1)) / c_kms
vmatrix_list = [pxs.gauss_blur_matrix(ssp_wavebound, sigma_v_in_ang[i]) for i in xrange(log_vnum)]

# Initialize an array to hold the blurred SSPs before downsampling:
ssp_vblur = n.zeros((nsub_age, log_vnum, n_pix), dtype=float)
Beispiel #3
0
# This will work:
#ssp_dwave = 10.**(ssp_loglam + 0.5 * dloglam) - \
#            10.**(ssp_loglam - 0.5 * dloglam)
#ssp_dwave = ssp_wave * (10**(dloglam/2.) - 10.**(-dloglam/2.))

# THIS is the best way to do it!!
ssp_dwave = dloglam * ssp_wave * n.log(10.)

# What is the resolution that we want to add in order
# to make the SDSS pixel width?
sdss_dloglam = 0.0001
sdss_dwave = sdss_dloglam * ssp_wave * n.log(10.)

# This constructs the blurring matrix to SDSS resolution:
sdss_blur = pxs.gauss_blur_matrix(ssp_wavebound,
                                  n.sqrt(sdss_dwave**2 - ssp_dwave**2))

# The baseline for log vdisp in km/s:
log_vmin = 2.0
log_vstep = 0.2
log_vnum = 4
log_vbase = log_vmin + log_vstep * n.arange(log_vnum)

# Compute the velocity-broadening matrices:
c_kms = 2.99792458e5
sigma_v_in_ang = ssp_wave.reshape((1, -1)) * (10.**log_vbase).reshape(
    (-1, 1)) / c_kms
vmatrix_list = [
    pxs.gauss_blur_matrix(ssp_wavebound, sigma_v_in_ang[i])
    for i in xrange(log_vnum)
]
Beispiel #4
0
# This will work:
#ssp_dwave = 10.**(ssp_loglam + 0.5 * dloglam) - \
#            10.**(ssp_loglam - 0.5 * dloglam)
#ssp_dwave = ssp_wave * (10**(dloglam/2.) - 10.**(-dloglam/2.))

# THIS is the best way to do it!!
ssp_dwave = dloglam * ssp_wave * n.log(10.)

# What is the resolution that we want to add in order
# to make the SDSS pixel width?
rebin_dloglam = 0.000025
rebin_dwave = rebin_dloglam * ssp_wave * n.log(10.)

# This constructs the blurring matrix to output resolution:
rebin_blur = pxs.gauss_blur_matrix(ssp_wavebound,
                                   n.sqrt(rebin_dwave**2 - ssp_dwave**2))

# wavelength range for rebinned version to be bounded by:
wave_rebin_lo = 1525.
wave_rebin_hi = 10850.
coeff1 = rebin_dloglam
coeff0 = coeff1 * n.floor(n.log10(wave_rebin_lo) / coeff1)
naxis1 = int(n.ceil(1. + (n.log10(wave_rebin_hi) - coeff0) / coeff1))

loglam_rebin = coeff0 + coeff1 * n.arange(naxis1)
logbound_rebin = pxs.cen2bound(loglam_rebin)
wavebound_rebin = 10.**logbound_rebin

# Initialize array for rebinned blurred SSPs:
ssp_rebin = n.zeros((nsub_age, naxis1), dtype=float)
Beispiel #5
0
npars = data.size // infodict['nwave']
data_flat = data.reshape((npars, infodict['nwave']))

# This next bit converts to flambda in vacuum, via the flattened copy:
for i in xrange(npars):
    data_flat[i] *= (hires_dwave_air / hires_dwave)

# What is the resolution that we want to add in order
# to make the SDSS pixel width?
sdss_dloglam = 0.0001
sdss_dwave = sdss_dloglam * hires_wave * n.log(10.)

# This constructs the blurring matrix to SDSS resolution.
# We use hires_dwave_air to avoid the 2000Ang airtovac discontinuity
# without being significantly incorrect about wavelength.
sdss_blur = pxs.gauss_blur_matrix(hires_wavebound,
                                  n.sqrt(sdss_dwave**2 - hires_dwave_air**2))

# Wavelength range for rebinned SDSS version to be bounded by
# the following, which at least covers ugriz:
wave_sdss_lo = 2900.
wave_sdss_hi = 12000.
coeff1 = sdss_dloglam
coeff0 = coeff1 * n.floor(n.log10(wave_sdss_lo) / coeff1)
naxis1 = int(n.ceil(1. + (n.log10(wave_sdss_hi) - coeff0) / coeff1))

loglam_sdss = coeff0 + coeff1 * n.arange(naxis1)
logbound_sdss = pxs.cen2bound(loglam_sdss)
wavebound_sdss = 10.**logbound_sdss

# Initialize array for rebinned blurred stars:
cap_sdssbin = n.zeros((npars, naxis1), dtype=float)
# This will work:
#ssp_dwave = 10.**(ssp_loglam + 0.5 * dloglam) - \
#            10.**(ssp_loglam - 0.5 * dloglam)
#ssp_dwave = ssp_wave * (10**(dloglam/2.) - 10.**(-dloglam/2.))

# THIS is the best way to do it!!
ssp_dwave = dloglam * ssp_wave * n.log(10.)

# What is the resolution that we want to add in order
# to make the SDSS pixel width?
rebin_dloglam = 0.000025
rebin_dwave = rebin_dloglam * ssp_wave * n.log(10.)

# This constructs the blurring matrix to output resolution:
rebin_blur = pxs.gauss_blur_matrix(ssp_wavebound, n.sqrt(rebin_dwave**2 - ssp_dwave**2))

# wavelength range for rebinned version to be bounded by:
wave_rebin_lo = 1525.
wave_rebin_hi = 10850.
coeff1 = rebin_dloglam
coeff0 = coeff1 * n.floor(n.log10(wave_rebin_lo) / coeff1)
naxis1 = int(n.ceil(1. + (n.log10(wave_rebin_hi) - coeff0) / coeff1))

loglam_rebin = coeff0 + coeff1 * n.arange(naxis1)
logbound_rebin = pxs.cen2bound(loglam_rebin)
wavebound_rebin = 10.**logbound_rebin

# Initialize array for rebinned blurred SSPs:
ssp_rebin = n.zeros((nsub_age, naxis1), dtype=float)