iactrace.io¶
Functions for loading and saving telescope and camera configurations.
Loaders¶
- iactrace.io.load_telescope_config(filename, n_samples=100, *, key)[source]¶
Load a telescope from a standalone telescope YAML file.
The file describes optics (mirrors, lenses, obstructions) and the camera frame (
telescope.camera_positionandtelescope.camera_rotation). A camera is loaded separately viaload_camera_config()/Camera.from_yaml().- Args:
filename: Path to the telescope YAML file. n_samples: Number of Monte Carlo samples per mirror element. key: JAX random key for sampling and roughness.
Builders¶
Savers¶
- iactrace.io.save_telescope(telescope, filename, precision=8, overwrite=True)[source]¶
Save a Telescope object to a standalone telescope YAML file.
- Args:
telescope: The Telescope object to save. filename: Output file path. precision: Number of decimal places for float values. overwrite: If True, overwrite existing file.
- Returns:
Path to the saved file.
- iactrace.io.save_camera(camera, filename, precision=6, overwrite=True)[source]¶
Save a Camera to a standalone YAML file.
Sensor positions are written in camera-local coordinates.
- Args:
camera: The Camera object to save. filename: Output file path. precision: Number of decimal places for float values. overwrite: If True, overwrite existing file.
- Returns:
Path to the saved file.
Schemas¶
- class iactrace.io.TelescopeConfigSchema[source]¶
Bases:
BaseModelTop-level schema for a telescope-only YAML file.
Describes the optical system (mirrors, lenses, obstructions) plus the camera frame (where rays should be delivered) in world coordinates. Sensor layout and detector response live in a separate camera file (see
CameraFileSchema).- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- telescope¶
- mirror_templates¶
- mirrors¶
- lenses¶
- obstructions¶
- validate_template_references()[source]¶
Validate that all mirror template references exist.
A mirror with no
template(fully self-contained) has nothing to check here.
- validate_optical_stages()[source]¶
Each optical stage may contain only one optical group.
Mirrors and lenses are each grouped per stage by the adapter; having a mirror and a lens at the same stage, or elements of different aperture types at the same stage, would build two groups for that stage and trip the same check in
Telescope.__init__with a far less actionable error.
- class iactrace.io.CameraFileSchema[source]¶
Bases:
BaseModelTop-level schema for a standalone camera YAML file.
A camera file is a list of
sensors; each sensor group carries its own detector geometry and detection chain (concentrator/gap/photosensor), so different groups can run different chains.Sensor positions are always in the camera-local frame. There is no world-frame mode: loading interprets every
sensors[*].positionas an offset from the camera origin, and saving writes them the same way. Unknown top-level keys (e.g. a hopefulframe: worldtag) raiseValidationErrorthanks toextra="forbid".The telescope and the camera frame live in the telescope YAML (
TelescopeConfigSchema.telescope.camera_position / camera_rotation); the camera file knows nothing about the world.- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- sensors¶