astrocook.mocks.generate module#
Generation of mock spectra.
- astrocook.mocks.generate.make_grid(lam_min_nm: float, lam_max_nm: float, dv_kms: float) Tuple[ndarray, ndarray, ndarray][source]#
Pixel centres and edges (nm), uniform in velocity.
- Returns:
x, xmin, xmax – Centres and edges; the edges of adjacent pixels coincide.
- Return type:
np.ndarray
- astrocook.mocks.generate.normalized_flux(truth: MockTruth) Tuple[ndarray, ndarray][source]#
Noiseless normalised flux, convolved and averaged over each pixel.
The model is computed on
oversamplesub-pixels per pixel, convolved with the instrumental profile on that grid, then averaged over the sub-pixels of each pixel.- Returns:
x_nm, flux
- Return type:
np.ndarray
- astrocook.mocks.generate.continuum(truth: MockTruth, x_nm: ndarray) ndarray[source]#
Power law plus the Gaussian emission lines of
truth.
- astrocook.mocks.generate.noise_sigma(truth: MockTruth, cont: ndarray, true_flux: ndarray) ndarray[source]#
Error per pixel of
truth(seeMockTruth,snrandnoise_floor), from the continuum and the noiseless flux.
- astrocook.mocks.generate.spike_indices(truth: MockTruth, n_pixels: int) ndarray[source]#
Pixel indices of the spikes of
truth(reproducible from the seed).
- astrocook.mocks.generate.generate(truth: MockTruth, truth_columns: bool = True) Spectrum[source]#
Mock spectrum for
truth.The spectrum has the true continuum (with emission lines) in the
contcolumn and the noiseless flux inmock_flux;z_emand the resolving power are set (the latter also in the metadata, so that it survives a save).With
truth_columns=Falsethe two columns are left out, as for an observed spectrum: the recipes would otherwise use the true continuum (in the MCP pilot an agent fitted on it). The flux is the same.