File: gen_example_spectrum.py

package info (click to toggle)
sncosmo 2.12.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,628 kB
  • sloc: python: 7,278; cpp: 184; makefile: 130; sh: 1
file content (14 lines) | stat: -rwxr-xr-x 434 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/env python
import numpy as np
import sncosmo

wave = np.arange(3000, 9000, 10)
model = sncosmo.Model(source='hsiao-subsampled')
model.set(z=0.1, amplitude=1e-5, t0=0.)
sample_time = model['t0'] + 2.
flux = model.flux(time=sample_time, wave=wave)
fluxerr = 0.1 * flux
flux = flux + np.random.normal(scale=fluxerr)

np.savetxt('example_spectrum.dat', np.array([wave, flux, fluxerr]).T,
           header="wave flux fluxerr")