Coverage for middle_layer/propose/domain_layer/entities/calibration_parameter.py: 93.75%
16 statements
« prev ^ index » next coverage.py v7.10.5, created at 2026-03-09 06:13 +0000
« prev ^ index » next coverage.py v7.10.5, created at 2026-03-09 06:13 +0000
1# Copyright 2024 Associated Universities, Inc.
2#
3# This file is part of Telescope Time Allocation Tools (TTAT).
4#
5# TTAT is free software: you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation, either version 3 of the License, or
8# any later version.
9#
10# TTAT is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with TTAT. If not, see <https://www.gnu.org/licenses/>.
17#
18# pyright: reportImportCycles=false
20from typing import TYPE_CHECKING
22from sqlalchemy import ForeignKey
23from sqlalchemy.orm import Mapped, mapped_column, relationship
25from common.domain_layer.entities.base import Base
27if TYPE_CHECKING:
28 from propose.domain_layer.entities.proposal import CapabilityRequest
31class CalibrationParameter(Base):
32 __tablename__ = "calibration_parameters"
34 calibration_parameter_id: Mapped[int] = mapped_column(primary_key=True)
35 capability_request_id: Mapped[int] = mapped_column(
36 ForeignKey("capability_requests.capability_request_id", ondelete="CASCADE"),
37 nullable=False,
38 )
40 capability_request: Mapped["CapabilityRequest"] = relationship(
41 "CapabilityRequest",
42 foreign_keys=[capability_request_id],
43 back_populates="calibration_parameter",
44 )
46 flux_density_calibration: Mapped[bool]
47 test_source: Mapped[bool]
48 polarization_calibration: Mapped[bool]
50 def clone(self, parent: "CapabilityRequest|None" = None) -> "CalibrationParameter":
51 return CalibrationParameter(
52 flux_density_calibration=self.flux_density_calibration,
53 test_source=self.test_source,
54 polarization_calibration=self.polarization_calibration,
55 capability_request=parent or self.capability_request,
56 )