Models
Data models
- pydantic model FileConfigModel[source]
Bases:
BaseModelPydantic model for transmission curve configuration.
- Fields:
- pydantic model EmissionConfigModel[source]
Bases:
BaseModelPydantic model for emission curve set configuration.
- Fields:
- field blackbody_fractions: list[Annotated[float, FieldInfo(annotation=NoneType, required=True, description='Fraction of the pupil that behaves as a pure black body.', metadata=[Ge(ge=0.0), Le(le=1.0)])]] [Optional]
- field files: list[FileConfigModel] = []
- field temperatures: list[~astropy.units.quantity.Annotated[~astropy.units.quantity.Quantity, <pydiet.server.types.quantity.QuantityAnnotation object at 0x7fe7399314e0>, FieldInfo(annotation=NoneType, required=True, description='Device temperature.', json_schema_extra={'exclusiveMinimum': '0.0 K', 'physType': 'temperature'})]] = [<Quantity 283. K>]
- pydantic model TransmissionConfigModel[source]
Bases:
BaseModelPydantic model for transmission curve set configuration.
- field files: list[FileConfigModel] = []
- pydantic model SiteConfigModel[source]
Bases:
BaseModelPydantic model for the observing site data configuration model.
- Fields:
- field altitude: 0 m', 'physType': 'length'})] [Required]
Altitude of the observation site.
- Constraints:
strict = True
unit = m
description = Altitude of the observation site.
decimals = 3
min_shape = 1
max_shape = 1
ge = -1000.0 m
- field emission: EmissionConfigModel [Required]
- field transmission: TransmissionConfigModel [Required]
- pydantic model TelescopeConfigModel[source]
Bases:
BaseModelPydantic model for the telescope data configuration model.
- Fields:
- field collecting_area: 0 m2', 'physType': 'area'})] [Required]
Full collecting area, including possible mirror hole and spider branches.
- Constraints:
strict = True
unit = m2
description = Full collecting area, including possible mirror hole and spider branches.
decimals = 3
min_shape = 1
max_shape = 1
gt = 0.0 m2
- field emission: EmissionConfigModel [Required]
- field obstruction_area: 0 m2', 'physType': 'area'})] [Required]
Default obstruction area (only used if not specified for the instrument).
- Constraints:
strict = True
unit = m2
description = Default obstruction area (only used if not specified for the instrument).
decimals = 3
min_shape = 1
max_shape = 1
gt = 0.0 m2
- field transmission: TransmissionConfigModel [Required]
- pydantic model DetectorConfigModel[source]
Bases:
BaseModelPydantic model for the detector data configuration model.
- Fields:
- field emission: EmissionConfigModel [Required]
- field gain: 0 electron / adu', 'physType': 'unknown'})] [Required]
Average gain (conversion factor) in electrons per ADU.
- Constraints:
strict = True
unit = electron/adu
description = Average gain (conversion factor) in electrons per ADU.
decimals = 3
min_shape = 1
max_shape = 1
gt = 0.0 electron / adu
- field ron: 0 electron', 'physType': 'unknown'})] [Required]
Total readout noise in electrons.
- Constraints:
strict = True
unit = electron
description = Total readout noise in electrons.
decimals = 3
min_shape = 1
max_shape = 1
ge = 0.0 electron
- field scale: ] arcsec / pix', 'physType': 'unknown'})] [Required]
Angular pixel scale along each axis.
- Constraints:
strict = True
unit = arcsec/pix
description = Angular pixel scale along each axis.
decimals = 4
min_shape = 2
max_shape = 2
gt = [0. 0.] arcsec / pix
- field transmission: TransmissionConfigModel [Required]
- pydantic model OpticsConfigModel[source]
Bases:
BaseModelPydantic model for the intrument optics data configuration model.
- Fields:
- field emission: EmissionConfigModel [Required]
- field transmission: TransmissionConfigModel [Required]
- pydantic model FiltersConfigModel[source]
Bases:
OpticsConfigModelPydantic model for the intrument filters data configuration model.
- Fields:
- pydantic model InstrumentConfigModel[source]
Bases:
BaseModelPydantic model for the instrument data configuration model.
- Fields:
- field detector: DetectorConfigModel [Required]
- field filters: FiltersConfigModel [Required]
- field obstruction_area: 0 m2', 'physType': 'area'})] [Required]
Obstruction area for this particular instrument.
- Constraints:
strict = True
unit = m2
description = Obstruction area for this particular instrument.
decimals = 3
min_shape = 1
max_shape = 1
gt = 0.0 m2
- field optics: OpticsConfigModel [Required]
- field overhead: 0 s', 'physType': 'time'})] [Required]
Total instrument time overhead between exposures.
- Constraints:
strict = True
unit = s
description = Total instrument time overhead between exposures.
decimals = 3
min_shape = 1
max_shape = 1
ge = 0.0 s
- field psf_beta: float = 3.2
Moffat beta parameter of the instrument PSF model.
- Constraints:
gt = 1.0
le = 10.0
- field wavelength_range: ] nm', 'physType': 'length'})] [Required]
Instrument minimum and maximum wavelengths.
- Constraints:
strict = True
unit = nm
description = Instrument minimum and maximum wavelengths.
decimals = 4
min_shape = 2
max_shape = 2
gt = [0. 0.] nm
- pydantic model DataConfigModel[source]
Bases:
BaseModelPydantic model for the data configuration
- Fields:
- field instruments: list[InstrumentConfigModel] [Required]
- field sites: list[SiteConfigModel] [Required]
- field telescopes: list[TelescopeConfigModel] [Required]
Default entries for models
Exceptions for model validation.
- exception ETCValidationError[source]
Bases:
ExceptionReport an ETC query value that is not valid for the selected instrument.
- Parameters:
error (dict) -- Error details using Pydantic's
type,loc,input, and context conventions.
Data models
- spectral_to_arrays(spectral: BaseSpectrum) Tuple[ndarray, ndarray][source]
Convert a spectrum to wavelength and value arrays.
One zero-valued sample is retained on either side of the non-zero region when available. An entirely zero-valued spectrum is returned unchanged.
- Parameters:
spectral (synphot.spectrum.BaseSpectrum) -- Input spectrum with a defined wavelength set.
- Returns:
wave (~numpy.ndarray) -- Wavelength samples, normally an AstroPy quantity array.
values (~numpy.ndarray) -- Spectrum values at
wave, normally an AstroPy quantity array.
- pydantic model CacheModel[source]
Bases:
BaseModelPydantic model for cached data.
- Fields:
- field transmissions: dict[str, TransmissionModel] [Required]
- field zp_abmags: dict[str, ~astropy.units.quantity.Annotated[~astropy.units.quantity.Quantity, <pydiet.server.types.quantity.QuantityAnnotation object at 0x7fe726917340>, FieldInfo(annotation=NoneType, required=True, description='Instrumental AB magnitude zero-point', json_schema_extra={'physType': 'unknown'})]] [Required]
- pydantic model DetectorModel[source]
Bases:
BaseModelPydantic model for an instrument detector (e.g., CMOS or CCD).
- Fields:
- field emissions: dict[str, SBSEDModel] [Required]
- field gain: 0 electron / adu', 'physType': 'unknown'})] [Required]
Detector conversion factor.
- Constraints:
strict = True
unit = electron / adu
description = Detector conversion factor.
decimals = 4
min_shape = 1
max_shape = 1
gt = 0.0 electron / adu
- field ron: 0 electron', 'physType': 'unknown'})] [Required]
Read-out noise RMS amplitude.
- Constraints:
strict = True
unit = electron
description = Read-out noise RMS amplitude.
decimals = 4
min_shape = 1
max_shape = 1
ge = 0.0 electron
- field scale: ] arcsec / pix', 'physType': 'unknown'})] [Required]
Angular pixel scale along each axis.
- Constraints:
strict = True
unit = arcsec/pix
description = Angular pixel scale along each axis.
decimals = 4
min_shape = 2
max_shape = 2
gt = [0. 0.] arcsec / pix
- field transmissions: dict[str, TransmissionModel] [Required]
- pydantic model InstrumentModel[source]
Bases:
BaseModelPydantic model for a PyDIET instrument.
- Config:
arbitrary_types_allowed: bool = True
- Fields:
- Validators:
_update_cache»all fields
- field cache: CacheModel | None = None
- Validated by:
_update_cache
- field detector: DetectorModel [Required]
- Validated by:
_update_cache
- field filters: FiltersModel [Required]
- Validated by:
_update_cache
- field obstruction_area: 0 m2', 'physType': 'area'})] [Required]
Default obstruction area (only used if not specified for the instrument).
- Constraints:
strict = True
unit = m2
description = Default obstruction area (only used if not specified for the instrument).
decimals = 3
min_shape = 1
max_shape = 1
gt = 0.0 m2
- Validated by:
_update_cache
- field optics: OpticsModel [Required]
- Validated by:
_update_cache
- field overhead: 0 s', 'physType': 'time'})] [Required]
Total instrument time overhead between exposures.
- Constraints:
strict = True
unit = s
description = Total instrument time overhead between exposures.
decimals = 3
min_shape = 1
max_shape = 1
ge = 0.0 s
- Validated by:
_update_cache
- field psf_beta: float = 3.2
Moffat beta parameter of the instrument PSF model.
- Constraints:
gt = 1.0
le = 10.0
- Validated by:
_update_cache
- field telescope: TelescopeModel [Required]
- Validated by:
_update_cache
- field wavelength_range: ] nm', 'physType': 'length'})] [Required]
Instrument minimum and maximum wavelengths.
- Constraints:
strict = True
unit = nm
description = Instrument minimum and maximum wavelengths.
decimals = 4
min_shape = 2
max_shape = 2
gt = [0. 0.] nm
- Validated by:
_update_cache
- pydantic model OpticsModel[source]
Bases:
BaseModelPydantic model for optics.
- field emissions: dict[str, SBSEDModel] [Required]
- field transmissions: dict[str, TransmissionModel] [Required]
- pydantic model FiltersModel[source]
Bases:
OpticsModelPydantic model for a filter set.
- Fields:
- pydantic model SBSEDModel[source]
Bases:
BaseModelPydantic model for a Surface Brightness Spectral Energy Distribution (SBSED).
- Config:
arbitrary_types_allowed: bool = True
- Fields:
- field sbsed: 0 Jy / arcsec2', 'physType': 'surface brightness'})] | None = None
- field spectral: SourceSpectrum [Required]
- field wave: 0 nm', 'physType': 'length'})] | None = None
- pydantic model SEDModel[source]
Bases:
BaseModelPydantic model for a Spectral Energy Distribution (SED).
- Config:
arbitrary_types_allowed: bool = True
- Fields:
- field sed: 0 Jy', 'physType': 'spectral flux density'})] | None = None
- field spectral: SourceSpectrum [Required]
- field wave: 0 nm', 'physType': 'length'})] | None = None
- pydantic model SiteModel[source]
Bases:
BaseModelPydantic model for an observing site.
- Fields:
- field sky_emissions: dict[str, SBSEDModel] [Required]
- field sky_transmissions: dict[str, TransmissionModel] [Required]
- pydantic model TelescopeModel[source]
Bases:
BaseModelPydantic model for a telescope.
- Fields:
- field collecting_area: 0 m2', 'physType': 'area'})] [Required]
Full collecting area, ignoring obstructions.
- Constraints:
strict = True
unit = m**2
description = Full collecting area, ignoring obstructions.
decimals = 4
min_shape = 1
max_shape = 1
gt = 0.0 m2
- field emissions: dict[str, SBSEDModel] [Required]
- field obstruction_area: 0 m2', 'physType': 'area'})] [Required]
Minimum obstruction area.
- Constraints:
strict = True
unit = m**2
description = Minimum obstruction area.
decimals = 4
min_shape = 1
max_shape = 1
gt = 0.0 m2
- field transmissions: dict[str, TransmissionModel] [Required]
- pydantic model TransmissionModel[source]
Bases:
BaseModelPydantic model for a transmission curve (with wavelength).
- Config:
arbitrary_types_allowed: bool = True
- Fields:
- field response: 0', 'physType': 'dimensionless'})] | None = None
- field spectral: SpectralElement | None = None
- field wave: 0 nm', 'physType': 'length'})] | None = None
- field wave_range: ] nm', 'physType': 'length'})] | None = None
Query models
- pydantic model ETCQueryModel[source]
Bases:
BaseModelValidated inputs for an exposure-time calculator request.
The available filter and mirror identifiers depend on
instrumentand are checked during model validation. Enum-like fields are stored as their string values.Examples
>>> query = ETCQueryModel(brightness=22., snr=5.) >>> (query.compute, query.brightness, query.snr) ('etime', 22.0, 5.0)
- Config:
arbitrary_types_allowed: bool = True
use_enum_values: bool = True
- Fields:
- Validators:
- field instrument: InstrumentID = 'megacam'
Instrument ID
- field photometry: Literal['model_fitting', 'fixed_aperture', 'optimal_aperture', 'large_aperture'] = 'model_fitting'
Photometry type
- field sky_unit: Literal['abmag', 'vegamag', 'fmegajy', 'fmujy', 'flux', 'photons'] = 'abmag'
Sky background photometric system
- field unit: Literal['abmag', 'vegamag', 'fmegajy', 'fmujy', 'flux', 'photons'] = 'abmag'
Photometric system
- validator validate_filter » filter[source]
Validate a filter identifier against the selected instrument.
- Parameters:
f (str) -- Filter identifier.
info (ValidationInfo) -- Validation context containing the previously validated instrument.
- Returns:
f (str) -- The unchanged filter identifier.
- Raises:
ETCValidationError -- If the instrument does not provide the filter and
fis not"upload".
- validator validate_mirror » mirror[source]
Validate a mirror identifier against the selected instrument.
- Parameters:
m (str) -- Mirror-condition identifier.
info (ValidationInfo) -- Validation context containing the previously validated instrument.
- Returns:
m (str) -- The unchanged mirror identifier.
- Raises:
ETCValidationError -- If the selected instrument does not provide the mirror condition.
Response models
- pydantic model ETCResponseModel[source]
Bases:
BaseModelResults returned by the exposure-time calculator.
Numerical timing values are in seconds, wavelengths and bandwidths are in nanometres, and zero points and background surface brightnesses are in AB magnitudes. Optional transmission fields contain JSON-encoded transmission models and
cutoutmay contain a base64 data URL.Examples
>>> response = ETCResponseModel( ... instrument="Demo", filter="g", compute="etime" ... ) >>> (response.etime, response.snr, response.cutout) (1.0, 10.0, None)
- Config:
use_enum_values: bool = True
- Fields:
- field bandwidth_rect: float = 0.0
Equivalent rectangular bandwidth of the full transmission curve in nm
- Constraints:
ge = 0.0
lt = 1000000000000.0
- field bkg_mag: float = 99.0
Estimated sky background in magAB/arcsec2
- Constraints:
ge = -100.0
le = 100.0
- field bkg_rate: float = 99.0
Estimated sky background rate in photons/s/pixel
- Constraints:
ge = 0.0
le = 1e+30
- field etime_skysat: float = 0.0
Estimated exposure time for sky background saturation [s]
- Constraints:
ge = 0.0
lt = 1e+30
- field etime_sourcesat: float = 0.0
Estimated exposure time for source saturation [s]
- Constraints:
ge = 0.0
lt = 1e+30
- field lambda_pivot: float = 0.0
Pivot wavelength of the full transmission curve in nm
- Constraints:
ge = 0.0
lt = 1000000000000.0
- field trans_peak: float = 1.0
Peak amplitude of the total transmission curve
- Constraints:
ge = 0.0
le = 1.0
- field trans_peak_instru: float = 1.0
Peak amplitude of the instrumental transmission curve
- Constraints:
ge = 0.0
le = 1.0
Custom types for PyDIET data models