Resampling

In Figueria et al. (2016) and scripts.phoenix_precision the synthetic spectra are resampled to 3 pixels per resolution element.

This is done using the eniric.resample module.

Functions for spectral resampling.

eniric.resample.log_chunks(wavelength: numpy.ndarray, percent: float) → numpy.ndarray[source]

Define the bounds at which $(Delta lambda)/lambda = X%$.

Allows spectrum to be split into chunks in which the size is X% of the given wavelength. This takes logarithmic steps with a base of (1+X/100).

Parameters:
  • wavelength (ndarry) – Wavelength array.
  • percent (float) – Base step in percentage.
Returns:

logspace – Array of points with a growth in wavelength spanned of a given percent.

Return type:

ndarray

eniric.resample.log_resample(wavelength, sampling: Union[int, float], resolution: Union[int, float]) → numpy.ndarray[source]

Resample spectrum with a given sampling per resolution element.

Uses faster method using log and powers of a base. The base is (1.0 + 1.0/(sampling*resolution).

Parameters:
  • wavelength (numpy.ndarray) – Wavelength array.
  • sampling (int, float) – Points to sample per resolution element
  • resolution (int, float) – Instrumental resolution
Returns:

logspace – Array of points with a set sampling per resolution element.

Return type:

ndarray

Note

Almost equivalent to using ``np.logspace(np.log(wavelength)/np.log(base), np.log(wavelength)/np.log(base),

np.log(wavelength_end / wavelength_start) / np.log(base), base)``.
eniric.resample.wl_logspace(start, stop, base, end_point: bool = False)[source]

Like np.logspace but start and stop in wavelength units.

Parameters:
  • start (float) – Starting point (in real units)
  • stop (float) – End point (in real units)
  • base (float) – Logarithmic base to jump between points.
  • end_point (bool) – Make sure to include/go past the end point
Returns:

logspace – Array of points with a spacing such that x[ii+1] = x[ii] * base between start and stop (or stop*base if end_point = True).

Return type:

ndarray