Working with Instruments

When working with multi wavelength observations we need a way to collect the technical properties of each observing mode, such as filters, wavelength arrays, spatial resolution, PSFs, depths, or noise maps. Synthesizer provides specialised instrument classes for this purpose, together with InstrumentCollection for combining multiple instruments.

For most workflows you should construct the specialised class that matches the observation you want to make:

  • PhotometricInstrument for integrated photometry

  • PhotometricImager for resolved imaging

  • SpectroscopicInstrument for one-dimensional spectroscopy

  • IntegratedFieldUnit for resolved spectroscopy

The Instrument(...) constructor still exists as a convenience factory, but it is optional and is shown briefly at the end of this notebook.

For a Pipeline (see pipeline docs) instrument objects are an important building block of automating observable generation.

Below we explain how to create and combine instrument objects, and then show the main instrument types. We also provide a collection of common premade instruments which can be imported directly from the instruments module. These are described in the premade instruments docs.

Creating photometric instruments

We will begin with simple photometric instruments that define only filters. This is the right shape when you only need integrated photometry. We’ll create two filter collections, one for Webb’s NIRCam instrument and the other for generic UVJ top hats.

For more information on filters see the filter docs.

[1]:
from synthesizer.instruments import (
    UVJ,
    FilterCollection,
    Instrument,
    InstrumentCollection,
    IntegratedFieldUnit,
    PhotometricImager,
    PhotometricInstrument,
    SpectroscopicInstrument,
)

# Get the filters
webb_filters = FilterCollection(
    filter_codes=[
        f"JWST/NIRCam.{f}"
        for f in ["F090W", "F150W", "F200W", "F277W", "F356W", "F444W"]
    ],
)
uvj_filters = UVJ()

Now that we have the filters in hand we can instantiate PhotometricInstrument objects with the filters and a label.

[2]:
# Instantiate the instruments
webb_inst = PhotometricInstrument(label="JWST", filters=webb_filters)
uvj_inst = PhotometricInstrument(label="UVJ", filters=uvj_filters)

As with everything else in Synthesizer, we can print the instruments to inspect their configuration and capability flags.

[3]:
print(webb_inst)
+------------------------------------------------------------------------------------------------------------------+
|                                                    INSTRUMENT                                                    |
+------------------------------------+-----------------------------------------------------------------------------+
| Attribute                          | Value                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| label                              | 'JWST'                                                                      |
+------------------------------------+-----------------------------------------------------------------------------+
| filters                            | <synthesizer.instruments.filters.FilterCollection object at 0x7fca24c09210> |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_imaging                     | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_line_mapping                | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_noisy_imaging               | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_noisy_line_mapping          | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_noisy_resolved_spectroscopy | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_noisy_spectroscopy          | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_photometry                  | True                                                                        |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_psf_imaging                 | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_psf_line_mapping            | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_psf_spectroscopy            | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_resolved_spectroscopy       | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_spectroscopy                | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| instrument_type                    | 'photometric'                                                               |
+------------------------------------+-----------------------------------------------------------------------------+
[4]:
print(uvj_inst)
+------------------------------------------------------------------------------------------------------------------+
|                                                    INSTRUMENT                                                    |
+------------------------------------+-----------------------------------------------------------------------------+
| Attribute                          | Value                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| label                              | 'UVJ'                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| filters                            | <synthesizer.instruments.filters.FilterCollection object at 0x7fca24c0abf0> |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_imaging                     | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_line_mapping                | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_noisy_imaging               | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_noisy_line_mapping          | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_noisy_resolved_spectroscopy | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_noisy_spectroscopy          | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_photometry                  | True                                                                        |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_psf_imaging                 | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_psf_line_mapping            | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_psf_spectroscopy            | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_resolved_spectroscopy       | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_spectroscopy                | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| instrument_type                    | 'photometric'                                                               |
+------------------------------------+-----------------------------------------------------------------------------+

You can see from these print outs that we have the label and FilterCollection we passed together with capability flags defining what the instrument can be used for. Since we only passed filters this instrument is suitable for photometry, but not imaging or spectroscopy.

Combining Instruments

If we want to combine these into a single InstrumentCollection we can simply add them together. This can be done for arbitrarily many instruments.

[5]:
instruments = webb_inst + uvj_inst
print(instruments)
+-------------------------------------------------------------------------------------------------+
|                                      INSTRUMENT COLLECTION                                      |
+-------------------+-----------------------------------------------------------------------------+
| Attribute         | Value                                                                       |
+-------------------+-----------------------------------------------------------------------------+
| all_filters       | <synthesizer.instruments.filters.FilterCollection object at 0x7fca24c0a8f0> |
+-------------------+-----------------------------------------------------------------------------+
| ninstruments      | 2                                                                           |
+-------------------+-----------------------------------------------------------------------------+
| instrument_labels | [JWST, UVJ]                                                                 |
+-------------------+-----------------------------------------------------------------------------+
| instruments       | JWST: PhotometricInstrument                                                 |
|                   | UVJ: PhotometricInstrument                                                  |
+-------------------+-----------------------------------------------------------------------------+

Here we can see the InstrumentCollection contains both instruments as expected.

Working with InstrumentCollections

If we want to extract a specific instrument from an InstrumentCollection we can treat it exactly as we would a dictionary by indexing with the label.

[6]:
print(instruments["JWST"].label)
JWST

If we want to loop through Instruments in the collection we can treat it as an iterable.

[7]:
for inst in instruments:
    print(inst.label)
JWST
UVJ

We can write an InstrumentCollection to a HDF5 file to reload it later by calling the write_instruments method. This simply requires a filepath for where to save the InstrumentCollection.

[8]:
instruments.write_instruments("instruments.hdf5")

We can then use this file later rather than making and combining all the individual Instruments but passing the filepath to an InstrumentCollection at instantiation.

[9]:
instruments = InstrumentCollection(filepath="instruments.hdf5")

Instrument Types

We’ve already seen the pure photometry case where you only need a FilterCollection on a PhotometricInstrument. Below each section shows the specialised class used for a different observing mode.

Spectroscopy

It is entirely possible to generate spectra for a galaxy without an instrument, instead using the grid wavelength array. If you want to match a particular spectroscopic setup, construct a SpectroscopicInstrument with the wavelength array you want to observe on.

[10]:
import numpy as np
from unyt import angstrom

lsst_inst = SpectroscopicInstrument(
    label="LSST", lam=np.linspace(10**3, 10**4, 100) * angstrom
)
print(lsst_inst)
+----------------------------------------------------------------------------------+
|                                    INSTRUMENT                                    |
+------------------------------------+---------------------------------------------+
| Attribute                          | Value                                       |
+------------------------------------+---------------------------------------------+
| label                              | 'LSST'                                      |
+------------------------------------+---------------------------------------------+
| can_do_imaging                     | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_line_mapping                | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_noisy_imaging               | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_noisy_line_mapping          | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_noisy_resolved_spectroscopy | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_noisy_spectroscopy          | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_photometry                  | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_psf_imaging                 | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_psf_line_mapping            | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_psf_spectroscopy            | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_resolved_spectroscopy       | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_spectroscopy                | True                                        |
+------------------------------------+---------------------------------------------+
| instrument_type                    | 'spectroscopic'                             |
+------------------------------------+---------------------------------------------+
| lam (100,)                         | 1.00e+03 Å -> 1.00e+04 Å (Mean: 5.50e+03 Å) |
+------------------------------------+---------------------------------------------+

Integrated spectroscopy currently uses the instrument wavelength array, but instrument-owned spectroscopy noise is not implemented yet.

[11]:
desi_inst = SpectroscopicInstrument(
    label="DESI", lam=np.linspace(10**3, 10**4, 100) * angstrom
)
print(desi_inst)
+----------------------------------------------------------------------------------+
|                                    INSTRUMENT                                    |
+------------------------------------+---------------------------------------------+
| Attribute                          | Value                                       |
+------------------------------------+---------------------------------------------+
| label                              | 'DESI'                                      |
+------------------------------------+---------------------------------------------+
| can_do_imaging                     | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_line_mapping                | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_noisy_imaging               | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_noisy_line_mapping          | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_noisy_resolved_spectroscopy | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_noisy_spectroscopy          | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_photometry                  | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_psf_imaging                 | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_psf_line_mapping            | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_psf_spectroscopy            | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_resolved_spectroscopy       | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_spectroscopy                | True                                        |
+------------------------------------+---------------------------------------------+
| instrument_type                    | 'spectroscopic'                             |
+------------------------------------+---------------------------------------------+
| lam (100,)                         | 1.00e+03 Å -> 1.00e+04 Å (Mean: 5.50e+03 Å) |
+------------------------------------+---------------------------------------------+

Imaging

For imaging we use PhotometricImager. This combines filters with a spatial resolution, and can optionally also carry PSFs, noise_maps, or noise_source_maps.

[12]:
from unyt import kpc

webb_inst = PhotometricImager(
    label="JWST", filters=webb_filters, resolution=0.1 * kpc
)
print(webb_inst)
+------------------------------------------------------------------------------------------------------------------+
|                                                    INSTRUMENT                                                    |
+------------------------------------+-----------------------------------------------------------------------------+
| Attribute                          | Value                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| label                              | 'JWST'                                                                      |
+------------------------------------+-----------------------------------------------------------------------------+
| filters                            | <synthesizer.instruments.filters.FilterCollection object at 0x7fca24c09210> |
+------------------------------------+-----------------------------------------------------------------------------+
| psf_resample_factor                | 1                                                                           |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_imaging                     | True                                                                        |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_line_mapping                | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_noisy_imaging               | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_noisy_line_mapping          | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_noisy_resolved_spectroscopy | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_noisy_spectroscopy          | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_photometry                  | True                                                                        |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_psf_imaging                 | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_psf_line_mapping            | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_psf_spectroscopy            | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_resolved_spectroscopy       | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_spectroscopy                | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| instrument_type                    | 'photometric_imager'                                                        |
+------------------------------------+-----------------------------------------------------------------------------+
| resolution                         | 0.1 kpc                                                                     |
+------------------------------------+-----------------------------------------------------------------------------+

If we want to include the effects of an instrument point spread function, we can pass a dictionary of PSF arrays with one entry for each filter.

[13]:
# Generate a dictionary of FAKE PSFs, importantly with a PSF for each filter
psfs = {f: np.ones((100, 100)) for f in webb_filters.filters}

webb_inst = PhotometricImager(
    label="JWST", filters=webb_filters, resolution=0.1 * kpc, psfs=psfs
)
print(webb_inst)
+------------------------------------------------------------------------------------------------------------------+
|                                                    INSTRUMENT                                                    |
+------------------------------------+-----------------------------------------------------------------------------+
| Attribute                          | Value                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| label                              | 'JWST'                                                                      |
+------------------------------------+-----------------------------------------------------------------------------+
| filters                            | <synthesizer.instruments.filters.FilterCollection object at 0x7fca24c09210> |
+------------------------------------+-----------------------------------------------------------------------------+
| psf_resample_factor                | 1                                                                           |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_imaging                     | True                                                                        |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_line_mapping                | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_noisy_imaging               | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_noisy_line_mapping          | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_noisy_resolved_spectroscopy | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_noisy_spectroscopy          | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_photometry                  | True                                                                        |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_psf_imaging                 | True                                                                        |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_psf_line_mapping            | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_psf_spectroscopy            | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_resolved_spectroscopy       | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_spectroscopy                | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| instrument_type                    | 'photometric_imager'                                                        |
+------------------------------------+-----------------------------------------------------------------------------+
| resolution                         | 0.1 kpc                                                                     |
+------------------------------------+-----------------------------------------------------------------------------+
| psfs                               | JWST/NIRCam.F090W: ndarray                                                  |
|                                    | JWST/NIRCam.F150W: ndarray                                                  |
|                                    | JWST/NIRCam.F200W: ndarray                                                  |
|                                    | JWST/NIRCam.F277W: ndarray                                                  |
|                                    | JWST/NIRCam.F356W: ndarray                                                  |
|                                    | JWST/NIRCam.F444W: ndarray                                                  |
+------------------------------------+-----------------------------------------------------------------------------+

If we want to include noise there’s a couple of different approaches.

We can either pass the depth and Signal-to-Noise Ratio (SNR) for each filter.

[14]:
# Generate depths and snrs, again there must be one for each filter
depths = {f: 28.0 for f in webb_filters.filters}
snrs = {f: 5.0 for f in webb_filters.filters}

webb_inst = PhotometricImager(
    label="JWST",
    filters=webb_filters,
    resolution=0.1 * kpc,
    psfs=psfs,
    depth=depths,
    snrs=snrs,
)
print(webb_inst)
+------------------------------------------------------------------------------------------------------------------+
|                                                    INSTRUMENT                                                    |
+------------------------------------+-----------------------------------------------------------------------------+
| Attribute                          | Value                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| label                              | 'JWST'                                                                      |
+------------------------------------+-----------------------------------------------------------------------------+
| filters                            | <synthesizer.instruments.filters.FilterCollection object at 0x7fca24c09210> |
+------------------------------------+-----------------------------------------------------------------------------+
| psf_resample_factor                | 1                                                                           |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_imaging                     | True                                                                        |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_line_mapping                | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_noisy_imaging               | True                                                                        |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_noisy_line_mapping          | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_noisy_resolved_spectroscopy | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_noisy_spectroscopy          | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_photometry                  | True                                                                        |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_psf_imaging                 | True                                                                        |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_psf_line_mapping            | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_psf_spectroscopy            | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_resolved_spectroscopy       | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_spectroscopy                | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| instrument_type                    | 'photometric_imager'                                                        |
+------------------------------------+-----------------------------------------------------------------------------+
| resolution                         | 0.1 kpc                                                                     |
+------------------------------------+-----------------------------------------------------------------------------+
| depth                              | JWST/NIRCam.F090W: 28.0                                                     |
|                                    | JWST/NIRCam.F150W: 28.0                                                     |
|                                    | JWST/NIRCam.F200W: 28.0                                                     |
|                                    | JWST/NIRCam.F277W: 28.0                                                     |
|                                    | JWST/NIRCam.F356W: 28.0                                                     |
|                                    | JWST/NIRCam.F444W: 28.0                                                     |
+------------------------------------+-----------------------------------------------------------------------------+
| snrs                               | JWST/NIRCam.F090W: 5.0                                                      |
|                                    | JWST/NIRCam.F150W: 5.0                                                      |
|                                    | JWST/NIRCam.F200W: 5.0                                                      |
|                                    | JWST/NIRCam.F277W: 5.0                                                      |
|                                    | JWST/NIRCam.F356W: 5.0                                                      |
|                                    | JWST/NIRCam.F444W: 5.0                                                      |
+------------------------------------+-----------------------------------------------------------------------------+
| psfs                               | JWST/NIRCam.F090W: ndarray                                                  |
|                                    | JWST/NIRCam.F150W: ndarray                                                  |
|                                    | JWST/NIRCam.F200W: ndarray                                                  |
|                                    | JWST/NIRCam.F277W: ndarray                                                  |
|                                    | JWST/NIRCam.F356W: ndarray                                                  |
|                                    | JWST/NIRCam.F444W: ndarray                                                  |
+------------------------------------+-----------------------------------------------------------------------------+

If we already have noise maps for each filter we can instead pass a noise map per filter.

[15]:
# Generate FAKE noise maps, again there must be one for each filter
noise_maps = {f: np.random.rand(100, 100) for f in webb_filters.filters}

webb_inst = PhotometricImager(
    label="JWST",
    filters=webb_filters,
    resolution=0.1 * kpc,
    noise_maps=noise_maps,
)
print(webb_inst)
+------------------------------------------------------------------------------------------------------------------+
|                                                    INSTRUMENT                                                    |
+------------------------------------+-----------------------------------------------------------------------------+
| Attribute                          | Value                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| label                              | 'JWST'                                                                      |
+------------------------------------+-----------------------------------------------------------------------------+
| filters                            | <synthesizer.instruments.filters.FilterCollection object at 0x7fca24c09210> |
+------------------------------------+-----------------------------------------------------------------------------+
| psf_resample_factor                | 1                                                                           |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_imaging                     | True                                                                        |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_line_mapping                | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_noisy_imaging               | True                                                                        |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_noisy_line_mapping          | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_noisy_resolved_spectroscopy | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_noisy_spectroscopy          | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_photometry                  | True                                                                        |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_psf_imaging                 | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_psf_line_mapping            | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_psf_spectroscopy            | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_resolved_spectroscopy       | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_spectroscopy                | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| instrument_type                    | 'photometric_imager'                                                        |
+------------------------------------+-----------------------------------------------------------------------------+
| resolution                         | 0.1 kpc                                                                     |
+------------------------------------+-----------------------------------------------------------------------------+
| noise_maps                         | JWST/NIRCam.F090W: ndarray                                                  |
|                                    | JWST/NIRCam.F150W: ndarray                                                  |
|                                    | JWST/NIRCam.F200W: ndarray                                                  |
|                                    | JWST/NIRCam.F277W: ndarray                                                  |
|                                    | JWST/NIRCam.F356W: ndarray                                                  |
|                                    | JWST/NIRCam.F444W: ndarray                                                  |
+------------------------------------+-----------------------------------------------------------------------------+

Resolved Spectroscopy

For resolved spectroscopy we use IntegratedFieldUnit. This combines a wavelength array with a spatial resolution for spectral-cube generation.

[16]:
nirspec = IntegratedFieldUnit(
    label="NIRSpec",
    lam=np.linspace(10**3, 10**4, 100) * angstrom,
    resolution=0.1 * kpc,
)
print(nirspec)
+----------------------------------------------------------------------------------+
|                                    INSTRUMENT                                    |
+------------------------------------+---------------------------------------------+
| Attribute                          | Value                                       |
+------------------------------------+---------------------------------------------+
| label                              | 'NIRSpec'                                   |
+------------------------------------+---------------------------------------------+
| psf_resample_factor                | 1                                           |
+------------------------------------+---------------------------------------------+
| can_do_imaging                     | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_line_mapping                | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_noisy_imaging               | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_noisy_line_mapping          | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_noisy_resolved_spectroscopy | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_noisy_spectroscopy          | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_photometry                  | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_psf_imaging                 | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_psf_line_mapping            | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_psf_spectroscopy            | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_resolved_spectroscopy       | True                                        |
+------------------------------------+---------------------------------------------+
| can_do_spectroscopy                | True                                        |
+------------------------------------+---------------------------------------------+
| instrument_type                    | 'ifu'                                       |
+------------------------------------+---------------------------------------------+
| lam (100,)                         | 1.00e+03 Å -> 1.00e+04 Å (Mean: 5.50e+03 Å) |
+------------------------------------+---------------------------------------------+
| resolution                         | 0.1 kpc                                     |
+------------------------------------+---------------------------------------------+

IFU instruments can also carry PSF or noise configuration, but the resolved-spectroscopy post-processing methods are placeholders and are not implemented yet. The examples below therefore keep using minimal IntegratedFieldUnit(...) constructors and should be read as shape-only placeholders for future IFU PSF/noise support.

[17]:
nirspec = IntegratedFieldUnit(
    label="NIRSpecPSF",
    lam=np.linspace(10**3, 10**4, 100) * angstrom,
    resolution=0.1 * kpc,
)
print(nirspec)
+----------------------------------------------------------------------------------+
|                                    INSTRUMENT                                    |
+------------------------------------+---------------------------------------------+
| Attribute                          | Value                                       |
+------------------------------------+---------------------------------------------+
| label                              | 'NIRSpecPSF'                                |
+------------------------------------+---------------------------------------------+
| psf_resample_factor                | 1                                           |
+------------------------------------+---------------------------------------------+
| can_do_imaging                     | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_line_mapping                | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_noisy_imaging               | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_noisy_line_mapping          | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_noisy_resolved_spectroscopy | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_noisy_spectroscopy          | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_photometry                  | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_psf_imaging                 | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_psf_line_mapping            | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_psf_spectroscopy            | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_resolved_spectroscopy       | True                                        |
+------------------------------------+---------------------------------------------+
| can_do_spectroscopy                | True                                        |
+------------------------------------+---------------------------------------------+
| instrument_type                    | 'ifu'                                       |
+------------------------------------+---------------------------------------------+
| lam (100,)                         | 1.00e+03 Å -> 1.00e+04 Å (Mean: 5.50e+03 Å) |
+------------------------------------+---------------------------------------------+
| resolution                         | 0.1 kpc                                     |
+------------------------------------+---------------------------------------------+

The same IFU instrument shape can also carry future noise configuration, but those resolved-spectroscopy post-processing paths are not implemented yet. These examples still show only the required label, wavelength grid, and spatial resolution because IFU PSF/noise application is not available yet.

[18]:
nirspec = IntegratedFieldUnit(
    label="NIRSpecNoise",
    lam=np.linspace(10**3, 10**4, 100) * angstrom,
    resolution=0.1 * kpc,
)
print(nirspec)
+----------------------------------------------------------------------------------+
|                                    INSTRUMENT                                    |
+------------------------------------+---------------------------------------------+
| Attribute                          | Value                                       |
+------------------------------------+---------------------------------------------+
| label                              | 'NIRSpecNoise'                              |
+------------------------------------+---------------------------------------------+
| psf_resample_factor                | 1                                           |
+------------------------------------+---------------------------------------------+
| can_do_imaging                     | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_line_mapping                | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_noisy_imaging               | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_noisy_line_mapping          | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_noisy_resolved_spectroscopy | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_noisy_spectroscopy          | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_photometry                  | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_psf_imaging                 | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_psf_line_mapping            | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_psf_spectroscopy            | False                                       |
+------------------------------------+---------------------------------------------+
| can_do_resolved_spectroscopy       | True                                        |
+------------------------------------+---------------------------------------------+
| can_do_spectroscopy                | True                                        |
+------------------------------------+---------------------------------------------+
| instrument_type                    | 'ifu'                                       |
+------------------------------------+---------------------------------------------+
| lam (100,)                         | 1.00e+03 Å -> 1.00e+04 Å (Mean: 5.50e+03 Å) |
+------------------------------------+---------------------------------------------+
| resolution                         | 0.1 kpc                                     |
+------------------------------------+---------------------------------------------+

Convenience factory

If you prefer, Instrument(...) can still be used as a convenience constructor. It inspects the supplied keyword arguments and dispatches to the appropriate specialised class. The direct specialised constructors shown above are preferred in most documentation and scripts.

[19]:
factory_inst = Instrument(
    "FactoryImager",
    filters=webb_filters,
    resolution=0.1 * kpc,
)
print(type(factory_inst).__name__)
print(factory_inst)
PhotometricImager
+------------------------------------------------------------------------------------------------------------------+
|                                                    INSTRUMENT                                                    |
+------------------------------------+-----------------------------------------------------------------------------+
| Attribute                          | Value                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| label                              | 'FactoryImager'                                                             |
+------------------------------------+-----------------------------------------------------------------------------+
| filters                            | <synthesizer.instruments.filters.FilterCollection object at 0x7fca24c09210> |
+------------------------------------+-----------------------------------------------------------------------------+
| psf_resample_factor                | 1                                                                           |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_imaging                     | True                                                                        |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_line_mapping                | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_noisy_imaging               | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_noisy_line_mapping          | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_noisy_resolved_spectroscopy | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_noisy_spectroscopy          | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_photometry                  | True                                                                        |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_psf_imaging                 | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_psf_line_mapping            | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_psf_spectroscopy            | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_resolved_spectroscopy       | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| can_do_spectroscopy                | False                                                                       |
+------------------------------------+-----------------------------------------------------------------------------+
| instrument_type                    | 'photometric_imager'                                                        |
+------------------------------------+-----------------------------------------------------------------------------+
| resolution                         | 0.1 kpc                                                                     |
+------------------------------------+-----------------------------------------------------------------------------+