Base utilities (simqso.sqbase)

Reference/API

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

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

Parameters:
lam1,lam2 : float

Wavelengths endpoints in Angstroms.

R : float

Spectral resolution.

Returns:
wave : ~numpy.ndarray

Wavelength array between lam1 and lam2 with resolution R.

Examples

>>> 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.

Parameters:
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.

Parameters:
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.

Returns:
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.

Parameters:
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.

setRedshift(z)[source]

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

clear()[source]

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(newWave)[source]

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.

dump()[source]