Spectrograph: dispersion resolution vs. spot size#

The dispersion resolution is the number of detector pixels spanned by a resolution element, and is tied to the resolving power R. The spot size is the footprint, in pixels, of a monochromatic point source on the detector. The two are of course connected: a larger spot size means a larger dispersion resolution.

Nyquist sampling corresponds to a dispersion resolution of 2 (see the notebook on changing the dispersion resolution). The default Lazuli configuration uses 2.3.

In practice, one may want to either:

  1. change the dispersion resolution without changing the resolving power, which changes the wavelength binning;

  2. or change the dispersion resolution while keeping the same wavelength binning, which changes the resolving power.

The second case corresponds, for instance, to a given optical system whose aberrations change: the spot size changes, which changes the resolving power, but not how the light is dispersed on the detector, and hence not the wavelength binning.

This is why the Spectrograph has two mutable parameters, dispersion_resolution and spotsize:

  • updating either of them changes spectrograph.dispersion_resolution, the number of pixels over which a resolution element is spread;

  • but changing spotsize does not redefine the wavelength binning spectrograph.lbda, while changing dispersion_resolution does.

In both cases, since spectrograph.dispersion_resolution is updated, the impact of the instrumental PSF in the spatial direction (slicer) or in the cross-dispersion direction (MLA) is updated too.

Finally, the dispersion_scale parameter lets you scale the resolving power without changing the dispersion_resolution (hence the spot size). The default Lazuli configuration uses dispersion_scale=1.3, which gives a minimum resolving power of R≈100.

Illustration#

import slicersim
# load a star at mag 20, using the BD+17°4708 spectrum.
bd17 = slicersim.LazuliCalSpec.from_name("bd_17", mag=20)
spectro = bd17.simulation.spectrograph

Let us look at the current minimum resolving power R:

resolving_power = spectro.get_resolving_power().copy() # copy to compare later on
resolving_power.min()
np.float64(100.59383916964725)

and the corresponding dispersion resolution:

spectro.dispersion_resolution
2.3
lbda, flux, var = bd17.get_spectrum("flambda", incl_error=False)
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(5,3))
ax.plot(lbda, flux, marker=".")

ax.set_xlim(4000, 4400)
ax.set_ylim(4e-17, 7e-17)
ax.set_xlabel(r"Wavelength [$\AA$]")
ax.set_ylabel(r"flux [$\mathrm{erg/s/cm^2/\AA}$]")
ax.set_title("BD+17 (mag=20)", loc="right", color="0.5", fontsize="small");
../_images/d4f63e291be7bac23b139ea5d272a75c2cd3be94608d4995d8fe7c39fa793616.png

Changing the spot size#

Let us degrade the spot size from 2.3 to 2.5 pixels.

what_has_changed = spectro.update(spotsize=2.5)
# how has the resolving power changed?
resolving_power_sp25 = spectro.get_resolving_power().copy()
resolving_power_sp25.min()
np.float64(92.54633203607547)
# get the new spectrum
lbda_sp25, flux_sp25, var_sp25 = bd17.get_spectrum("flambda", incl_error=False)
fig, (ax, axres) = plt.subplots(figsize=(8,3), ncols=2, width_ratios=(2,1))

# compare the spectra
ax.plot(lbda, flux, marker=".", label=r"$\delta \lambda = 2.3$")
ax.plot(lbda_sp25, flux_sp25, marker=".", label=r"$\delta \lambda = 2.5$")
ax.legend(frameon=False)
ax.set_xlim(4000, 4400)
ax.set_ylim(4e-17, 7e-17)
ax.set_xlabel(r"Wavelength [$\AA$]")
ax.set_ylabel(r"flux [$\mathrm{erg/s/cm^2/\AA}$]")
ax.set_title("BD+17", loc="right", color="0.5", fontsize="small")

# and the resolving power
axres.plot(lbda, resolving_power)
axres.plot(lbda_sp25, resolving_power_sp25)
axres.axhline(100, ls="--", color="0.5", lw=1)
axres.axhline(500, ls="--", color="0.5", lw=0.5)
axres.set_xlabel(r"Wavelength [$\AA$]")
axres.set_ylabel("resolving power R")

fig.tight_layout()
../_images/839911bd75cf6721763703b0b8618d96c8cf803594a978d2467dc7b337249047.png

Since we changed spotsize, the wavelength binning has not changed, but the resolving power has decreased.

import numpy as np
np.isclose(lbda_sp25, lbda).all()
np.True_

Changing the dispersion resolution#

This redefines spectro.lbda so as to keep the original resolving power (R≈100 at minimum). As a consequence, there are more wavelength bins.

what_has_changed = spectro.update(dispersion_resolution=2.5)
what_has_changed
['lbda', 'meta']
spectro.lbda.shape
(571,)
# how has the resolving power changed?
resolving_power_res25 = spectro.get_resolving_power().copy()
resolving_power_res25.min()
np.float64(100.5938757751203)
# get the new spectrum
lbda_res25, flux_res25, var_res25 = bd17.get_spectrum("flambda", incl_error=False)
fig, (ax, axres) = plt.subplots(figsize=(8,3), ncols=2, width_ratios=(2,1))

# compare the spectra
ax.plot(lbda, flux, marker=".", label=r"$\delta \lambda = 2.3$")
ax.plot(lbda_sp25, flux_sp25, marker=".", label=r"$\delta \lambda = 2.5$ (spotsize)")
ax.plot(lbda_res25, flux_res25, marker=".", label=r"$\delta \lambda = 2.5$ (dispersion_resolution)")

ax.legend(frameon=False)
ax.set_xlim(4000, 4400)
ax.set_ylim(4e-17, 7e-17)
ax.set_xlabel(r"Wavelength [$\AA$]")
ax.set_ylabel(r"flux [$\mathrm{erg/s/cm^2/\AA}$]")
ax.set_title("BD+17", loc="right", color="0.5", fontsize="small")

# and the resolving power
axres.plot(lbda, resolving_power)
axres.plot(lbda_sp25, resolving_power_sp25)
axres.plot(lbda_res25, resolving_power_res25)

axres.axhline(100, ls="--", color="0.5", lw=1)
axres.axhline(500, ls="--", color="0.5", lw=0.5)
axres.set_xlabel(r"Wavelength [$\AA$]")
axres.set_ylabel("resolving power R")

fig.tight_layout()
../_images/c4a8ce1d87efa219b82ed6bb9fe0570f263ba2968e5d9d5f9aca2d9370cf18f1.png

Scaling the resolving power with dispersion_scale#

Finally, one may want to change the resolving power without changing the dispersion resolution (hence the spot size). This is done by updating dispersion_scale: the resolving power scales proportionally to dispersion_scale.

Let us reload the star, and go from the default dispersion_scale=1.3 to 1.0.

bd17 = slicersim.LazuliCalSpec.from_name("bd_17", mag=20)
spectro = bd17.simulation.spectrograph
spectro.meta["dispersion_scale"] # default value
1.3
_ = spectro.update(dispersion_scale=1.0)
spectro.get_resolving_power().min() # 1.3 times smaller than before
np.float64(77.38182493220353)
spectro.lbda.shape # coarser wavelength binning, hence fewer bins
(404,)

Combining dispersion_scale, dispersion_resolution and spotsize#

As a consequence of this design, you can set the resolving power for any assumed dispersion resolution by updating both parameters simultaneously.

For instance, a dispersion_scale of 1.3 (minimum resolving power R≈100) with a dispersion_resolution of 2.5:

_ = spectro.update(dispersion_scale=1.3, dispersion_resolution=2.5)
new_lbda = spectro.lbda.copy() # store for later comparison
spectro.get_resolving_power().min()
np.float64(100.5938757751203)

If the spectrograph turns out to be better than planned, with a spot size of 2 pixels rather than 2.5, the resolving power increases…

_ = spectro.update(spotsize=2)
spectro.get_resolving_power().min()
np.float64(125.74234471890037)

… but the wavelength binning is unchanged:

np.isclose(spectro.lbda,new_lbda).all()
np.True_