Effects Overview#
In ScopeSim, Effects are the building blocks of an optical system simulation.
Each Effect object represents a single physical phenomenon – atmospheric
seeing, mirror reflectivity, filter transmission, detector noise, and so on.
An OpticalTrain collects all the effects from an instrument package and
applies them in sequence to transform a Source (the on-sky light distribution)
into a realistic detector readout.
Effects are typically defined in YAML instrument configuration files, but can
also be created and added programmatically. Each effect implements an
apply_to(obj) method that receives an object at a specific stage of the
simulation pipeline and returns the modified object.
Listing Effects in an Optical Train#
To see all effects loaded in an optical train, use the .effects attribute:
import scopesim as sim
opt = sim.load_example_optical_train()
opt.effects
| element | name | class | included |
|---|---|---|---|
| str16 | str22 | str29 | bool |
| basic_atmosphere | atmospheric_radiometry | AtmosphericTERCurve | True |
| basic_telescope | psf | SeeingPSF | True |
| basic_telescope | telescope_reflection | TERCurve | True |
| basic_instrument | static_surfaces | SurfaceList | True |
| basic_instrument | filter_wheel : [J] | FilterWheel | True |
| basic_instrument | slit_wheel : [narrow] | SlitWheel | False |
| basic_instrument | image_slicer | ApertureList | False |
| basic_detector | detector_window | DetectorWindow | True |
| basic_detector | detector_3d | DetectorList3D | False |
| basic_detector | qe_curve | QuantumEfficiencyCurve | True |
| basic_detector | exposure_integration | ExposureIntegration | True |
| basic_detector | dark_current | DarkCurrent | True |
| basic_detector | shot_noise | ShotNoise | True |
| basic_detector | detector_linearity | LinearityCurve | True |
| basic_detector | readout_noise | PoorMansHxRGReadoutNoise | True |
| basic_detector | source_fits_keywords | SourceDescriptionFitsKeywords | True |
| basic_detector | effects_fits_keywords | EffectsMetaKeywords | True |
| basic_detector | config_fits_keywords | SimulationConfigFitsKeywords | True |
| basic_detector | extra_fits_keywords | ExtraFitsKeywords | True |
The Simulation Pipeline#
ScopeSim processes effects in a strict order determined by each effect’s z_order — a numerical priority that maps to a specific pipeline stage. Effects with lower z_order values run first. Each effect’s z_order can contain multiple values, allowing it to participate in more than one stage (e.g., setup and application).
The pipeline has three main phases:
%%{init: {"theme": "dark"} }%%
flowchart LR
subgraph Setup ["Setup Phase"]
direction TB
S1["FOV Setup<br/>z = 200..299"]
S2["Image Plane Setup<br/>z = 300..399"]
S3["Detector Setup<br/>z = 400..499"]
S1 --> S2 --> S3
end
subgraph Observe ["observe() Phase"]
direction TB
O1["Source Effects<br/>z = 500..599<br/><i>TER curves, filters</i>"]
O2["FOV Effects<br/>z = 600..699<br/><i>PSFs, spectral traces, shifts</i>"]
O3["Image Plane Effects<br/>z = 700..799<br/><i>Vibration, flat fields</i>"]
O1 --> O2 --> O3
end
subgraph Readout ["readout() Phase"]
direction TB
R1["Detector Effects<br/>z = 800..899<br/><i>Noise, dark current, QE</i>"]
R2["Detector Array Effects<br/>z = 900..999<br/><i>Exposure integration</i>"]
R3["FITS Header Effects<br/>z = 1000+"]
R1 --> R2 --> R3
end
S3 --> O1
O3 --> R1
Z-Order Reference#
Z-Order Range |
Pipeline Stage |
Applied To |
OpticsManager Property |
|---|---|---|---|
200–299 |
FOV setup |
|
|
300–399 |
Image plane setup |
|
|
400–499 |
Detector setup |
|
|
500–599 |
Source effects |
|
|
600–699 |
FOV effects |
|
|
700–799 |
Image plane effects |
|
|
800–899 |
Detector effects |
|
|
900–999 |
Detector array effects |
|
|
1000+ |
FITS header effects |
|
|
YAML Configuration#
Effects are typically defined in YAML instrument packages. Each effect entry specifies the class name and configuration parameters:
effects:
- name: detector_qe_curve
description: Quantum efficiency of the battery of detectors
class: QuantumEfficiencyCurve
kwargs:
filename: QE_detector_H2RG.dat
- name: dark_current
description: Detector dark current
class: DarkCurrent
kwargs:
value: 0.1 # electrons/s/pixel
- name: filter_wheel
class: FilterWheel
kwargs:
current_filter: "!OBS.filter_name"
filter_names: [J, H, Ks]
filename_format: "filters/TC_filter_{}.dat"
Parameters prefixed with ! (called bang strings) are resolved dynamically
from the simulation configuration at runtime. For example, !OBS.filter_name
reads the current filter selection from the observation commands.
Note
For real-world examples of YAML effect configurations, browse the instrument
packages in the Instrument Reference Database (IRDB).
If you have instrument packages installed locally, you can also look inside the
inst_pkgs/ folder in your ScopeSim data directory (see scopesim.rc.__config__["!SIM.file.local_packages_path"]).
Interacting with Effects at Runtime#
Effects can be accessed, toggled, and modified after the optical train is loaded.
Enabling and disabling effects#
# Turn off an effect
opt["detector_linearity"].include = False
print("detector_linearity included:", opt["detector_linearity"].include)
# Turn it back on
opt["detector_linearity"].include = True
detector_linearity included: False
Inspecting effect metadata#
opt["dark_current"].meta
{'filename': None,
'description': '',
'history': [],
'name': 'dark_current',
'image_plane_id': 0,
'temperature': -230,
'dit': '!OBS.dit',
'ndit': '!OBS.ndit',
'width': 1024,
'height': 1024,
'x': 0,
'y': 0,
'element_name': 'basic_detector',
'value': 0.1,
'include': True,
'cmds': CurrObs contents:
CurrSys contents:
├─OBS:
│ ├─instrument: basic_instrument
│ ├─psf_fwhm: 1.5
│ ├─modes: ['imaging']
│ ├─dit: 60
│ ├─ndit: 1
│ ├─slit_name: narrow
│ ├─wavelen: 2.1
│ ├─include_slit: False
│ ├─include_slicer: False
│ ├─include_det_window: True
│ ├─include_det_3d: False
│ └─filter_name: J
├─ATMO:
│ ├─background:
│ │ ├─filter_name: J
│ │ ├─value: 16.6
│ │ └─unit: mag
│ └─element_name: basic_atmosphere
├─TEL:
│ ├─telescope: Basic Telescope
│ ├─temperature: 0
│ ├─element_name: basic_telescope
│ ├─area: 0.19634954084936207 m2
│ └─etendue: 0.007853981633974483 arcsec2 m2
├─INST:
│ ├─temperature: -190
│ ├─pixel_scale: 0.2
│ ├─plate_scale: 20
│ └─element_name: basic_instrument
└─DET:
├─image_plane_id: 0
├─temperature: -230
├─dit: !OBS.dit
├─ndit: !OBS.ndit
├─width: 1024
├─height: 1024
├─x: 0
├─y: 0
└─element_name: basic_detector
SystemDict contents:
├─SIM:
│ ├─spectral:
│ │ ├─wave_min: 0.3
│ │ ├─wave_mid: 2.2
│ │ ├─wave_max: 20
│ │ ├─wave_unit: um
│ │ ├─spectral_bin_width: 0.0001
│ │ ├─spectral_resolution: 5000
│ │ ├─minimum_throughput: 1e-06
│ │ └─minimum_pixel_flux: 1
│ ├─sub_pixel:
│ │ ├─flag: False
│ │ └─fraction: 1
│ ├─random:
│ │ └─seed: None
│ ├─computing:
│ │ ├─chunk_size: 2048
│ │ ├─max_segment_size: 16777217
│ │ ├─oversampling: 1
│ │ ├─spline_order: 1
│ │ ├─flux_accuracy: 0.001
│ │ ├─preload_field_of_views: False
│ │ └─nan_fill_value: 0.0
│ ├─file:
│ │ ├─example_data:
│ │ │ ├─suburl: example_data
│ │ │ └─hash_file: example_data_registry.txt
│ │ ├─psfs:
│ │ │ ├─suburl: psfs
│ │ │ └─hash_file: psfs_registry.txt
│ │ ├─atmo:
│ │ │ ├─suburl: atmo
│ │ │ └─hash_file: atmo_registry.txt
│ │ ├─local_packages_path: /home/docs/checkouts/readthedocs.org/user_builds/scopesim/checkouts/docs-effects-documentation/scopesim/tests/mocks
│ │ ├─server_base_url: https://scopesim.univie.ac.at/InstPkgSvr/
│ │ ├─retries: 3
│ │ ├─use_cached_downloads: False
│ │ ├─search_path: ['./inst_pkgs/', './']
│ │ └─error_on_missing_file: False
│ ├─reports:
│ │ ├─ip_tracking: False
│ │ ├─verbose: False
│ │ ├─rst_path: ./reports/rst/
│ │ ├─latex_path: ./reports/latex/
│ │ ├─image_path: ./reports/images/
│ │ ├─image_format: png
│ │ └─preamble_file: None
│ └─tests:
│ ├─run_integration_tests: True
│ └─run_skycalc_ter_tests: True
├─OBS:
├─TEL:
│ ├─etendue: 0
│ └─area: 0
└─INST:
├─pixel_scale: 0
├─plate_scale: 0
└─decouple_detector_from_sky_headers: False}
Modifying parameters#
# Change the dark current value
opt["dark_current"].meta["value"] = 0.5
print("New dark current:", opt["dark_current"].meta["value"])
New dark current: 0.5
For more tips on interacting with effects, see:
Effect Categories#
Transmission, Emission, and Reflection (TER) Curves#
TER curves describe how optical surfaces transmit, emit, and reflect light as a function of wavelength. They are the most common type of effect and model everything from mirror coatings to atmospheric transmission to detector quantum efficiency.
Class |
Description |
|---|---|
|
Base wrapper for spectral transmission/emission/reflection curves |
|
Combines multiple optical surfaces into a system-level TER curve |
|
Atmospheric transmission and emission |
|
Atmospheric TER from ESO’s SkyCalc service |
|
Detector quantum efficiency vs wavelength |
|
Bandpass filter transmission from file |
|
Rectangular (top-hat) filter transmission |
|
A wheel of selectable filters |
|
A wheel of selectable top-hat filters |
|
Filters from the Spanish Virtual Observatory |
|
Filters downloadable from remote servers |
|
Pupil plane transmission curves |
|
Wheel of pupil masks |
|
Atmospheric Dispersion Corrector wheel |
Apertures and Field Masks#
Aperture effects define the on-sky field geometry — imaging windows, spectrograph slits, and IFU fields.
Class |
Description |
|---|---|
|
Defines on-sky window coordinates (imaging, slit, IFU, MOS) |
|
Rectangular aperture variant |
|
Container for multiple apertures |
|
A wheel of selectable slits |
Point Spread Functions (PSFs)#
PSF effects model the spatial blurring of point sources due to diffraction, atmospheric seeing, and optical aberrations.
Class |
Description |
|---|---|
|
Wavelength-independent Gaussian vibration kernel |
|
Atmospheric seeing as a Gaussian kernel |
|
Diffraction-limited PSF (Gaussian approximation) |
|
NCPA PSF from wavefront error maps |
|
SCAO PSF from AnisoCADO at a given Strehl ratio |
|
Field-constant PSF loaded from a FITS file |
|
Field-varying PSF loaded from a FITS file |
Shifts and Atmospheric Dispersion#
Shift effects apply wavelength-dependent positional offsets to the light distribution.
Class |
Description |
|---|---|
|
Base class for wavelength-dependent positional shifts |
|
Wavelength-dependent atmospheric refraction |
|
ADC correction for atmospheric dispersion |
Spectral Traces#
Spectral trace effects map 3D spectral data cubes onto the 2D detector plane for spectrographic modes.
Class |
Description |
|---|---|
|
Maps spectral cubes to detector plane via trace geometries |
|
A wheel of selectable spectral trace configurations |
|
Grating/dispersion efficiency (blaze function) |
Detector Geometry#
Detector geometry effects define the physical layout of detector chips on the focal plane.
Class |
Description |
|---|---|
|
Detector chip positions, sizes, pixel scale, and rotation |
|
A sub-region readout window on a detector |
|
3D detector array definition for spectroscopic modes |
Electronic and Noise Effects#
These effects model the detector electronics and noise sources that affect the final readout.
Class |
Description |
|---|---|
|
Poissonian photon noise |
|
Thermal dark current |
|
Constant bias level |
|
Generic readout noise |
|
Simplified HAWAII detector readout noise model |
|
Detector linearity and saturation |
|
Analog-to-digital conversion (electrons to ADU) |
|
Per-pixel gain variations (flat field) |
|
Inter-pixel capacitance crosstalk kernel |
Exposure and Readout#
Exposure effects handle integration time, auto-exposure, and readout formatting.
Class |
Description |
|---|---|
|
Auto-determines DIT/NDIT from saturation limits |
|
Integrates signal over the exposure time |
|
Formats the readout output |
|
Sets mode-specific detector parameters (MINDIT, FULL_WELL, RON) |
Detector Pixel Effects#
Class |
Description |
|---|---|
|
Equal pixel binning |
|
Non-uniform pixel binning |
|
Masks reference pixels at detector edges |
|
Rotates CCD by integer multiples of 90 degrees |
Observing Strategies#
Class |
Description |
|---|---|
|
Combines 4 chop/nod positions (AA, AB, BA, BB) |
FITS Header Effects#
Class |
Description |
|---|---|
|
Adds custom FITS keywords to output headers |
|
Adds effect metadata to FITS headers |
|
Adds source description keywords |
|
Adds simulation configuration keywords |
Other#
Class |
Description |
|---|---|
|
Simulates a closed shutter (zeros all pixels) |
See Also#
Creating Custom Effects — how to write your own Effect subclasses
Custom Effects Example Notebook — a worked example using MICADO and a PointSourceJitter effect
The auto-generated API Reference for scopesim.effects