SlicerSpectrograph#
- class SlicerSpectrograph(lbda, telescope=None, spaxels={}, throughput=None, spatial_psf={}, lbda_edges=None, optics={}, dispersion_resolution=2, meta={})[source]#
Bases:
SpectrographImage-slicer spectrograph, with anamorphosis.
This class inherits from
Spectrographand modifies the spaxel definition to account for the anamorphosis introduced by the slicer: the number of spaxels alongx(along the slices) is multiplied by the anamorphosis factor (_ANAMORPHOSE = 2), each slice width being sampled by 2 detector pixels.See
Spectrographfor the parameters.Methods
Extracted signal and variance of an extended source within an aperture.
Apply the line spread function to a flux cube.
Build wavelength coordinates from a configuration dictionary.
Compute the chromatic average of a quantity.
Collapse a cube into images over wavelength ranges.
Create a spectrograph from a configuration dictionary.
Generate a photon flux cube from uniform scene background spectrum.
Project an array as a cube (not implemented).
Generate a photon flux cube from a point source spectrum.
Generate a photon flux cube from a structured background scene.
Get the dispersed thermal signal, in ph/s/spx/Δλ.
Get the scatter induced by the telescope jitter and instrumental PSF.
Spaxels within a circular (or elliptical) aperture.
Broadcast an array into a spectrograph-shaped cube.
Get the effective dispersion resolution, in pixels.
Get a uniform data cube.
Get the name of the field matching the spaxel configuration.
Get the contribution of the spectrograph to the total spot size.
Get the wavelength array.
Get the Gaussian LSF dispersion, in wavelength bins (pixels).
Noise Equivalent Area (PSF -> Spaxel -> detector).
Get the noise equivalent area of a slice (per wavelength), in pixels.
Get the noise equivalent area of the spatial PSF.
Get the noise equivalent area of the telescope Airy disk.
Get the spatial PSF standard deviation (in arcsec or in spaxels).
Get the resolving power \(\mathcal{R} = \lambda/\Delta\lambda\).
Get the normalized 2D spatial PSF on the spaxel grid.
Get the spaxel centroid coordinates.
Get the spatial shape of the spaxel grid.
Get the spectrograph throughput.
Point-source extracted variance from variance cube.
Set the spaxel information, accounting for the anamorphosis.
Set the throughput of the spectrograph.
Show the full width at half maximum (FWHM) of the spatial PSF.
Show the total noise equivalent area as a function of wavelength.
Show the spatial noise equivalent area as a function of wavelength.
Show the spatial PSF, integrated over a wavelength range.
Update any mutable attribute of the spectrograph.
Update the wavelength coordinates.
Attributes
Effective dispersion resolution (spot size), in pixels.
Chromatic conversion factor from erg/s/cm²/Å to ph/s.
Wavelength bins
(lbda_min, lbda_max), of shape(nlbda, 2), in Angstrom.Reference wavelength of the chromatic PSF, in Angstrom (default 10000).
Metadata of the instance.
Mutable parameters (list)
Name of the spectrograph (empty string if not set).
Number of spectral pixels (wavelength bins).
Spaxel solid angle, in steradians.
Chromatic PSF sigma at
lbda_ref, in arcsec.Full sky area covered by the spaxels (not implemented, always None).
Extent
[-hx, hx, -hy, hy]of the spaxel grid, in spaxels.Spaxel coordinates and properties (see
build_pixels).Area of a spaxel, in arcsec².
Spaxel
(x, y)centroid coordinates, in spaxels.Spaxel
(x, y)edge coordinates, in spaxels.Shape
(ny, nx)of the spaxel grid.Spatial scale of a spaxel, in arcsec.
Type of the spectrograph (e.g.
"slicer"or"mla").- aperture_extraction(cube, varcube, position=(0, 0), radius=5, psf_profile='default', optimal=False)#
Extracted signal and variance of an extended source within an aperture.
Contrary to
pointsource_variance, the signal is measured from the (noise-free) signal cube, using the same weights as the variance:plain summation (
optimal=False):signal = sum(cube)andvariance = sum(varcube)over the aperture;optimal extraction (
optimal=True): inverse-variance weighted least-square fit of the PSF profile, i.e. the flux of the point source that best matches the cube atposition:signal = sum(psf*cube/var) / sum(psf**2/var)andvariance = 1 / sum(psf**2/var).
- Parameters:
cube (array_like) – Signal cube, of shape
(nlbda, ny, nx).varcube (array_like) – Variance cube, of shape
(nlbda, ny, nx), in the square of thecubeunit.position (
tupleoffloat, optional) –(x, y)aperture center, in spaxels. Default is(0, 0).radius (
floatortupleoffloat, optional) – Aperture radius in spaxels, seeget_aperture. Default is 5.psf_profile (
str, optional) – PSF profile used for the optimal extraction (seeget_spatial_psf). Default is"default".optimal (
bool, optional) – If True, use optimal extraction, otherwise plain summation. Default is False.
- Returns:
signal, variance (
numpy.ndarray) – Extracted signal and variance, of shape(nlbda,).
See also
pointsource_varianceVariance of a point source.
- apply_line_spread_function(fluxes, **kwargs)#
Apply the line spread function to a flux cube.
The LSF is a Gaussian of sigma
get_lsf_dispersion(as_="scale")wavelength bins.- Parameters:
fluxes (array_like) – Flux spectrum
(nlbda,)or cube(nlbda, ny, nx).**kwargs – Additional arguments passed to
scipy.ndimage.gaussian_filter1d(axis=0by default).
- Returns:
numpy.ndarray– Fluxes convolved with the LSF, with the same shape asfluxes.
- static build_lbda_from_config(config)#
Build wavelength coordinates from a configuration dictionary.
- Parameters:
config (
dict) – Configuration dictionary.- Returns:
lbda (
numpy.ndarray) – Mid-bin wavelengths, in Angstrom.lbda_edges (
numpy.ndarray) – Bin edge wavelengths, in Angstrom.
See also
slicersim.spectrograph.build_lbda_from_configThe function called.
- chromatic_average(quantity)#
Compute the chromatic average of a quantity.
The average is weighted by the wavelength bin widths, i.e. averaged over wavelength rather than over pixels.
- Parameters:
quantity (array_like) – Chromatic quantity, of shape
(nlbda,).- Returns:
float– Chromatic average.
- cube_to_slice(cube, lbda_range, func=<function nansum>, squeeze=False)#
Collapse a cube into images over wavelength ranges.
- Parameters:
cube (array_like) – Data cube of shape
(nlbda, ny, nx).lbda_range (
tupleoffloatorlistoftuple) – Wavelength range(s)(wmin, wmax), in Angstrom (bounds included).func (callable, optional) – Function merging the wavelengths of a range into one image, called as
func(subcube, axis=0). Default isnumpy.nansum.squeeze (
bool, optional) – If True, squeeze the output array. Default is False.
- Returns:
numpy.ndarray– Images, of shape(n_ranges, ny, nx).
- classmethod from_config(config, telescope=None)#
Create a spectrograph from a configuration dictionary.
- Parameters:
config (
dict) – Spectrograph configuration dictionary (e.g. the"spectrograph"entry ofget_config). It must contain the"throughput","optics"and"psf"entries, and the wavelength and spaxel information (seebuild_lbda_from_configandbuild_spaxels_from_config).telescope (
Telescope, optional) – Telescope feeding the spectrograph. Default is None.
- Returns:
Spectrograph– An instance of the calling class.
- generate_background(spectrum, oversampling=None, apply_lsf=True)#
Generate a photon flux cube from uniform scene background spectrum.
- Parameters:
spectrum (array_like) – Uniform scene background spectrum, of shape
(nlbda,), in erg/s/cm²/Å/arcsec².oversampling (
int, optional) – Spatial oversampling factor of the output cube. Default is None.apply_lsf (
bool, optional) – If True, apply the line spread function. Default is True.
- Returns:
numpy.ndarray– Photon flux cube, of shape(nlbda, ny, nx), in ph/s/spx.
- generate_fullof_cube(array, oversample=True)#
Project an array as a cube (not implemented).
Placeholder: this currently does nothing and returns None. See
get_array_as_cubeinstead.- Parameters:
array (array_like) – Array to project.
oversample (
bool, optional) – Unused. Default is True.
- generate_pointsource(spectrum, position=(0, 0), psf_profile='default', oversampling=None, as_oversampled=False, apply_lsf=True, **kwargs)#
Generate a photon flux cube from a point source spectrum.
- Parameters:
spectrum (array_like) – Point source spectrum, of shape
(nlbda,), in erg/s/cm²/Å.position (
tupleoffloat, optional) –(x, y)point source position, in spaxels. Default is(0, 0).psf_profile (
str, optional) – PSF profile to use (seeget_spatial_psf). Default is"default".oversampling (
int, optional) – Spatial oversampling factor of the PSF (seeget_spatial_psf). Default is None.as_oversampled (
bool, optional) – If True, return the oversampled cube. Default is False.apply_lsf (
bool, optional) – If True, apply the line spread function. Default is True.**kwargs – Goes to
get_spatial_psf.
- Returns:
numpy.ndarray– Photon flux cube, of shape(nlbda, ny, nx), in ph/s/spx.
- generate_structured_background(cube, psf_profile='default', apply_lsf=True, **kwargs)#
Generate a photon flux cube from a structured background scene.
The input cube is converted into photons and convolved, wavelength per wavelength, by the spatial PSF (see
get_spatial_psf).- Parameters:
cube (array_like) – (nlbda, ny, nx) structured background (e.g. host) flux per spaxel in erg/s/cm²/Å, on the spaxel grid (see
spx_shape).psf_profile (
str, optional) – PSF profile to use. Default is “default”.apply_lsf (
bool, optional) – If True, apply the line spread function. Default is True.**kwargs – Goes to
get_spatial_psf.
- Returns:
numpy.ndarray– Photon flux cube, of shape(nlbda, ny, nx), in ph/s/spx.
- generate_thermal_signal(lbda_bin=None, as_cube=False, oversampling=None, apply_lsf=True, as_sum=True)#
Get the dispersed thermal signal, in ph/s/spx/Δλ.
This is the thermal emission that goes through the disperser: the telescope mirrors and the spectrograph optical surfaces located before the disperser.
- Parameters:
lbda_bin (array_like, optional) –
(nlbda, 2)list of spectral domains in Angstrom. If None,lbda_binis used. Default is None.as_cube (
bool, optional) – If True, return a(nlbda, ny, nx)cube, otherwise a(nlbda,)spectrum. Default is False.oversampling (
int, optional) – Spatial oversampling factor, used ifas_cubeis True. Default is None.apply_lsf (
bool, optional) – If True, apply the line spread function. Default is True.as_sum (
bool, optional) – Unused: the contributions are always summed. Default is True.
- Returns:
numpy.ndarray– Thermal signal in ph/s/spx/Δλ, of shape(nlbda,)or(nlbda, ny, nx)(seeas_cube).
- get_additonal_spatial_scatter(guiding_sigma=None, incl_instrument=True, in_spaxels=True)#
Get the scatter induced by the telescope jitter and instrumental PSF.
The current implementation assumes Gaussian scatter.
- Parameters:
guiding_sigma (
float, optional) – Gaussian sigma (in arcsec) of the jitter. If None, the internally storedspatial_psf["guiding_sigma"]is used. Setguiding_sigma=0for no guiding scatter. Default is None.incl_instrument (
bool, optional) – If True, also include the instrumental PSF (seeget_instrumental_psf) along they(slice) direction. This only applies to slicer spectrographs. Default is True.in_spaxels (
bool, optional) – If True, return the scatter in spaxels, otherwise in arcsec. Default is True.
- Returns:
numpy.ndarrayorNone–(sigma_x, sigma_y)Gaussian sigma, in spaxels or in arcsec (seein_spaxels). None if there is no scatter.
- get_aperture(position=(0, 0), radius=5)#
Spaxels within a circular (or elliptical) aperture.
- Parameters:
- Returns:
numpy.ndarray–(ny, nx)boolean mask, True for the spaxels whose centroid is within the aperture.- Raises:
ValueError – If
radiuscannot be parsed.
- get_array_as_cube(array, oversampling=None)#
Broadcast an array into a spectrograph-shaped cube.
- Parameters:
array (
floator array_like) – Value(s) filling the cube. Accepted shapes are a scalar (uniform cube),(nlbda, )(a spectrum, spatially uniform) or the spatial shape(ny, nx)(an image, uniform in wavelength).oversampling (
int, optional) – Spatial oversampling factor of the output cube. Default is None, i.e. the native spaxel shape.
- Returns:
numpy.ndarray– Cube of shape(nlbda, ny, nx).- Raises:
ValueError – If
arrayhas more than 3 dimensions, or if its shape matches neither(nlbda, )nor the spatial shape of the spectrograph.
See also
get_spectrograph_shapeThe spatial shape the cube is built on.
- get_dispersion_resolution(which=None)#
Get the effective dispersion resolution, in pixels.
- Parameters:
which (
str, optional) –Which axis to return:
None: the resolution as stored.
"wavelength","lsf","wave","lbda"or"y": the spectral axis."spatial","psf"or"x": the spatial axis.
Default is None.
- Returns:
floatordict– The dispersion resolution in pixels. Ifwhichis None, the value as stored, which may be a float, a 2-element array or a dict with the"wavelength"and"spatial"entries. Otherwise, the resolution of the requested axis.- Raises:
ValueError – If the stored dispersion resolution can be parsed neither as a scalar nor as a 2-element array, or if
whichis not one of the accepted names.
Notes
2 pixels is optimal: below that the PSF is unresolved, above it the PSF is oversampled and adds unnecessary pixel noise.
When the stored resolution is a 2-element array and
whichis given, the full{"wavelength", "spatial"}dict is returned instead of the requested axis alone.
- get_empty_cube(filled=0, oversampling=None)#
Get a uniform data cube.
- Parameters:
- Returns:
numpy.ndarray– Cube of shape(nlbda, ny, nx)filled withfilled.
- get_fieldname()#
Get the name of the field matching the spaxel configuration.
The field is inferred from the current
spatial_shapeandspatial_scaleof the spectrograph (seemeta).- Returns:
str– Field name (e.g."narrow"or"wide"for Lazuli), or"unknown"if the configuration does not match any known field.- Raises:
NotImplementedError – If the spectrograph is not Lazuli (see
name).
- get_instrumental_psf(spotsize=None, expected_size=2, in_spaxels=True)#
Get the contribution of the spectrograph to the total spot size.
This contribution is null if
spotsize <= expected_size. Otherwise, it is the Gaussian sigmaextra_pixels = np.sqrt(spotsize**2 - expected_size**2) / 2, further divided by the anamorphosis factor for slicer spectrographs.- Parameters:
spotsize (
float, optional) – Total size (in pixels) of a point source on the detector, i.e. the total contribution of telescope and spectrograph. If None,get_dispersion_resolutionis used. Default is None.expected_size (
float, optional) – Expected geometric footprint (in pixels) of the PSF on the detector. Default is 2.in_spaxels (
bool, optional) – If True, return the extra scattering in spaxels (spaxel = pixel for a slicer along the slice), otherwise in arcsec. Default is True.
- Returns:
floatornumpy.ndarrayorNone– Extra scattering (Gaussian sigma), in spaxels or arcsec. None ifspotsize <= expected_size.
- get_lbda(units=None, oversample=None)#
Get the wavelength array.
- Parameters:
units (
strorastropy.units.Unit, optional) – Unit of the returned array. None (default) means Angstrom.oversample (
int, optional) – Oversampling factor of the wavelength binning (linear interpolation between the native wavelengths). Default is None.
- Returns:
numpy.ndarray– Wavelength array, in Angstrom unlessunitsis given.
- get_lsf_dispersion(as_='scale')#
Get the Gaussian LSF dispersion, in wavelength bins (pixels).
- Parameters:
How the dispersion is defined:
"scale"or"sigma": the Gaussian sigma (i.e.scalein the scipy/numpy definition), that is half thedispersion_resolution."resolution"or None: the full resolution element, i.e.get_dispersion_resolution.
Default is
"scale".- Returns:
float– LSF dispersion in wavelength bins.- Raises:
NotImplementedError – If
as_is not one of the accepted values.
- get_nea(position=(0, 0), nea_spatial=None, nea_pixels=None)#
Noise Equivalent Area (PSF -> Spaxel -> detector).
- Parameters:
position (
tupleoffloat, optional) – Position of the PSF in spaxels. Ignored ifnea_spatialis given. Default is(0, 0).nea_spatial (
floator array_like, optional) – Noise equivalent area of the spatial PSF (in spaxels). If None,get_nea_spatialis used. Default is None.nea_pixels (
floator array_like, optional) – Noise equivalent area of a spaxel/slice caused by the cross-dispersion (in pixels). If None,get_nea_pixels()is used (only defined forSlicerSpectrographandMLASpectrograph). Default is None.
- Returns:
floatornumpy.ndarray– Total noise equivalent area, in pixels.
- get_nea_pixels()[source]#
Get the noise equivalent area of a slice (per wavelength), in pixels.
- Returns:
int– Noise equivalent area in pixels (1 for a slicer).
- get_nea_spatial(position=(0, 0), in_spaxels=True, guiding_sigma=None)#
Get the noise equivalent area of the spatial PSF.
That is, the equivalent number of spaxels contributing noise.
- Parameters:
position (
tupleoffloat, optional) – Position of the PSF, in spaxels. Default is(0, 0).in_spaxels (
bool, optional) – If True, return the area in spaxels, otherwise in arcsec². Default is True.guiding_sigma (
float, optional) – Guiding sigma override in arcsec (seeget_psf_sigma_spectral). Default is None.
- Returns:
numpy.ndarray– Noise equivalent area as a function of wavelength.- Raises:
NotImplementedError – If the spatial PSF profile is not Gaussian.
- get_nea_telescope_airy(position=(0, 0), in_spaxels=True)#
Get the noise equivalent area of the telescope Airy disk.
- Parameters:
- Returns:
numpy.ndarray– NEA of the Airy disk as a function of wavelength.
See also
slicersim.telescope.Telescope.get_nea_airyThe method called.
- get_psf_sigma_spectral(guiding_sigma=None, incl_telescope=True, in_spaxels=False, lbda=None)#
Get the spatial PSF standard deviation (in arcsec or in spaxels).
The total (Gaussian) spatial PSF is the quadratic sum of two components:
the optical (chromatic) component, with stddev proportional to wavelength, normalized at
lbda_ref(seepsf_sigma_spectral),the guiding (achromatic) component, with constant stddev.
- Parameters:
guiding_sigma (
float, optional) – Guiding sigma override in arcsec. If None,self.spatial_psf["guiding_sigma"]is used. Setguiding_sigma=0for no guiding contribution. Default is None.incl_telescope (
bool, optional) – If True, include the optical (chromatic) component. If False, only the guiding component remains. Default is True.in_spaxels (
bool, optional) – If True, return sigma in spaxels, otherwise in arcsec. Default is False.lbda (array_like, optional) – Wavelength array in Angstrom. If None,
self.lbdais used. Default is None.
- Returns:
numpy.ndarray– Total sigma in arcsec or spaxels, of shape(nlbda, 1, 1).
- get_resolving_power()#
Get the resolving power \(\mathcal{R} = \lambda/\Delta\lambda\).
It is computed as
lbda / np.diff(lbda_edges) / dispersion_resolution, i.e. the resolution element isdispersion_resolutionpixels wide.- Returns:
numpy.ndarray– Resolving power, of shape(nlbda,).
- get_spatial_psf(profile='default', position=(0, 0), guiding_sigma=None, oversampling=5, as_oversampled=False, incl_instrument=True, incl_telescope=True, **kwargs)#
Get the normalized 2D spatial PSF on the spaxel grid.
This takes the PSF generated by the telescope, includes the jitter and adds the contribution of the instrument internal optics.
- Parameters:
profile (
str, optional) –Profile to be used:
"default","gaussian","normal"or"norm": Gaussian profile using exact erf integration over the spaxels."airy","mirror","telescope"or"airydisk": Airy disk generated by the telescope mirror."Gaussian2D"or"gaussian2d": Gaussian profile evaluated on the oversampled grid.
Default is
"default".position (
tupleoffloat, optional) –(x, y)location of the point source with respect to the grid center, in spaxels. Default is(0, 0).guiding_sigma (
float, optional) – Gaussian sigma (in arcsec) of the jitter. If None, the storedspatial_psf["guiding_sigma"]is used. Default is None.oversampling (
int, optional) – Oversampling factor used to evaluate the PSF (not used by the erf-integrated Gaussian profiles unlessas_oversampledis True). If None, 3 is used. Setoversampling=1for no oversampling. Default is 5.as_oversampled (
bool, optional) – If True, return the PSF on the oversampled grid. Default is False.incl_instrument (
bool, optional) – If True, include the instrumental PSF contribution (seeget_additonal_spatial_scatter). Default is True.incl_telescope (
bool, optional) – If True, include the telescope PSF and jitter. If False, the guiding sigma is forced to 0. Default is True.**kwargs – For the Gaussian (erf) profile, additional arguments passed to
get_gaussian2d. Ignored otherwise.
- Returns:
numpy.ndarray– Normalized PSF, of shape(nlbda, ny, nx).- Raises:
ValueError – If
profileis not implemented.- Warns:
UserWarning – If
incl_telescopeis False whileguiding_sigmais positive.
- get_spaxel_centroids(in_arcsec=False, squeeze=False, oversampling=None)#
Get the spaxel centroid coordinates.
- Parameters:
- Returns:
centroids (
tupleofnumpy.ndarray) –(x, y)centroid coordinates (seebuild_pixels).oversampling (
intorlistofint) – Oversampling factor actually used.
- get_spectrograph_shape(oversampling=None)#
Get the spatial shape of the spaxel grid.
- Parameters:
oversampling (
int, optional) – Spatial oversampling factor. Default is None (no oversampling).- Returns:
tupleofintornumpy.ndarray– Spaxel grid shape(ny, nx), multiplied byoversamplingif given.
- get_throughput(lbda=None, **kwargs)#
Get the spectrograph throughput.
When the throughput is callable (e.g.
OpticsThroughput), it is called with awhichargument set to:meta["which_throughput"]if given (seeupdate);otherwise, for Lazuli, the current field name (see
get_fieldname);otherwise None, i.e. the product of all throughput curves.
- Parameters:
lbda (array_like, optional) – Wavelength array in Angstrom. If None,
self.lbdais used. Ignored if the throughput is not callable. Default is None.**kwargs – Goes to the throughput call (e.g.
OpticsThroughput.get_throughput). A givenwhichoverrides the one described above.
- Returns:
numpy.ndarrayorfloat– Throughput as a function of wavelength, or the constant throughput.- Warns:
UserWarning – If
lbdais given while the throughput is not callable.
- pointsource_variance(varcube, position=(0, 0), radius=5, psf_profile='default', optimal=True, verbose=False)#
Point-source extracted variance from variance cube.
It is evaluated from a plain summation over the aperture, or from an optimal extraction, i.e. inverse-variance weighted least-square fit of the PSF profile (assumed Gaussian). As the extraction is assumed to do a perfect job on the signal, only the variance depends on instrumental parameters and aperture definition.
- Parameters:
varcube (array_like) – Variance cube, of shape
(nlbda, ny, nx), in ADU².position (
tupleoffloat, optional) –(x, y)point source position, in spaxels. Default is(0, 0).radius (
floatortupleoffloat, optional) – Aperture radius in spaxels, either a float (circular aperture) or(radius_y, radius_x)(elliptical aperture). Default is 5.psf_profile (
str, optional) – PSF profile to use (seeget_spatial_psf). Default is"default".optimal (
bool, optional) – If True, use optimal extraction, otherwise plain summation. Default is True.verbose (
bool, optional) – If True, print the number of spaxels in the aperture. Default is False.
- Returns:
numpy.ndarray– Extracted variance spectrum, of shape(nlbda,), in ADU².- Raises:
ValueError – If
radiuscannot be parsed.
- set_throughput(throughput)#
Set the throughput of the spectrograph.
- Parameters:
throughput (
float, array_like, callable,pandas.Series,pandas.DataFrameorOpticsThroughput) –Throughput of the system (between 0 and 1):
float: constant throughput.
array_like: must broadcast with
self.lbda.callable: such that
throughput(lbda)returns the throughput atlbda(in Angstrom).pandas.Series: throughput with wavelength (in Angstrom) as index. It is converted into a cubic interpolator (zero outside the given range).
pandas.DataFrame: its first column is used as a pandas.Series.
OpticsThroughput: detailed per-element throughput.
- show_fwhm(ax=None, legend=True, guiding_arcsec=None, in_arcsec=False, show_band=True)#
Show the full width at half maximum (FWHM) of the spatial PSF.
- Parameters:
ax (
matplotlib.axes.Axes, optional) – Axes to plot on. If None, a new figure and axes are created. Default is None.legend (
bool, optional) – If True, show the legend. Default is True.guiding_arcsec (
float, optional) – Guiding sigma in arcsec. If None, the storedspatial_psf["guiding_sigma"]is used. Default is None.in_arcsec (
bool, optional) – If True, show the FWHM in arcsec, otherwise in spaxels. Default is False.show_band (
bool, optional) – If True, highlight the under-sampled (FWHM < 2 spaxels) region. Default is True.
- Returns:
matplotlib.figure.Figure– The figure containing the plot.
- show_nea(ax=None, position=(0, 0), legend=True)#
Show the total noise equivalent area as a function of wavelength.
- Parameters:
ax (
matplotlib.axes.Axes, optional) – Axes to plot on. If None, a new figure and axes are created. Default is None.position (
tupleoffloat, optional) – Position of the PSF in spaxels. Default is(0, 0).legend (
bool, optional) – If True, show the legend. Default is True.
- Returns:
matplotlib.figure.Figure– The figure containing the plot.
- show_nea_spatial(ax=None, position=(0, 0), legend=True)#
Show the spatial noise equivalent area as a function of wavelength.
- Parameters:
ax (
matplotlib.axes.Axes, optional) – Axes to plot on. If None, a new figure and axes are created. Default is None.position (
tupleoffloat, optional) – Position of the PSF in spaxels. Default is(0, 0).legend (
bool, optional) – If True, show the legend. Default is True.
- Returns:
matplotlib.figure.Figure– The figure containing the plot.
- show_psf(lbda_range, profile='default', guiding_arcsec=None, axes=None, position=(0, 0), oversampling=5, in_arcsec=False, norm='log', **kwargs)#
Show the spatial PSF, integrated over a wavelength range.
Three panels are shown: the oversampled PSF without guiding, the oversampled PSF with guiding, and the PSF on the spaxel grid.
- Parameters:
lbda_range (
tupleoffloat) – Wavelength range(wmin, wmax)to integrate over, in Angstrom.profile (
str, optional) – PSF profile to use (seeget_spatial_psf). Default is"default".guiding_arcsec (
float, optional) – Guiding sigma in arcsec. If None, the storedspatial_psf["guiding_sigma"]is used. Default is None.axes (
listofmatplotlib.axes.Axes, optional) – List of 3 axes to plot on. If None, a new figure and axes are created. Default is None.position (
tupleoffloat, optional) – Position of the PSF in spaxels. Default is(0, 0).oversampling (
int, optional) – Oversampling factor. Default is 5.in_arcsec (
bool, optional) – If True, show the extent in arcsec, otherwise in spaxels. Default is False.norm (
str, optional) – Normalization for the color scale ("linear"or"log"). Default is"log".**kwargs – Additional arguments passed to
matplotlib.axes.Axes.imshow.
- Returns:
matplotlib.figure.Figure– The figure containing the plot.
- update(reset_others=False, **kwargs)#
Update any mutable attribute of the spectrograph.
The method accepts the django-like format, such that
a__bis understood asa.b. For instance,update(optics__temperature=220)is equivalent toupdate(**{'optics.temperature': 220}).Notes on the wavelength sampling (
lbda):changing
dispersion_resolutionredefinesself.lbdasuch that the resolving power is unchanged;changing
spotsizeupdatesself.dispersion_resolutionwithout updatinglbda, effectively changing the resolving power.
- Parameters:
reset_others (
bool, optional) – If True, the parameters not given are reset to their initial values (meta and telescope). Default is False.**kwargs – Parameters to update, e.g. any of
mutable_parameters, ortelescope.<param>,optics.<param>,throughput.<param>.throughputitself replaces the throughput (seeOpticsThroughput.from_config). None values are ignored.
- Returns:
listofstr– Names of the components that changed, among"telescope","optics","throughput","psf","spaxels","lbda"and"meta".- Warns:
UserWarning – If a parameter is not mutable or cannot be parsed. It is then ignored.
- update_lbda(lbda, lbda_edges)#
Update the wavelength coordinates.
- Parameters:
lbda (array_like) – Mid-bin wavelengths, in Angstrom.
lbda_edges (array_like) – Bin edge wavelengths, in Angstrom.
- dispersion_resolution#
Effective dispersion resolution (spot size), in pixels.
2 is optimal: below that, the PSF is unresolved; above it, the PSF is oversampled, hence producing unnecessary pixel noise.
- flambda2photon#
Chromatic conversion factor from erg/s/cm²/Å to ph/s.
It includes the telescope collecting surface, the spectrograph throughput (see
get_throughput) and the wavelength bin widths.
- lbda_bin#
Wavelength bins
(lbda_min, lbda_max), of shape(nlbda, 2), in Angstrom.
- lbda_ref#
Reference wavelength of the chromatic PSF, in Angstrom (default 10000).
- meta#
Metadata of the instance.
- mutable_parameters = ['dispersion_resolution', 'spotsize', 'dispersion_scale', 'which_throughput', 'xdisp_sigma_spectral', 'xdisp_sigma', 'psf_sigma_spectral', 'guiding_sigma', 'spatial_scale', 'spatial_shape', 'spx_scale', 'spx_shape']#
Mutable parameters (list)
- name#
Name of the spectrograph (empty string if not set).
- nlbda#
Number of spectral pixels (wavelength bins).
- omega#
Spaxel solid angle, in steradians.
- psf_sigma_spectral#
Chromatic PSF sigma at
lbda_ref, in arcsec.If not set (None or
"default"), it is derived from the telescope Airy radius atlbda_ref.
- skyarea#
Full sky area covered by the spaxels (not implemented, always None).
- spaxel_extent#
Extent
[-hx, hx, -hy, hy]of the spaxel grid, in spaxels.
- spaxels#
Spaxel coordinates and properties (see
build_pixels).
- spx_area#
Area of a spaxel, in arcsec².
- spx_centroids#
Spaxel
(x, y)centroid coordinates, in spaxels.
- spx_edges#
Spaxel
(x, y)edge coordinates, in spaxels.
- spx_shape#
Shape
(ny, nx)of the spaxel grid.
- spx_spatial_scale#
Spatial scale of a spaxel, in arcsec.
If not set, it is derived from the telescope Airy radius at
lbda_ref.
- type#
Type of the spectrograph (e.g.
"slicer"or"mla").