compute_output_wl
- jwst.combine_1d.combine1d.compute_output_wl(wl, n_input_spectra)[source]
Compute output wavelengths.
In summary, the output wavelengths are computed by binning the input wavelengths in groups of the number of overlapping spectra. The merged and sorted input wavelengths are in
wl.If the wavelength arrays of the input spectra are nearly all the same, the values in wl will be in clumps of N nearly identical values (for N input files). We want to average the wavelengths in those clumps to get the output wavelengths. However, if the wavelength scales of the input files differ slightly, the values in
wlmay clump in some regions but not in others. The algorithm below tries to find clumps; a clump is identified by having a small standard deviation of all the wavelengths in a slice ofwl, compared with neighboring slices. It is intended that this should not find clumps where they’re not present, i.e., in regions where the wavelengths of the input spectra are not well aligned with each other. These regions will be gaps in the initial determination of output wavelengths based on clumps. In such regions, output wavelengths will then be computed by just averaging groups of input wavelengths to fill in the gaps.- Parameters:
- wl1-D array
An array containing all the wavelengths from all the input spectra, sorted in increasing order.
- n_input_spectra1-D array
An integer array of the same length as
wl. For a given array indexk(for example),n_input_spectra[k]is the number of input spectra that cover wavelengthwl[k].
- Returns:
- wavelength1-D array
Array of wavelengths for the output spectrum.