Base utilities (simqso.sqbase)


simqso.sqbase.fixed_R_dispersion(lam1, lam2, R)[source]

Generate a wavelength grid at a fixed resolution d(log(lambda))^-1.

lam1,lam2 : float

Wavelengths endpoints in Angstroms.

R : float

Spectral resolution.

wave : ~numpy.ndarray

Wavelength array between lam1 and lam2 with resolution R.


>>> from simqso.sqbase import fixed_R_dispersion
>>> import numpy as np; np.set_printoptions(precision=2)
>>> wave = fixed_R_dispersion(3000,3010,1000)
>>> print wave
[ 3000.    3003.    3006.01  3009.01  3012.02]
simqso.sqbase.deres(f, Rin, Rout, fout=None)[source]

Downgrade the resolution of a spectrum from Rin to Rout.

f : ndarray

Input spectrum.

Rin : float

Resolution of input spectrum (as in R=lambda/dlambda).

Rout : float

Resolution of output spectrum, Rout<Rin.

fout : ndarray

Optional array for output spectrum. Updates f in-place if fout=f.

simqso.sqbase.resample(x1, y1, x2)[source]

Resample function onto new grid using simple interpolation.

simqso.sqbase.continuum_kcorr(obsBand, restBand, z, alpha_nu=-0.5)[source]

A simple power-law k-correction.

obsBand : str or float

Observed band. Can be one of “SDSS-[ugriz]”, “CFHT-[gri]”, or a wavelength in Angstroms.

restBand : str or float

Rest-frame band. Can be one of “SDSS-[ugriz]”, “CFHT-[gri]”, or a wavelength in Angstroms.

z : float or ndarray

Emission redshift(s).

alpha_nu : float

Spectral index used to get k-correction, as f_nu ~ nu^alpha_nu.

k : ndarray

K(z) is spectral k-correction for a simple power-law continuum.

class simqso.sqbase.SimKCorr(obsBand, restBand)[source]

Bases: object

class simqso.sqbase.ContinuumKCorr(obsBand, restBand, alpha_nu=-0.5, effWaveBand=None)[source]

Bases: simqso.sqbase.SimKCorr

class simqso.sqbase.EmissionLineKCorr(obsBand, restBand, datFile=None)[source]

Bases: simqso.sqbase.SimKCorr

class simqso.sqbase.AppToAbsMag(cosmo, kcorr)[source]

Bases: object

class simqso.sqbase.Spectrum(wave, f_lambda=None, z=0.0)[source]

Bases: object

Base class for one-dimensional spectra.

wave : ~numpy.ndarray

Input wavelength grid.

f_lambda : ~numpy.ndarray

Input flux density. Default is None, which sets f_lambda[:] = 0.

z : float

Input redshift. Default is 0.0.


Set the redshift of the spectrum. Does not modify the spectrum itself.


Clear the spectrum by zeroing the flux density vector and setting z=-1.

waveslice(w1, w2)[source]

Return a slice of the spectrum between two wavelengths.


Resample the spectrum onto a new wavelength grid.

convolve_restframe(g, *args)[source]

Convolves the spectrum with the input function as f_lambda’ = g(wave/(1+z),f_lambda).

Optional *args are passed to the convolution function.

class simqso.sqbase.TimerLog[source]

Bases: object

Simple utility for tracking wall time execution for various steps of the simulation.