version 1.0.0-rc.13
This commit is contained in:
50
python-client/openapi_client/models/__init__.py
Normal file
50
python-client/openapi_client/models/__init__.py
Normal file
@@ -0,0 +1,50 @@
|
||||
# coding: utf-8
|
||||
|
||||
# flake8: noqa
|
||||
"""
|
||||
Jungfraujoch
|
||||
|
||||
Jungfraujoch Broker Web API
|
||||
|
||||
The version of the OpenAPI document: 1.0.0-rc.13
|
||||
Contact: filip.leonarski@psi.ch
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
# import models into model package
|
||||
from openapi_client.models.azim_int_settings import AzimIntSettings
|
||||
from openapi_client.models.broker_status import BrokerStatus
|
||||
from openapi_client.models.calibration_statistics_inner import CalibrationStatisticsInner
|
||||
from openapi_client.models.dataset_settings import DatasetSettings
|
||||
from openapi_client.models.dataset_settings_unit_cell import DatasetSettingsUnitCell
|
||||
from openapi_client.models.detector import Detector
|
||||
from openapi_client.models.detector_list import DetectorList
|
||||
from openapi_client.models.detector_list_detectors_inner import DetectorListDetectorsInner
|
||||
from openapi_client.models.detector_module import DetectorModule
|
||||
from openapi_client.models.detector_module_direction import DetectorModuleDirection
|
||||
from openapi_client.models.detector_selection import DetectorSelection
|
||||
from openapi_client.models.detector_settings import DetectorSettings
|
||||
from openapi_client.models.detector_status import DetectorStatus
|
||||
from openapi_client.models.detector_type import DetectorType
|
||||
from openapi_client.models.error_message import ErrorMessage
|
||||
from openapi_client.models.fpga_status_inner import FpgaStatusInner
|
||||
from openapi_client.models.image_format_settings import ImageFormatSettings
|
||||
from openapi_client.models.image_pusher_type import ImagePusherType
|
||||
from openapi_client.models.instrument_metadata import InstrumentMetadata
|
||||
from openapi_client.models.jfjoch_settings import JfjochSettings
|
||||
from openapi_client.models.measurement_statistics import MeasurementStatistics
|
||||
from openapi_client.models.pcie_devices_inner import PcieDevicesInner
|
||||
from openapi_client.models.plot import Plot
|
||||
from openapi_client.models.plots import Plots
|
||||
from openapi_client.models.preview_settings import PreviewSettings
|
||||
from openapi_client.models.roi_box import RoiBox
|
||||
from openapi_client.models.roi_box_list import RoiBoxList
|
||||
from openapi_client.models.roi_circle import RoiCircle
|
||||
from openapi_client.models.roi_circle_list import RoiCircleList
|
||||
from openapi_client.models.rotation_axis import RotationAxis
|
||||
from openapi_client.models.spot_finding_settings import SpotFindingSettings
|
||||
from openapi_client.models.standard_detector_geometry import StandardDetectorGeometry
|
||||
from openapi_client.models.zeromq_settings import ZeromqSettings
|
||||
97
python-client/openapi_client/models/azim_int_settings.py
Normal file
97
python-client/openapi_client/models/azim_int_settings.py
Normal file
@@ -0,0 +1,97 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Jungfraujoch
|
||||
|
||||
Jungfraujoch Broker Web API
|
||||
|
||||
The version of the OpenAPI document: 1.0.0-rc.13
|
||||
Contact: filip.leonarski@psi.ch
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt
|
||||
from typing import Any, ClassVar, Dict, List, Optional, Union
|
||||
from typing_extensions import Annotated
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class AzimIntSettings(BaseModel):
|
||||
"""
|
||||
AzimIntSettings
|
||||
""" # noqa: E501
|
||||
polarization_factor: Optional[Union[Annotated[float, Field(le=1.0, strict=True, ge=-1.0)], Annotated[int, Field(le=1, strict=True, ge=-1)]]] = Field(default=None, description="If polarization factor is provided, than polarization correction is enabled.")
|
||||
solid_angle_corr: StrictBool = Field(description="Apply solid angle correction for radial integration")
|
||||
high_q_recip_a: Union[StrictFloat, StrictInt] = Field(alias="high_q_recipA")
|
||||
low_q_recip_a: Union[StrictFloat, StrictInt] = Field(alias="low_q_recipA")
|
||||
q_spacing: Union[StrictFloat, StrictInt]
|
||||
__properties: ClassVar[List[str]] = ["polarization_factor", "solid_angle_corr", "high_q_recipA", "low_q_recipA", "q_spacing"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of AzimIntSettings from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of AzimIntSettings from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"polarization_factor": obj.get("polarization_factor"),
|
||||
"solid_angle_corr": obj.get("solid_angle_corr") if obj.get("solid_angle_corr") is not None else True,
|
||||
"high_q_recipA": obj.get("high_q_recipA"),
|
||||
"low_q_recipA": obj.get("low_q_recipA"),
|
||||
"q_spacing": obj.get("q_spacing")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
100
python-client/openapi_client/models/broker_status.py
Normal file
100
python-client/openapi_client/models/broker_status.py
Normal file
@@ -0,0 +1,100 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Jungfraujoch
|
||||
|
||||
Jungfraujoch Broker Web API
|
||||
|
||||
The version of the OpenAPI document: 1.0.0-rc.13
|
||||
Contact: filip.leonarski@psi.ch
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
||||
from typing import Any, ClassVar, Dict, List, Optional, Union
|
||||
from typing_extensions import Annotated
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class BrokerStatus(BaseModel):
|
||||
"""
|
||||
BrokerStatus
|
||||
""" # noqa: E501
|
||||
state: StrictStr
|
||||
progress: Optional[Union[Annotated[float, Field(le=1.0, strict=True, ge=0.0)], Annotated[int, Field(le=1, strict=True, ge=0)]]] = None
|
||||
indexing_rate: Optional[Union[Annotated[float, Field(le=1.0, strict=True, ge=0.0)], Annotated[int, Field(le=1, strict=True, ge=0)]]] = None
|
||||
__properties: ClassVar[List[str]] = ["state", "progress", "indexing_rate"]
|
||||
|
||||
@field_validator('state')
|
||||
def state_validate_enum(cls, value):
|
||||
"""Validates the enum"""
|
||||
if value not in set(['Inactive', 'Idle', 'Busy', 'Measuring', 'Pedestal', 'Error']):
|
||||
raise ValueError("must be one of enum values ('Inactive', 'Idle', 'Busy', 'Measuring', 'Pedestal', 'Error')")
|
||||
return value
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of BrokerStatus from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of BrokerStatus from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"state": obj.get("state"),
|
||||
"progress": obj.get("progress"),
|
||||
"indexing_rate": obj.get("indexing_rate")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Jungfraujoch
|
||||
|
||||
Jungfraujoch Broker Web API
|
||||
|
||||
The version of the OpenAPI document: 1.0.0-rc.13
|
||||
Contact: filip.leonarski@psi.ch
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt
|
||||
from typing import Any, ClassVar, Dict, List, Union
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class CalibrationStatisticsInner(BaseModel):
|
||||
"""
|
||||
CalibrationStatisticsInner
|
||||
""" # noqa: E501
|
||||
module_number: StrictInt
|
||||
storage_cell_number: StrictInt
|
||||
pedestal_g0_mean: Union[StrictFloat, StrictInt]
|
||||
pedestal_g1_mean: Union[StrictFloat, StrictInt]
|
||||
pedestal_g2_mean: Union[StrictFloat, StrictInt]
|
||||
gain_g0_mean: Union[StrictFloat, StrictInt]
|
||||
gain_g1_mean: Union[StrictFloat, StrictInt]
|
||||
gain_g2_mean: Union[StrictFloat, StrictInt]
|
||||
masked_pixels: StrictInt
|
||||
__properties: ClassVar[List[str]] = ["module_number", "storage_cell_number", "pedestal_g0_mean", "pedestal_g1_mean", "pedestal_g2_mean", "gain_g0_mean", "gain_g1_mean", "gain_g2_mean", "masked_pixels"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of CalibrationStatisticsInner from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of CalibrationStatisticsInner from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"module_number": obj.get("module_number"),
|
||||
"storage_cell_number": obj.get("storage_cell_number"),
|
||||
"pedestal_g0_mean": obj.get("pedestal_g0_mean"),
|
||||
"pedestal_g1_mean": obj.get("pedestal_g1_mean"),
|
||||
"pedestal_g2_mean": obj.get("pedestal_g2_mean"),
|
||||
"gain_g0_mean": obj.get("gain_g0_mean"),
|
||||
"gain_g1_mean": obj.get("gain_g1_mean"),
|
||||
"gain_g2_mean": obj.get("gain_g2_mean"),
|
||||
"masked_pixels": obj.get("masked_pixels")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
167
python-client/openapi_client/models/dataset_settings.py
Normal file
167
python-client/openapi_client/models/dataset_settings.py
Normal file
@@ -0,0 +1,167 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Jungfraujoch
|
||||
|
||||
Jungfraujoch Broker Web API
|
||||
|
||||
The version of the OpenAPI document: 1.0.0-rc.13
|
||||
Contact: filip.leonarski@psi.ch
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator
|
||||
from typing import Any, ClassVar, Dict, List, Optional, Union
|
||||
from typing_extensions import Annotated
|
||||
from openapi_client.models.dataset_settings_unit_cell import DatasetSettingsUnitCell
|
||||
from openapi_client.models.rotation_axis import RotationAxis
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class DatasetSettings(BaseModel):
|
||||
"""
|
||||
DatasetSettings
|
||||
""" # noqa: E501
|
||||
images_per_trigger: Optional[Annotated[int, Field(strict=True, ge=1)]] = Field(default=1, description="For standard synchrotron data collection - this is number of images collected per one TTL trigger For XFEL (pulsed source) - this number is ignored and set to 1 For storage cell mode - this number is ignored and set to number of storage cells ")
|
||||
ntrigger: Optional[Annotated[int, Field(strict=True, ge=1)]] = Field(default=1, description="Number of TTL trigger that the detector is expected to receive during data collection ")
|
||||
image_time_us: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=None, description="Image time. If not provided (or zero value) the frame time is assumed as default. Image time must be multiple of frame time; max value is 256 * frame_time. In XFEL mode: summation happens for frames collected with multiple triggers. Ignored for storage cells and if raw data are saved. ")
|
||||
beam_x_pxl: Union[StrictFloat, StrictInt] = Field(description="/entry/detector/beam_center_x in NXmx Beam center in X direction [pixels] ")
|
||||
beam_y_pxl: Union[StrictFloat, StrictInt] = Field(description="/entry/detector/beam_center_y in NXmx Beam center in X direction [pixels] ")
|
||||
detector_distance_mm: Union[Annotated[float, Field(strict=True, ge=0)], Annotated[int, Field(strict=True, ge=0)]] = Field(description="/entry/detector/distance in NXmx Detector distance [mm]")
|
||||
incident_energy_ke_v: Union[Annotated[float, Field(le=500.0, strict=True, ge=0.001)], Annotated[int, Field(le=500, strict=True, ge=1)]] = Field(description="Used to calculate /entry/beam/incident_wavelength in NXmx Incident particle (photon, electron) energy in keV ", alias="incident_energy_keV")
|
||||
file_prefix: Optional[StrictStr] = Field(default='', description="Prefix for filenames. If left empty, no file will be saved.")
|
||||
images_per_file: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=1000, description="Number of files in a single HDF5 data file (0 = write all images to a single data file).")
|
||||
space_group_number: Optional[Annotated[int, Field(le=194, strict=True, ge=0)]] = 0
|
||||
sample_name: Optional[StrictStr] = Field(default='', description="/entry/sample/name in NXmx Sample name ")
|
||||
compression: Optional[StrictStr] = 'bslz4'
|
||||
total_flux: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="/entry/beam/total_flux in NXmx Flux incident on beam plane in photons per second. In other words this is the flux integrated over area. [photons/s] ")
|
||||
transmission: Optional[Union[Annotated[float, Field(le=1.0, strict=True, ge=0.0)], Annotated[int, Field(le=1, strict=True, ge=0)]]] = Field(default=None, description="/entry/instrument/attenuator/attenuator_transmission Transmission of attenuator (filter) [no units] ")
|
||||
goniometer: Optional[RotationAxis] = None
|
||||
header_appendix: Optional[Any] = Field(default=None, description="Header appendix, added as user_data/user to start message (can be any valid JSON)")
|
||||
image_appendix: Optional[Any] = Field(default=None, description="Image appendix, added as user_data to image message (can be any valid JSON)")
|
||||
data_reduction_factor_serialmx: Optional[Union[Annotated[float, Field(le=1.0, strict=True, ge=0.0)], Annotated[int, Field(le=1, strict=True, ge=0)]]] = Field(default=1.0, description="Rate at which non-indexed images are accepted to be forwarded to writer. Value of 1.0 (default) means that all images are written. Values below zero mean that non-indexed images will be accepted with a given probability. ")
|
||||
pixel_value_low_threshold: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=None, description="Set all counts lower than the value to zero. When the value is set, negative numbers other than error pixel value are always set to zero. Setting to zero is equivalent to turning the option off. ")
|
||||
run_number: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=None, description="Number of run within an experimental session. Transferred over CBOR stream as \"series ID\", though not saved in HDF5 file. It is highly recommended to keep this number unique for each data collection during experimental series. If not provided, the number will be automatically incremented. ")
|
||||
run_name: Optional[StrictStr] = Field(default=None, description="Unique ID of run. Transferred over CBOR stream as \"unique series ID\", though not saved in HDF5 file. It is highly recommended to keep this name unique for each data collection during experimental series. If not provided, the name will be automatically generated as number + colon + file_prefix. ")
|
||||
experiment_group: Optional[StrictStr] = Field(default=None, description="Name of group owning the data (e.g. p-group or proposal number). Transferred over CBOR stream, though not saved in HDF5 file. ")
|
||||
poisson_compression: Optional[Annotated[int, Field(le=16, strict=True, ge=0)]] = Field(default=None, description="Enable lossy compression of pixel values that preserves Poisson statistics. Requires to provide a numerical factor SQ. Pixel value P will be transformed to round(sqrt(P) * SQ), with rounding to the closest integer. Compression is turned off if the value is missing or it is set to zero. ")
|
||||
write_nxmx_hdf5_master: Optional[StrictBool] = Field(default=True, description="Write NXmx formatted HDF5 master file. Recommended to use for macromolecular crystallography experiments and to turn off for other experiments. ")
|
||||
save_calibration: Optional[StrictBool] = Field(default=None, description="Forward image calibration (at the moment pedestal and pedestal RMS for JUNGFRAU) using the ZeroMQ stream to writer. If parameter is not provided calibration will be saved only if more than 4 images are recorded. ")
|
||||
unit_cell: Optional[DatasetSettingsUnitCell] = None
|
||||
__properties: ClassVar[List[str]] = ["images_per_trigger", "ntrigger", "image_time_us", "beam_x_pxl", "beam_y_pxl", "detector_distance_mm", "incident_energy_keV", "file_prefix", "images_per_file", "space_group_number", "sample_name", "compression", "total_flux", "transmission", "goniometer", "header_appendix", "image_appendix", "data_reduction_factor_serialmx", "pixel_value_low_threshold", "run_number", "run_name", "experiment_group", "poisson_compression", "write_nxmx_hdf5_master", "save_calibration", "unit_cell"]
|
||||
|
||||
@field_validator('compression')
|
||||
def compression_validate_enum(cls, value):
|
||||
"""Validates the enum"""
|
||||
if value is None:
|
||||
return value
|
||||
|
||||
if value not in set(['bslz4', 'bszstd', 'bszstd_rle', 'none']):
|
||||
raise ValueError("must be one of enum values ('bslz4', 'bszstd', 'bszstd_rle', 'none')")
|
||||
return value
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of DatasetSettings from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of goniometer
|
||||
if self.goniometer:
|
||||
_dict['goniometer'] = self.goniometer.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of unit_cell
|
||||
if self.unit_cell:
|
||||
_dict['unit_cell'] = self.unit_cell.to_dict()
|
||||
# set to None if header_appendix (nullable) is None
|
||||
# and model_fields_set contains the field
|
||||
if self.header_appendix is None and "header_appendix" in self.model_fields_set:
|
||||
_dict['header_appendix'] = None
|
||||
|
||||
# set to None if image_appendix (nullable) is None
|
||||
# and model_fields_set contains the field
|
||||
if self.image_appendix is None and "image_appendix" in self.model_fields_set:
|
||||
_dict['image_appendix'] = None
|
||||
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of DatasetSettings from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"images_per_trigger": obj.get("images_per_trigger") if obj.get("images_per_trigger") is not None else 1,
|
||||
"ntrigger": obj.get("ntrigger") if obj.get("ntrigger") is not None else 1,
|
||||
"image_time_us": obj.get("image_time_us"),
|
||||
"beam_x_pxl": obj.get("beam_x_pxl"),
|
||||
"beam_y_pxl": obj.get("beam_y_pxl"),
|
||||
"detector_distance_mm": obj.get("detector_distance_mm"),
|
||||
"incident_energy_keV": obj.get("incident_energy_keV"),
|
||||
"file_prefix": obj.get("file_prefix") if obj.get("file_prefix") is not None else '',
|
||||
"images_per_file": obj.get("images_per_file") if obj.get("images_per_file") is not None else 1000,
|
||||
"space_group_number": obj.get("space_group_number") if obj.get("space_group_number") is not None else 0,
|
||||
"sample_name": obj.get("sample_name") if obj.get("sample_name") is not None else '',
|
||||
"compression": obj.get("compression") if obj.get("compression") is not None else 'bslz4',
|
||||
"total_flux": obj.get("total_flux"),
|
||||
"transmission": obj.get("transmission"),
|
||||
"goniometer": RotationAxis.from_dict(obj["goniometer"]) if obj.get("goniometer") is not None else None,
|
||||
"header_appendix": obj.get("header_appendix"),
|
||||
"image_appendix": obj.get("image_appendix"),
|
||||
"data_reduction_factor_serialmx": obj.get("data_reduction_factor_serialmx") if obj.get("data_reduction_factor_serialmx") is not None else 1.0,
|
||||
"pixel_value_low_threshold": obj.get("pixel_value_low_threshold"),
|
||||
"run_number": obj.get("run_number"),
|
||||
"run_name": obj.get("run_name"),
|
||||
"experiment_group": obj.get("experiment_group"),
|
||||
"poisson_compression": obj.get("poisson_compression"),
|
||||
"write_nxmx_hdf5_master": obj.get("write_nxmx_hdf5_master") if obj.get("write_nxmx_hdf5_master") is not None else True,
|
||||
"save_calibration": obj.get("save_calibration"),
|
||||
"unit_cell": DatasetSettingsUnitCell.from_dict(obj["unit_cell"]) if obj.get("unit_cell") is not None else None
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Jungfraujoch
|
||||
|
||||
Jungfraujoch Broker Web API
|
||||
|
||||
The version of the OpenAPI document: 1.0.0-rc.13
|
||||
Contact: filip.leonarski@psi.ch
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
from typing import Any, ClassVar, Dict, List, Union
|
||||
from typing_extensions import Annotated
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class DatasetSettingsUnitCell(BaseModel):
|
||||
"""
|
||||
Units of angstrom and degree
|
||||
""" # noqa: E501
|
||||
a: Union[Annotated[float, Field(strict=True, ge=0)], Annotated[int, Field(strict=True, ge=0)]]
|
||||
b: Union[Annotated[float, Field(strict=True, ge=0)], Annotated[int, Field(strict=True, ge=0)]]
|
||||
c: Union[Annotated[float, Field(strict=True, ge=0)], Annotated[int, Field(strict=True, ge=0)]]
|
||||
alpha: Union[Annotated[float, Field(le=360, strict=True, ge=0)], Annotated[int, Field(le=360, strict=True, ge=0)]]
|
||||
beta: Union[Annotated[float, Field(le=360, strict=True, ge=0)], Annotated[int, Field(le=360, strict=True, ge=0)]]
|
||||
gamma: Union[Annotated[float, Field(le=360, strict=True, ge=0)], Annotated[int, Field(le=360, strict=True, ge=0)]]
|
||||
__properties: ClassVar[List[str]] = ["a", "b", "c", "alpha", "beta", "gamma"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of DatasetSettingsUnitCell from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of DatasetSettingsUnitCell from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"a": obj.get("a"),
|
||||
"b": obj.get("b"),
|
||||
"c": obj.get("c"),
|
||||
"alpha": obj.get("alpha"),
|
||||
"beta": obj.get("beta"),
|
||||
"gamma": obj.get("gamma")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
128
python-client/openapi_client/models/detector.py
Normal file
128
python-client/openapi_client/models/detector.py
Normal file
@@ -0,0 +1,128 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Jungfraujoch
|
||||
|
||||
Jungfraujoch Broker Web API
|
||||
|
||||
The version of the OpenAPI document: 1.0.0-rc.13
|
||||
Contact: filip.leonarski@psi.ch
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional, Union
|
||||
from typing_extensions import Annotated
|
||||
from openapi_client.models.detector_module import DetectorModule
|
||||
from openapi_client.models.detector_type import DetectorType
|
||||
from openapi_client.models.standard_detector_geometry import StandardDetectorGeometry
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class Detector(BaseModel):
|
||||
"""
|
||||
Detector
|
||||
""" # noqa: E501
|
||||
description: Annotated[str, Field(min_length=1, strict=True)]
|
||||
serial_number: Annotated[str, Field(min_length=1, strict=True)]
|
||||
type: Optional[DetectorType] = None
|
||||
high_voltage_v: Optional[Annotated[int, Field(le=200, strict=True, ge=0)]] = Field(default=0, alias="high_voltage_V")
|
||||
udp_interface_count: Optional[Annotated[int, Field(le=2, strict=True, ge=1)]] = 1
|
||||
sensor_thickness_um: Optional[Union[Annotated[float, Field(strict=True, ge=0)], Annotated[int, Field(strict=True, ge=0)]]] = 320
|
||||
calibration_file: Optional[List[StrictStr]] = Field(default=None, description="Gain file (JUNGFRAU) or trimbit file (EIGER). One entry per module. Either empty or number of module entries. ")
|
||||
hostname: Optional[List[StrictStr]] = Field(default=None, description="Hostname for detector module. One entry per module One entry per module. Either empty or number of module entries. ")
|
||||
sensor_material: Optional[StrictStr] = 'Si'
|
||||
tx_delay: Optional[List[StrictInt]] = None
|
||||
base_data_ipv4_address: Optional[StrictStr] = None
|
||||
standard_geometry: Optional[StandardDetectorGeometry] = None
|
||||
custom_geometry: Optional[List[DetectorModule]] = None
|
||||
mirror_y: Optional[StrictBool] = Field(default=True, description="Mirror detector in Y direction to account for MX convention of (0,0) point in top left corner")
|
||||
__properties: ClassVar[List[str]] = ["description", "serial_number", "type", "high_voltage_V", "udp_interface_count", "sensor_thickness_um", "calibration_file", "hostname", "sensor_material", "tx_delay", "base_data_ipv4_address", "standard_geometry", "custom_geometry", "mirror_y"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of Detector from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of standard_geometry
|
||||
if self.standard_geometry:
|
||||
_dict['standard_geometry'] = self.standard_geometry.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in custom_geometry (list)
|
||||
_items = []
|
||||
if self.custom_geometry:
|
||||
for _item_custom_geometry in self.custom_geometry:
|
||||
if _item_custom_geometry:
|
||||
_items.append(_item_custom_geometry.to_dict())
|
||||
_dict['custom_geometry'] = _items
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of Detector from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"description": obj.get("description"),
|
||||
"serial_number": obj.get("serial_number"),
|
||||
"type": obj.get("type"),
|
||||
"high_voltage_V": obj.get("high_voltage_V") if obj.get("high_voltage_V") is not None else 0,
|
||||
"udp_interface_count": obj.get("udp_interface_count") if obj.get("udp_interface_count") is not None else 1,
|
||||
"sensor_thickness_um": obj.get("sensor_thickness_um") if obj.get("sensor_thickness_um") is not None else 320,
|
||||
"calibration_file": obj.get("calibration_file"),
|
||||
"hostname": obj.get("hostname"),
|
||||
"sensor_material": obj.get("sensor_material") if obj.get("sensor_material") is not None else 'Si',
|
||||
"tx_delay": obj.get("tx_delay"),
|
||||
"base_data_ipv4_address": obj.get("base_data_ipv4_address"),
|
||||
"standard_geometry": StandardDetectorGeometry.from_dict(obj["standard_geometry"]) if obj.get("standard_geometry") is not None else None,
|
||||
"custom_geometry": [DetectorModule.from_dict(_item) for _item in obj["custom_geometry"]] if obj.get("custom_geometry") is not None else None,
|
||||
"mirror_y": obj.get("mirror_y") if obj.get("mirror_y") is not None else True
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
98
python-client/openapi_client/models/detector_list.py
Normal file
98
python-client/openapi_client/models/detector_list.py
Normal file
@@ -0,0 +1,98 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Jungfraujoch
|
||||
|
||||
Jungfraujoch Broker Web API
|
||||
|
||||
The version of the OpenAPI document: 1.0.0-rc.13
|
||||
Contact: filip.leonarski@psi.ch
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, StrictInt
|
||||
from typing import Any, ClassVar, Dict, List
|
||||
from openapi_client.models.detector_list_detectors_inner import DetectorListDetectorsInner
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class DetectorList(BaseModel):
|
||||
"""
|
||||
DetectorList
|
||||
""" # noqa: E501
|
||||
detectors: List[DetectorListDetectorsInner]
|
||||
current_id: StrictInt
|
||||
__properties: ClassVar[List[str]] = ["detectors", "current_id"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of DetectorList from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in detectors (list)
|
||||
_items = []
|
||||
if self.detectors:
|
||||
for _item_detectors in self.detectors:
|
||||
if _item_detectors:
|
||||
_items.append(_item_detectors.to_dict())
|
||||
_dict['detectors'] = _items
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of DetectorList from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"detectors": [DetectorListDetectorsInner.from_dict(_item) for _item in obj["detectors"]] if obj.get("detectors") is not None else None,
|
||||
"current_id": obj.get("current_id")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Jungfraujoch
|
||||
|
||||
Jungfraujoch Broker Web API
|
||||
|
||||
The version of the OpenAPI document: 1.0.0-rc.13
|
||||
Contact: filip.leonarski@psi.ch
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing_extensions import Annotated
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class DetectorListDetectorsInner(BaseModel):
|
||||
"""
|
||||
DetectorListDetectorsInner
|
||||
""" # noqa: E501
|
||||
id: Annotated[int, Field(strict=True, ge=0)]
|
||||
description: StrictStr
|
||||
serial_number: StrictStr
|
||||
base_ipv4_addr: StrictStr
|
||||
udp_interface_count: Optional[StrictInt] = Field(default=None, description="Number of UDP interfaces per detector module")
|
||||
nmodules: StrictInt
|
||||
width: StrictInt
|
||||
height: StrictInt
|
||||
__properties: ClassVar[List[str]] = ["id", "description", "serial_number", "base_ipv4_addr", "udp_interface_count", "nmodules", "width", "height"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of DetectorListDetectorsInner from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of DetectorListDetectorsInner from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"id": obj.get("id"),
|
||||
"description": obj.get("description"),
|
||||
"serial_number": obj.get("serial_number"),
|
||||
"base_ipv4_addr": obj.get("base_ipv4_addr"),
|
||||
"udp_interface_count": obj.get("udp_interface_count"),
|
||||
"nmodules": obj.get("nmodules"),
|
||||
"width": obj.get("width"),
|
||||
"height": obj.get("height")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
95
python-client/openapi_client/models/detector_module.py
Normal file
95
python-client/openapi_client/models/detector_module.py
Normal file
@@ -0,0 +1,95 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Jungfraujoch
|
||||
|
||||
Jungfraujoch Broker Web API
|
||||
|
||||
The version of the OpenAPI document: 1.0.0-rc.13
|
||||
Contact: filip.leonarski@psi.ch
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt
|
||||
from typing import Any, ClassVar, Dict, List, Union
|
||||
from openapi_client.models.detector_module_direction import DetectorModuleDirection
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class DetectorModule(BaseModel):
|
||||
"""
|
||||
DetectorModule
|
||||
""" # noqa: E501
|
||||
x0: Union[StrictFloat, StrictInt]
|
||||
y0: Union[StrictFloat, StrictInt]
|
||||
fast_axis: DetectorModuleDirection
|
||||
slow_axis: DetectorModuleDirection
|
||||
__properties: ClassVar[List[str]] = ["x0", "y0", "fast_axis", "slow_axis"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of DetectorModule from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of DetectorModule from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"x0": obj.get("x0"),
|
||||
"y0": obj.get("y0"),
|
||||
"fast_axis": obj.get("fast_axis"),
|
||||
"slow_axis": obj.get("slow_axis")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Jungfraujoch
|
||||
|
||||
Jungfraujoch Broker Web API
|
||||
|
||||
The version of the OpenAPI document: 1.0.0-rc.13
|
||||
Contact: filip.leonarski@psi.ch
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import json
|
||||
from enum import Enum
|
||||
from typing_extensions import Self
|
||||
|
||||
|
||||
class DetectorModuleDirection(str, Enum):
|
||||
"""
|
||||
DetectorModuleDirection
|
||||
"""
|
||||
|
||||
"""
|
||||
allowed enum values
|
||||
"""
|
||||
XP = 'Xp'
|
||||
XN = 'Xn'
|
||||
YP = 'Yp'
|
||||
YN = 'Yn'
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Self:
|
||||
"""Create an instance of DetectorModuleDirection from a JSON string"""
|
||||
return cls(json.loads(json_str))
|
||||
|
||||
|
||||
88
python-client/openapi_client/models/detector_selection.py
Normal file
88
python-client/openapi_client/models/detector_selection.py
Normal file
@@ -0,0 +1,88 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Jungfraujoch
|
||||
|
||||
Jungfraujoch Broker Web API
|
||||
|
||||
The version of the OpenAPI document: 1.0.0-rc.13
|
||||
Contact: filip.leonarski@psi.ch
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, StrictInt
|
||||
from typing import Any, ClassVar, Dict, List
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class DetectorSelection(BaseModel):
|
||||
"""
|
||||
DetectorSelection
|
||||
""" # noqa: E501
|
||||
id: StrictInt
|
||||
__properties: ClassVar[List[str]] = ["id"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of DetectorSelection from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of DetectorSelection from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"id": obj.get("id")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
115
python-client/openapi_client/models/detector_settings.py
Normal file
115
python-client/openapi_client/models/detector_settings.py
Normal file
@@ -0,0 +1,115 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Jungfraujoch
|
||||
|
||||
Jungfraujoch Broker Web API
|
||||
|
||||
The version of the OpenAPI document: 1.0.0-rc.13
|
||||
Contact: filip.leonarski@psi.ch
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing_extensions import Annotated
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class DetectorSettings(BaseModel):
|
||||
"""
|
||||
DetectorSettings
|
||||
""" # noqa: E501
|
||||
frame_time_us: Annotated[int, Field(strict=True, ge=450)] = Field(description="Interval between consecutive frames.")
|
||||
count_time_us: Optional[StrictInt] = Field(default=None, description="Integration time of the detector. If not provided count time will be set to maximum value for a given frame time.")
|
||||
storage_cell_count: Annotated[int, Field(le=16, strict=True, ge=1)]
|
||||
internal_frame_generator: StrictBool = Field(description="Use internal frame generator in FPGA instead of getting data from a real detector")
|
||||
internal_frame_generator_images: Annotated[int, Field(le=128, strict=True, ge=1)]
|
||||
pedestal_g0_frames: Annotated[int, Field(strict=True, ge=0)]
|
||||
pedestal_g1_frames: Annotated[int, Field(strict=True, ge=0)]
|
||||
pedestal_g2_frames: Annotated[int, Field(strict=True, ge=0)]
|
||||
pedestal_g0_rms_limit: Annotated[int, Field(strict=True, ge=0)] = Field(description="Pixels with pedestal G0 RMS above the threshold are marked as masked pixels")
|
||||
pedestal_window_size: Annotated[int, Field(strict=True, ge=32)] = Field(description="Running average window size for pedestal calculations")
|
||||
storage_cell_delay_ns: Annotated[int, Field(strict=True, ge=2100)] = Field(description="Delay between two storage cells [ns]")
|
||||
detector_trigger_delay_ns: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=0, description="Delay between TTL trigger and acquisition start [ns]")
|
||||
fixed_gain_g1: Optional[StrictBool] = Field(default=False, description="Fix gain to G1 (can be useful for storage cells)")
|
||||
use_gain_hg0: Optional[StrictBool] = Field(default=False, description="Use high G0 (for low energy applications)")
|
||||
__properties: ClassVar[List[str]] = ["frame_time_us", "count_time_us", "storage_cell_count", "internal_frame_generator", "internal_frame_generator_images", "pedestal_g0_frames", "pedestal_g1_frames", "pedestal_g2_frames", "pedestal_g0_rms_limit", "pedestal_window_size", "storage_cell_delay_ns", "detector_trigger_delay_ns", "fixed_gain_g1", "use_gain_hg0"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of DetectorSettings from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of DetectorSettings from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"frame_time_us": obj.get("frame_time_us"),
|
||||
"count_time_us": obj.get("count_time_us"),
|
||||
"storage_cell_count": obj.get("storage_cell_count") if obj.get("storage_cell_count") is not None else 1,
|
||||
"internal_frame_generator": obj.get("internal_frame_generator") if obj.get("internal_frame_generator") is not None else False,
|
||||
"internal_frame_generator_images": obj.get("internal_frame_generator_images") if obj.get("internal_frame_generator_images") is not None else 1,
|
||||
"pedestal_g0_frames": obj.get("pedestal_g0_frames") if obj.get("pedestal_g0_frames") is not None else 2000,
|
||||
"pedestal_g1_frames": obj.get("pedestal_g1_frames") if obj.get("pedestal_g1_frames") is not None else 300,
|
||||
"pedestal_g2_frames": obj.get("pedestal_g2_frames") if obj.get("pedestal_g2_frames") is not None else 300,
|
||||
"pedestal_g0_rms_limit": obj.get("pedestal_g0_rms_limit") if obj.get("pedestal_g0_rms_limit") is not None else 100,
|
||||
"pedestal_window_size": obj.get("pedestal_window_size") if obj.get("pedestal_window_size") is not None else 128,
|
||||
"storage_cell_delay_ns": obj.get("storage_cell_delay_ns") if obj.get("storage_cell_delay_ns") is not None else 5000,
|
||||
"detector_trigger_delay_ns": obj.get("detector_trigger_delay_ns") if obj.get("detector_trigger_delay_ns") is not None else 0,
|
||||
"fixed_gain_g1": obj.get("fixed_gain_g1") if obj.get("fixed_gain_g1") is not None else False,
|
||||
"use_gain_hg0": obj.get("use_gain_hg0") if obj.get("use_gain_hg0") is not None else False
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
112
python-client/openapi_client/models/detector_status.py
Normal file
112
python-client/openapi_client/models/detector_status.py
Normal file
@@ -0,0 +1,112 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Jungfraujoch
|
||||
|
||||
Jungfraujoch Broker Web API
|
||||
|
||||
The version of the OpenAPI document: 1.0.0-rc.13
|
||||
Contact: filip.leonarski@psi.ch
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator
|
||||
from typing import Any, ClassVar, Dict, List
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class DetectorStatus(BaseModel):
|
||||
"""
|
||||
DetectorStatus
|
||||
""" # noqa: E501
|
||||
state: StrictStr = Field(description="Current state of the detector")
|
||||
powerchip: StrictStr = Field(description="Power on of ASICs")
|
||||
server_version: StrictStr = Field(description="Detector server (on read-out boards) version")
|
||||
number_of_triggers_left: StrictInt = Field(description="Remaining triggers to the detector (max of all modules)")
|
||||
fpga_temp_deg_c: List[StrictInt] = Field(description="Temperature of detector FPGAs", alias="fpga_temp_degC")
|
||||
high_voltage_v: List[StrictInt] = Field(description="High voltage for detector modules", alias="high_voltage_V")
|
||||
__properties: ClassVar[List[str]] = ["state", "powerchip", "server_version", "number_of_triggers_left", "fpga_temp_degC", "high_voltage_V"]
|
||||
|
||||
@field_validator('state')
|
||||
def state_validate_enum(cls, value):
|
||||
"""Validates the enum"""
|
||||
if value not in set(['Idle', 'Waiting', 'Busy', 'Error']):
|
||||
raise ValueError("must be one of enum values ('Idle', 'Waiting', 'Busy', 'Error')")
|
||||
return value
|
||||
|
||||
@field_validator('powerchip')
|
||||
def powerchip_validate_enum(cls, value):
|
||||
"""Validates the enum"""
|
||||
if value not in set(['PowerOn', 'PowerOff', 'Partial']):
|
||||
raise ValueError("must be one of enum values ('PowerOn', 'PowerOff', 'Partial')")
|
||||
return value
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of DetectorStatus from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of DetectorStatus from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"state": obj.get("state"),
|
||||
"powerchip": obj.get("powerchip"),
|
||||
"server_version": obj.get("server_version"),
|
||||
"number_of_triggers_left": obj.get("number_of_triggers_left"),
|
||||
"fpga_temp_degC": obj.get("fpga_temp_degC"),
|
||||
"high_voltage_V": obj.get("high_voltage_V")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
38
python-client/openapi_client/models/detector_type.py
Normal file
38
python-client/openapi_client/models/detector_type.py
Normal file
@@ -0,0 +1,38 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Jungfraujoch
|
||||
|
||||
Jungfraujoch Broker Web API
|
||||
|
||||
The version of the OpenAPI document: 1.0.0-rc.13
|
||||
Contact: filip.leonarski@psi.ch
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import json
|
||||
from enum import Enum
|
||||
from typing_extensions import Self
|
||||
|
||||
|
||||
class DetectorType(str, Enum):
|
||||
"""
|
||||
DetectorType
|
||||
"""
|
||||
|
||||
"""
|
||||
allowed enum values
|
||||
"""
|
||||
EIGER = 'EIGER'
|
||||
JUNGFRAU = 'JUNGFRAU'
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Self:
|
||||
"""Create an instance of DetectorType from a JSON string"""
|
||||
return cls(json.loads(json_str))
|
||||
|
||||
|
||||
97
python-client/openapi_client/models/error_message.py
Normal file
97
python-client/openapi_client/models/error_message.py
Normal file
@@ -0,0 +1,97 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Jungfraujoch
|
||||
|
||||
Jungfraujoch Broker Web API
|
||||
|
||||
The version of the OpenAPI document: 1.0.0-rc.13
|
||||
Contact: filip.leonarski@psi.ch
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
||||
from typing import Any, ClassVar, Dict, List
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class ErrorMessage(BaseModel):
|
||||
"""
|
||||
ErrorMessage
|
||||
""" # noqa: E501
|
||||
msg: StrictStr = Field(description="Human readable message")
|
||||
reason: StrictStr = Field(description="Enumerate field for automated analysis")
|
||||
__properties: ClassVar[List[str]] = ["msg", "reason"]
|
||||
|
||||
@field_validator('reason')
|
||||
def reason_validate_enum(cls, value):
|
||||
"""Validates the enum"""
|
||||
if value not in set(['WrongDAQState', 'Other']):
|
||||
raise ValueError("must be one of enum values ('WrongDAQState', 'Other')")
|
||||
return value
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of ErrorMessage from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of ErrorMessage from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"msg": obj.get("msg"),
|
||||
"reason": obj.get("reason")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
96
python-client/openapi_client/models/fpga_status_inner.py
Normal file
96
python-client/openapi_client/models/fpga_status_inner.py
Normal file
@@ -0,0 +1,96 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Jungfraujoch
|
||||
|
||||
Jungfraujoch Broker Web API
|
||||
|
||||
The version of the OpenAPI document: 1.0.0-rc.13
|
||||
Contact: filip.leonarski@psi.ch
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt
|
||||
from typing import Any, ClassVar, Dict, List, Optional, Union
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class FpgaStatusInner(BaseModel):
|
||||
"""
|
||||
FpgaStatusInner
|
||||
""" # noqa: E501
|
||||
eth_link_count: Optional[StrictInt] = None
|
||||
eth_link_status: Optional[StrictInt] = None
|
||||
power_usage_w: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="power_usage_W")
|
||||
fpga_temp_c: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="fpga_temp_C")
|
||||
hbm_temp_c: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="hbm_temp_C")
|
||||
__properties: ClassVar[List[str]] = ["eth_link_count", "eth_link_status", "power_usage_W", "fpga_temp_C", "hbm_temp_C"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of FpgaStatusInner from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of FpgaStatusInner from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"eth_link_count": obj.get("eth_link_count"),
|
||||
"eth_link_status": obj.get("eth_link_status"),
|
||||
"power_usage_W": obj.get("power_usage_W"),
|
||||
"fpga_temp_C": obj.get("fpga_temp_C"),
|
||||
"hbm_temp_C": obj.get("hbm_temp_C")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
113
python-client/openapi_client/models/image_format_settings.py
Normal file
113
python-client/openapi_client/models/image_format_settings.py
Normal file
@@ -0,0 +1,113 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Jungfraujoch
|
||||
|
||||
Jungfraujoch Broker Web API
|
||||
|
||||
The version of the OpenAPI document: 1.0.0-rc.13
|
||||
Contact: filip.leonarski@psi.ch
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, field_validator
|
||||
from typing import Any, ClassVar, Dict, List, Optional, Union
|
||||
from typing_extensions import Annotated
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class ImageFormatSettings(BaseModel):
|
||||
"""
|
||||
ImageFormatSettings
|
||||
""" # noqa: E501
|
||||
summation: StrictBool = Field(description="Enable summation of images to a given image_time If disabled images are saved according to original detector speed, but image count is adjusted ")
|
||||
geometry_transform: StrictBool = Field(description="Place module read-out into their location on composed detector and extend multipixels ")
|
||||
jungfrau_conversion: StrictBool = Field(description="Convert pixel value in ADU to photon counts/energy Only affects JUNGFRAU detector ")
|
||||
jungfrau_conversion_factor_ke_v: Optional[Union[Annotated[float, Field(le=500.0, strict=True, ge=0.001)], Annotated[int, Field(le=500, strict=True, ge=1)]]] = Field(default=None, description="Used to convert energy deposited into pixel to counts If not provided incident_energy_keV is used ", alias="jungfrau_conversion_factor_keV")
|
||||
bit_depth_image: Optional[StrictInt] = Field(default=None, description="Bit depth of resulting image (it doesn't affect the original detector value) If not provided value is adjusted automatically ")
|
||||
signed_output: Optional[StrictBool] = Field(default=None, description="Controls if pixels have signed output If not provided value is adjusted automatically ")
|
||||
mask_module_edges: StrictBool = Field(description="Mask 1 pixel on the module boundary ")
|
||||
mask_chip_edges: StrictBool = Field(description="Mask multipixels on chip boundary ")
|
||||
__properties: ClassVar[List[str]] = ["summation", "geometry_transform", "jungfrau_conversion", "jungfrau_conversion_factor_keV", "bit_depth_image", "signed_output", "mask_module_edges", "mask_chip_edges"]
|
||||
|
||||
@field_validator('bit_depth_image')
|
||||
def bit_depth_image_validate_enum(cls, value):
|
||||
"""Validates the enum"""
|
||||
if value is None:
|
||||
return value
|
||||
|
||||
if value not in set([16, 32]):
|
||||
raise ValueError("must be one of enum values (16, 32)")
|
||||
return value
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of ImageFormatSettings from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of ImageFormatSettings from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"summation": obj.get("summation"),
|
||||
"geometry_transform": obj.get("geometry_transform"),
|
||||
"jungfrau_conversion": obj.get("jungfrau_conversion"),
|
||||
"jungfrau_conversion_factor_keV": obj.get("jungfrau_conversion_factor_keV"),
|
||||
"bit_depth_image": obj.get("bit_depth_image"),
|
||||
"signed_output": obj.get("signed_output"),
|
||||
"mask_module_edges": obj.get("mask_module_edges") if obj.get("mask_module_edges") is not None else True,
|
||||
"mask_chip_edges": obj.get("mask_chip_edges") if obj.get("mask_chip_edges") is not None else True
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
40
python-client/openapi_client/models/image_pusher_type.py
Normal file
40
python-client/openapi_client/models/image_pusher_type.py
Normal file
@@ -0,0 +1,40 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Jungfraujoch
|
||||
|
||||
Jungfraujoch Broker Web API
|
||||
|
||||
The version of the OpenAPI document: 1.0.0-rc.13
|
||||
Contact: filip.leonarski@psi.ch
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import json
|
||||
from enum import Enum
|
||||
from typing_extensions import Self
|
||||
|
||||
|
||||
class ImagePusherType(str, Enum):
|
||||
"""
|
||||
ImagePusherType
|
||||
"""
|
||||
|
||||
"""
|
||||
allowed enum values
|
||||
"""
|
||||
ZEROMQ = 'ZeroMQ'
|
||||
HDF5 = 'HDF5'
|
||||
CBOR = 'CBOR'
|
||||
NONE = 'None'
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Self:
|
||||
"""Create an instance of ImagePusherType from a JSON string"""
|
||||
return cls(json.loads(json_str))
|
||||
|
||||
|
||||
94
python-client/openapi_client/models/instrument_metadata.py
Normal file
94
python-client/openapi_client/models/instrument_metadata.py
Normal file
@@ -0,0 +1,94 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Jungfraujoch
|
||||
|
||||
Jungfraujoch Broker Web API
|
||||
|
||||
The version of the OpenAPI document: 1.0.0-rc.13
|
||||
Contact: filip.leonarski@psi.ch
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class InstrumentMetadata(BaseModel):
|
||||
"""
|
||||
Metadata for a measurement instrument
|
||||
""" # noqa: E501
|
||||
source_name: StrictStr
|
||||
source_type: Optional[StrictStr] = Field(default='', description="Type of radiation source. NXmx gives a fixed dictionary, though Jungfraujoch is not enforcing compliance. https://manual.nexusformat.org/classes/base_classes/NXsource.html#nxsource NXsource allows the following: Spallation Neutron Source Pulsed Reactor Neutron Source Reactor Neutron Source Synchrotron X-ray Source Pulsed Muon Source Rotating Anode X-ray Fixed Tube X-ray UV Laser Free-Electron Laser Optical Laser Ion Source UV Plasma Source Metal Jet X-ray ")
|
||||
instrument_name: StrictStr
|
||||
pulsed_source: Optional[StrictBool] = Field(default=False, description="Settings specific to XFEL (e.g., every image has to come from TTL trigger, save pulse ID and event code)")
|
||||
__properties: ClassVar[List[str]] = ["source_name", "source_type", "instrument_name", "pulsed_source"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of InstrumentMetadata from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of InstrumentMetadata from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"source_name": obj.get("source_name"),
|
||||
"source_type": obj.get("source_type") if obj.get("source_type") is not None else '',
|
||||
"instrument_name": obj.get("instrument_name"),
|
||||
"pulsed_source": obj.get("pulsed_source") if obj.get("pulsed_source") is not None else False
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
148
python-client/openapi_client/models/jfjoch_settings.py
Normal file
148
python-client/openapi_client/models/jfjoch_settings.py
Normal file
@@ -0,0 +1,148 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Jungfraujoch
|
||||
|
||||
Jungfraujoch Broker Web API
|
||||
|
||||
The version of the OpenAPI document: 1.0.0-rc.13
|
||||
Contact: filip.leonarski@psi.ch
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing_extensions import Annotated
|
||||
from openapi_client.models.azim_int_settings import AzimIntSettings
|
||||
from openapi_client.models.detector import Detector
|
||||
from openapi_client.models.detector_settings import DetectorSettings
|
||||
from openapi_client.models.image_format_settings import ImageFormatSettings
|
||||
from openapi_client.models.image_pusher_type import ImagePusherType
|
||||
from openapi_client.models.instrument_metadata import InstrumentMetadata
|
||||
from openapi_client.models.pcie_devices_inner import PcieDevicesInner
|
||||
from openapi_client.models.zeromq_settings import ZeromqSettings
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class JfjochSettings(BaseModel):
|
||||
"""
|
||||
Default settings for Jungfraujoch software. This structure is used to provide default settings using configuration JSON file and is not used in HTTP.
|
||||
""" # noqa: E501
|
||||
pcie: Optional[List[PcieDevicesInner]] = None
|
||||
zeromq: Optional[ZeromqSettings] = None
|
||||
instrument: Optional[InstrumentMetadata] = None
|
||||
detector: List[Detector]
|
||||
detector_settings: Optional[DetectorSettings] = None
|
||||
azim_int: Optional[AzimIntSettings] = None
|
||||
image_format: Optional[ImageFormatSettings] = None
|
||||
image_buffer_mi_b: Optional[Annotated[int, Field(le=16384, strict=True, ge=128)]] = Field(default=2048, description="Size of internal buffer in MiB for images before they are sent to a stream", alias="image_buffer_MiB")
|
||||
receiver_threads: Optional[Annotated[int, Field(le=512, strict=True, ge=1)]] = Field(default=64, description="Number of threads used by the receiver")
|
||||
numa_policy: Optional[StrictStr] = Field(default=None, description="NUMA policy to bind CPUs")
|
||||
frontend_directory: StrictStr = Field(description="Location of built JavaScript web frontend")
|
||||
image_pusher: ImagePusherType
|
||||
__properties: ClassVar[List[str]] = ["pcie", "zeromq", "instrument", "detector", "detector_settings", "azim_int", "image_format", "image_buffer_MiB", "receiver_threads", "numa_policy", "frontend_directory", "image_pusher"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of JfjochSettings from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in pcie (list)
|
||||
_items = []
|
||||
if self.pcie:
|
||||
for _item_pcie in self.pcie:
|
||||
if _item_pcie:
|
||||
_items.append(_item_pcie.to_dict())
|
||||
_dict['pcie'] = _items
|
||||
# override the default output from pydantic by calling `to_dict()` of zeromq
|
||||
if self.zeromq:
|
||||
_dict['zeromq'] = self.zeromq.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of instrument
|
||||
if self.instrument:
|
||||
_dict['instrument'] = self.instrument.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in detector (list)
|
||||
_items = []
|
||||
if self.detector:
|
||||
for _item_detector in self.detector:
|
||||
if _item_detector:
|
||||
_items.append(_item_detector.to_dict())
|
||||
_dict['detector'] = _items
|
||||
# override the default output from pydantic by calling `to_dict()` of detector_settings
|
||||
if self.detector_settings:
|
||||
_dict['detector_settings'] = self.detector_settings.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of azim_int
|
||||
if self.azim_int:
|
||||
_dict['azim_int'] = self.azim_int.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of image_format
|
||||
if self.image_format:
|
||||
_dict['image_format'] = self.image_format.to_dict()
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of JfjochSettings from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"pcie": [PcieDevicesInner.from_dict(_item) for _item in obj["pcie"]] if obj.get("pcie") is not None else None,
|
||||
"zeromq": ZeromqSettings.from_dict(obj["zeromq"]) if obj.get("zeromq") is not None else None,
|
||||
"instrument": InstrumentMetadata.from_dict(obj["instrument"]) if obj.get("instrument") is not None else None,
|
||||
"detector": [Detector.from_dict(_item) for _item in obj["detector"]] if obj.get("detector") is not None else None,
|
||||
"detector_settings": DetectorSettings.from_dict(obj["detector_settings"]) if obj.get("detector_settings") is not None else None,
|
||||
"azim_int": AzimIntSettings.from_dict(obj["azim_int"]) if obj.get("azim_int") is not None else None,
|
||||
"image_format": ImageFormatSettings.from_dict(obj["image_format"]) if obj.get("image_format") is not None else None,
|
||||
"image_buffer_MiB": obj.get("image_buffer_MiB") if obj.get("image_buffer_MiB") is not None else 2048,
|
||||
"receiver_threads": obj.get("receiver_threads") if obj.get("receiver_threads") is not None else 64,
|
||||
"numa_policy": obj.get("numa_policy"),
|
||||
"frontend_directory": obj.get("frontend_directory"),
|
||||
"image_pusher": obj.get("image_pusher") if obj.get("image_pusher") is not None else ImagePusherType.NONE
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
133
python-client/openapi_client/models/measurement_statistics.py
Normal file
133
python-client/openapi_client/models/measurement_statistics.py
Normal file
@@ -0,0 +1,133 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Jungfraujoch
|
||||
|
||||
Jungfraujoch Broker Web API
|
||||
|
||||
The version of the OpenAPI document: 1.0.0-rc.13
|
||||
Contact: filip.leonarski@psi.ch
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator
|
||||
from typing import Any, ClassVar, Dict, List, Optional, Union
|
||||
from typing_extensions import Annotated
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class MeasurementStatistics(BaseModel):
|
||||
"""
|
||||
MeasurementStatistics
|
||||
""" # noqa: E501
|
||||
file_prefix: Optional[StrictStr] = None
|
||||
run_number: Optional[StrictInt] = Field(default=None, description="Number of data collection run. This can be either automatically incremented or provided externally for each data collection. ")
|
||||
experiment_group: Optional[StrictStr] = Field(default=None, description="Name of group owning the data (e.g. p-group or proposal number). ")
|
||||
images_expected: Optional[StrictInt] = None
|
||||
images_collected: Optional[StrictInt] = Field(default=None, description="Images collected by the receiver. This number will be lower than images expected if there were issues with data collection performance. ")
|
||||
images_sent: Optional[StrictInt] = Field(default=None, description="Images sent to the writer. The value does not include images discarded by lossy compression filter and images not forwarded due to full ZeroMQ queue. ")
|
||||
images_discarded_lossy_compression: Optional[StrictInt] = Field(default=None, description="Images discarded by the lossy compression filter")
|
||||
max_image_number_sent: Optional[StrictInt] = None
|
||||
collection_efficiency: Optional[Union[Annotated[float, Field(le=1.0, strict=True, ge=0.0)], Annotated[int, Field(le=1, strict=True, ge=0)]]] = None
|
||||
compression_ratio: Optional[Union[Annotated[float, Field(strict=True, ge=0.0)], Annotated[int, Field(strict=True, ge=0)]]] = None
|
||||
cancelled: Optional[StrictBool] = None
|
||||
max_receiver_delay: Optional[StrictInt] = None
|
||||
indexing_rate: Optional[Union[StrictFloat, StrictInt]] = None
|
||||
detector_width: Optional[StrictInt] = None
|
||||
detector_height: Optional[StrictInt] = None
|
||||
detector_pixel_depth: Optional[StrictInt] = None
|
||||
bkg_estimate: Optional[Union[StrictFloat, StrictInt]] = None
|
||||
unit_cell: Optional[StrictStr] = None
|
||||
__properties: ClassVar[List[str]] = ["file_prefix", "run_number", "experiment_group", "images_expected", "images_collected", "images_sent", "images_discarded_lossy_compression", "max_image_number_sent", "collection_efficiency", "compression_ratio", "cancelled", "max_receiver_delay", "indexing_rate", "detector_width", "detector_height", "detector_pixel_depth", "bkg_estimate", "unit_cell"]
|
||||
|
||||
@field_validator('detector_pixel_depth')
|
||||
def detector_pixel_depth_validate_enum(cls, value):
|
||||
"""Validates the enum"""
|
||||
if value is None:
|
||||
return value
|
||||
|
||||
if value not in set([2, 4]):
|
||||
raise ValueError("must be one of enum values (2, 4)")
|
||||
return value
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of MeasurementStatistics from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of MeasurementStatistics from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"file_prefix": obj.get("file_prefix"),
|
||||
"run_number": obj.get("run_number"),
|
||||
"experiment_group": obj.get("experiment_group"),
|
||||
"images_expected": obj.get("images_expected"),
|
||||
"images_collected": obj.get("images_collected"),
|
||||
"images_sent": obj.get("images_sent"),
|
||||
"images_discarded_lossy_compression": obj.get("images_discarded_lossy_compression"),
|
||||
"max_image_number_sent": obj.get("max_image_number_sent"),
|
||||
"collection_efficiency": obj.get("collection_efficiency"),
|
||||
"compression_ratio": obj.get("compression_ratio"),
|
||||
"cancelled": obj.get("cancelled"),
|
||||
"max_receiver_delay": obj.get("max_receiver_delay"),
|
||||
"indexing_rate": obj.get("indexing_rate"),
|
||||
"detector_width": obj.get("detector_width"),
|
||||
"detector_height": obj.get("detector_height"),
|
||||
"detector_pixel_depth": obj.get("detector_pixel_depth"),
|
||||
"bkg_estimate": obj.get("bkg_estimate"),
|
||||
"unit_cell": obj.get("unit_cell")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
90
python-client/openapi_client/models/pcie_devices_inner.py
Normal file
90
python-client/openapi_client/models/pcie_devices_inner.py
Normal file
@@ -0,0 +1,90 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Jungfraujoch
|
||||
|
||||
Jungfraujoch Broker Web API
|
||||
|
||||
The version of the OpenAPI document: 1.0.0-rc.13
|
||||
Contact: filip.leonarski@psi.ch
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class PcieDevicesInner(BaseModel):
|
||||
"""
|
||||
PcieDevicesInner
|
||||
""" # noqa: E501
|
||||
blk: Optional[StrictStr] = Field(default=None, description="Block device name")
|
||||
ipv4: Optional[StrictStr] = Field(default=None, description="IPv4 address of the block device")
|
||||
__properties: ClassVar[List[str]] = ["blk", "ipv4"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of PcieDevicesInner from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of PcieDevicesInner from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"blk": obj.get("blk"),
|
||||
"ipv4": obj.get("ipv4")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
92
python-client/openapi_client/models/plot.py
Normal file
92
python-client/openapi_client/models/plot.py
Normal file
@@ -0,0 +1,92 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Jungfraujoch
|
||||
|
||||
Jungfraujoch Broker Web API
|
||||
|
||||
The version of the OpenAPI document: 1.0.0-rc.13
|
||||
Contact: filip.leonarski@psi.ch
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Union
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class Plot(BaseModel):
|
||||
"""
|
||||
x and y coordinates for plotting, it is OK to assume that both arrays have the same size; layout is optimized for Plotly
|
||||
""" # noqa: E501
|
||||
title: StrictStr
|
||||
x: List[Union[StrictFloat, StrictInt]]
|
||||
y: List[Union[StrictFloat, StrictInt]]
|
||||
__properties: ClassVar[List[str]] = ["title", "x", "y"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of Plot from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of Plot from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"title": obj.get("title") if obj.get("title") is not None else '',
|
||||
"x": obj.get("x"),
|
||||
"y": obj.get("y")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
98
python-client/openapi_client/models/plots.py
Normal file
98
python-client/openapi_client/models/plots.py
Normal file
@@ -0,0 +1,98 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Jungfraujoch
|
||||
|
||||
Jungfraujoch Broker Web API
|
||||
|
||||
The version of the OpenAPI document: 1.0.0-rc.13
|
||||
Contact: filip.leonarski@psi.ch
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from openapi_client.models.plot import Plot
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class Plots(BaseModel):
|
||||
"""
|
||||
Plots
|
||||
""" # noqa: E501
|
||||
title: Optional[StrictStr] = None
|
||||
plot: List[Plot]
|
||||
__properties: ClassVar[List[str]] = ["title", "plot"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of Plots from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in plot (list)
|
||||
_items = []
|
||||
if self.plot:
|
||||
for _item_plot in self.plot:
|
||||
if _item_plot:
|
||||
_items.append(_item_plot.to_dict())
|
||||
_dict['plot'] = _items
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of Plots from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"title": obj.get("title"),
|
||||
"plot": [Plot.from_dict(_item) for _item in obj["plot"]] if obj.get("plot") is not None else None
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
101
python-client/openapi_client/models/preview_settings.py
Normal file
101
python-client/openapi_client/models/preview_settings.py
Normal file
@@ -0,0 +1,101 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Jungfraujoch
|
||||
|
||||
Jungfraujoch Broker Web API
|
||||
|
||||
The version of the OpenAPI document: 1.0.0-rc.13
|
||||
Contact: filip.leonarski@psi.ch
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictBool
|
||||
from typing import Any, ClassVar, Dict, List, Optional, Union
|
||||
from typing_extensions import Annotated
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class PreviewSettings(BaseModel):
|
||||
"""
|
||||
Settings for JPEG rendering of preview images
|
||||
""" # noqa: E501
|
||||
saturation: Annotated[int, Field(le=65535, strict=True, ge=0)] = Field(description="Saturation value to set contrast in the preview image")
|
||||
show_spots: Optional[StrictBool] = Field(default=True, description="Show spot finding results on the image")
|
||||
show_roi: Optional[StrictBool] = Field(default=False, description="Show ROI areas on the image")
|
||||
jpeg_quality: Optional[Annotated[int, Field(le=100, strict=True, ge=0)]] = Field(default=100, description="Quality of JPEG image (100 - highest; 0 - lowest)")
|
||||
show_indexed: Optional[StrictBool] = Field(default=False, description="Preview indexed images only")
|
||||
show_user_mask: Optional[StrictBool] = Field(default=False, description="Show user mask")
|
||||
resolution_ring: Optional[Union[Annotated[float, Field(le=100.0, strict=True, ge=0.1)], Annotated[int, Field(le=100, strict=True, ge=1)]]] = 0.1
|
||||
__properties: ClassVar[List[str]] = ["saturation", "show_spots", "show_roi", "jpeg_quality", "show_indexed", "show_user_mask", "resolution_ring"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of PreviewSettings from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of PreviewSettings from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"saturation": obj.get("saturation"),
|
||||
"show_spots": obj.get("show_spots") if obj.get("show_spots") is not None else True,
|
||||
"show_roi": obj.get("show_roi") if obj.get("show_roi") is not None else False,
|
||||
"jpeg_quality": obj.get("jpeg_quality") if obj.get("jpeg_quality") is not None else 100,
|
||||
"show_indexed": obj.get("show_indexed") if obj.get("show_indexed") is not None else False,
|
||||
"show_user_mask": obj.get("show_user_mask") if obj.get("show_user_mask") is not None else False,
|
||||
"resolution_ring": obj.get("resolution_ring") if obj.get("resolution_ring") is not None else 0.1
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
97
python-client/openapi_client/models/roi_box.py
Normal file
97
python-client/openapi_client/models/roi_box.py
Normal file
@@ -0,0 +1,97 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Jungfraujoch
|
||||
|
||||
Jungfraujoch Broker Web API
|
||||
|
||||
The version of the OpenAPI document: 1.0.0-rc.13
|
||||
Contact: filip.leonarski@psi.ch
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
from typing import Any, ClassVar, Dict, List
|
||||
from typing_extensions import Annotated
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class RoiBox(BaseModel):
|
||||
"""
|
||||
Box ROI
|
||||
""" # noqa: E501
|
||||
name: Annotated[str, Field(min_length=1, strict=True)] = Field(description="Name for the ROI; used in the plots")
|
||||
min_x_pxl: Annotated[int, Field(strict=True, ge=0)] = Field(description="Lower bound (inclusive) in X coordinate for the box")
|
||||
max_x_pxl: Annotated[int, Field(strict=True, ge=0)] = Field(description="Upper bound (inclusive) in X coordinate for the box")
|
||||
min_y_pxl: Annotated[int, Field(strict=True, ge=0)] = Field(description="Lower bound (inclusive) in Y coordinate for the box")
|
||||
max_y_pxl: Annotated[int, Field(strict=True, ge=0)] = Field(description="Upper bound (inclusive) in Y coordinate for the box")
|
||||
__properties: ClassVar[List[str]] = ["name", "min_x_pxl", "max_x_pxl", "min_y_pxl", "max_y_pxl"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of RoiBox from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of RoiBox from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"name": obj.get("name"),
|
||||
"min_x_pxl": obj.get("min_x_pxl"),
|
||||
"max_x_pxl": obj.get("max_x_pxl"),
|
||||
"min_y_pxl": obj.get("min_y_pxl"),
|
||||
"max_y_pxl": obj.get("max_y_pxl")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
97
python-client/openapi_client/models/roi_box_list.py
Normal file
97
python-client/openapi_client/models/roi_box_list.py
Normal file
@@ -0,0 +1,97 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Jungfraujoch
|
||||
|
||||
Jungfraujoch Broker Web API
|
||||
|
||||
The version of the OpenAPI document: 1.0.0-rc.13
|
||||
Contact: filip.leonarski@psi.ch
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing_extensions import Annotated
|
||||
from openapi_client.models.roi_box import RoiBox
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class RoiBoxList(BaseModel):
|
||||
"""
|
||||
List of box ROIs
|
||||
""" # noqa: E501
|
||||
rois: Optional[Annotated[List[RoiBox], Field(max_length=32)]] = None
|
||||
__properties: ClassVar[List[str]] = ["rois"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of RoiBoxList from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in rois (list)
|
||||
_items = []
|
||||
if self.rois:
|
||||
for _item_rois in self.rois:
|
||||
if _item_rois:
|
||||
_items.append(_item_rois.to_dict())
|
||||
_dict['rois'] = _items
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of RoiBoxList from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"rois": [RoiBox.from_dict(_item) for _item in obj["rois"]] if obj.get("rois") is not None else None
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
95
python-client/openapi_client/models/roi_circle.py
Normal file
95
python-client/openapi_client/models/roi_circle.py
Normal file
@@ -0,0 +1,95 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Jungfraujoch
|
||||
|
||||
Jungfraujoch Broker Web API
|
||||
|
||||
The version of the OpenAPI document: 1.0.0-rc.13
|
||||
Contact: filip.leonarski@psi.ch
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt
|
||||
from typing import Any, ClassVar, Dict, List, Union
|
||||
from typing_extensions import Annotated
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class RoiCircle(BaseModel):
|
||||
"""
|
||||
Circular ROI
|
||||
""" # noqa: E501
|
||||
name: Annotated[str, Field(min_length=1, strict=True)] = Field(description="Name for the ROI; used in the plots")
|
||||
center_x_pxl: Union[StrictFloat, StrictInt] = Field(description="X coordinate of center of the circle [pixels]")
|
||||
center_y_pxl: Union[StrictFloat, StrictInt] = Field(description="Y coordinate of center of the circle [pixels]")
|
||||
radius_pxl: Union[Annotated[float, Field(strict=True, gt=0.0)], Annotated[int, Field(strict=True, gt=0)]] = Field(description="Radius of the circle [pixels]")
|
||||
__properties: ClassVar[List[str]] = ["name", "center_x_pxl", "center_y_pxl", "radius_pxl"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of RoiCircle from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of RoiCircle from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"name": obj.get("name"),
|
||||
"center_x_pxl": obj.get("center_x_pxl"),
|
||||
"center_y_pxl": obj.get("center_y_pxl"),
|
||||
"radius_pxl": obj.get("radius_pxl")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
97
python-client/openapi_client/models/roi_circle_list.py
Normal file
97
python-client/openapi_client/models/roi_circle_list.py
Normal file
@@ -0,0 +1,97 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Jungfraujoch
|
||||
|
||||
Jungfraujoch Broker Web API
|
||||
|
||||
The version of the OpenAPI document: 1.0.0-rc.13
|
||||
Contact: filip.leonarski@psi.ch
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
from typing import Any, ClassVar, Dict, List
|
||||
from typing_extensions import Annotated
|
||||
from openapi_client.models.roi_circle import RoiCircle
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class RoiCircleList(BaseModel):
|
||||
"""
|
||||
List of circular ROIs
|
||||
""" # noqa: E501
|
||||
rois: Annotated[List[RoiCircle], Field(max_length=32)]
|
||||
__properties: ClassVar[List[str]] = ["rois"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of RoiCircleList from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in rois (list)
|
||||
_items = []
|
||||
if self.rois:
|
||||
for _item_rois in self.rois:
|
||||
if _item_rois:
|
||||
_items.append(_item_rois.to_dict())
|
||||
_dict['rois'] = _items
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of RoiCircleList from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"rois": [RoiCircle.from_dict(_item) for _item in obj["rois"]] if obj.get("rois") is not None else None
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
95
python-client/openapi_client/models/rotation_axis.py
Normal file
95
python-client/openapi_client/models/rotation_axis.py
Normal file
@@ -0,0 +1,95 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Jungfraujoch
|
||||
|
||||
Jungfraujoch Broker Web API
|
||||
|
||||
The version of the OpenAPI document: 1.0.0-rc.13
|
||||
Contact: filip.leonarski@psi.ch
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt
|
||||
from typing import Any, ClassVar, Dict, List, Optional, Union
|
||||
from typing_extensions import Annotated
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class RotationAxis(BaseModel):
|
||||
"""
|
||||
Definition of a crystal rotation axis
|
||||
""" # noqa: E501
|
||||
name: Optional[Annotated[str, Field(min_length=1, strict=True)]] = Field(default='omega', description="Name of rotation axis (e.g., omega, phi)")
|
||||
step: Union[StrictFloat, StrictInt] = Field(description="Angle step in degrees")
|
||||
start: Optional[Union[StrictFloat, StrictInt]] = Field(default=0, description="Start angle in degrees")
|
||||
vector: Annotated[List[Union[StrictFloat, StrictInt]], Field(min_length=3, max_length=3)] = Field(description="Rotation axis")
|
||||
__properties: ClassVar[List[str]] = ["name", "step", "start", "vector"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of RotationAxis from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of RotationAxis from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"name": obj.get("name") if obj.get("name") is not None else 'omega',
|
||||
"step": obj.get("step"),
|
||||
"start": obj.get("start") if obj.get("start") is not None else 0,
|
||||
"vector": obj.get("vector")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
109
python-client/openapi_client/models/spot_finding_settings.py
Normal file
109
python-client/openapi_client/models/spot_finding_settings.py
Normal file
@@ -0,0 +1,109 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Jungfraujoch
|
||||
|
||||
Jungfraujoch Broker Web API
|
||||
|
||||
The version of the OpenAPI document: 1.0.0-rc.13
|
||||
Contact: filip.leonarski@psi.ch
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt
|
||||
from typing import Any, ClassVar, Dict, List, Optional, Union
|
||||
from typing_extensions import Annotated
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class SpotFindingSettings(BaseModel):
|
||||
"""
|
||||
SpotFindingSettings
|
||||
""" # noqa: E501
|
||||
enable: StrictBool = Field(description="Enable spot finding. This is temporary setting, i.e. can be changed anytime during data collection. Even if disabled spot finding information will still be send and written, though always with zero spots. ")
|
||||
indexing: StrictBool = Field(description="Enable indexing. This is temporary setting, i.e. can be changed anytime during data collection. ")
|
||||
filter_powder_rings: Optional[StrictBool] = Field(default=False, description="Filter spots which form powder rings (e.g., ice rings)")
|
||||
min_spot_count_powder_ring: Optional[Annotated[int, Field(strict=True, ge=5)]] = Field(default=None, description="Minimum number of spots to consider a thin resolution shell (0.01 A^-1) a powder ring and filter out.")
|
||||
signal_to_noise_threshold: Union[Annotated[float, Field(strict=True, ge=0)], Annotated[int, Field(strict=True, ge=0)]]
|
||||
photon_count_threshold: Annotated[int, Field(strict=True, ge=0)]
|
||||
min_pix_per_spot: Annotated[int, Field(strict=True, ge=1)]
|
||||
max_pix_per_spot: Annotated[int, Field(strict=True, ge=1)]
|
||||
high_resolution_limit: Union[StrictFloat, StrictInt]
|
||||
low_resolution_limit: Union[StrictFloat, StrictInt]
|
||||
indexing_tolerance: Union[Annotated[float, Field(le=1.0, strict=True, ge=0.0)], Annotated[int, Field(le=1, strict=True, ge=0)]] = Field(description="Acceptance tolerance for spots after the indexing run - the larger the number, the more spots will be accepted")
|
||||
__properties: ClassVar[List[str]] = ["enable", "indexing", "filter_powder_rings", "min_spot_count_powder_ring", "signal_to_noise_threshold", "photon_count_threshold", "min_pix_per_spot", "max_pix_per_spot", "high_resolution_limit", "low_resolution_limit", "indexing_tolerance"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of SpotFindingSettings from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of SpotFindingSettings from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"enable": obj.get("enable") if obj.get("enable") is not None else True,
|
||||
"indexing": obj.get("indexing") if obj.get("indexing") is not None else True,
|
||||
"filter_powder_rings": obj.get("filter_powder_rings") if obj.get("filter_powder_rings") is not None else False,
|
||||
"min_spot_count_powder_ring": obj.get("min_spot_count_powder_ring"),
|
||||
"signal_to_noise_threshold": obj.get("signal_to_noise_threshold"),
|
||||
"photon_count_threshold": obj.get("photon_count_threshold"),
|
||||
"min_pix_per_spot": obj.get("min_pix_per_spot"),
|
||||
"max_pix_per_spot": obj.get("max_pix_per_spot"),
|
||||
"high_resolution_limit": obj.get("high_resolution_limit"),
|
||||
"low_resolution_limit": obj.get("low_resolution_limit"),
|
||||
"indexing_tolerance": obj.get("indexing_tolerance")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Jungfraujoch
|
||||
|
||||
Jungfraujoch Broker Web API
|
||||
|
||||
The version of the OpenAPI document: 1.0.0-rc.13
|
||||
Contact: filip.leonarski@psi.ch
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing_extensions import Annotated
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class StandardDetectorGeometry(BaseModel):
|
||||
"""
|
||||
Regular rectangular geometry, first module is in the bottom left corner of the detector
|
||||
""" # noqa: E501
|
||||
nmodules: Annotated[int, Field(strict=True, ge=1)] = Field(description="Number of modules in the detector")
|
||||
gap_x: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=8, description="Gap size in X direction [pixels]")
|
||||
gap_y: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=36, description="Gap size in Y direction [pixels]")
|
||||
modules_in_row: Optional[Annotated[int, Field(strict=True, ge=1)]] = Field(default=1, description="Number of modules in one row")
|
||||
__properties: ClassVar[List[str]] = ["nmodules", "gap_x", "gap_y", "modules_in_row"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of StandardDetectorGeometry from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of StandardDetectorGeometry from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"nmodules": obj.get("nmodules"),
|
||||
"gap_x": obj.get("gap_x") if obj.get("gap_x") is not None else 8,
|
||||
"gap_y": obj.get("gap_y") if obj.get("gap_y") is not None else 36,
|
||||
"modules_in_row": obj.get("modules_in_row") if obj.get("modules_in_row") is not None else 1
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
95
python-client/openapi_client/models/zeromq_settings.py
Normal file
95
python-client/openapi_client/models/zeromq_settings.py
Normal file
@@ -0,0 +1,95 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Jungfraujoch
|
||||
|
||||
Jungfraujoch Broker Web API
|
||||
|
||||
The version of the OpenAPI document: 1.0.0-rc.13
|
||||
Contact: filip.leonarski@psi.ch
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing_extensions import Annotated
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class ZeromqSettings(BaseModel):
|
||||
"""
|
||||
ZeroMQ configuration for Jungfraujoch software. This structure is used to provide default settings using configuration JSON file and is not used in HTTP.
|
||||
""" # noqa: E501
|
||||
send_watermark: Optional[Annotated[int, Field(le=16384, strict=True, ge=2)]] = Field(default=100, description="Watermark for ZeroMQ send queue (number of outstanding messages queued on Jungfraujoch server per queue)")
|
||||
image_socket: Optional[List[StrictStr]] = Field(default=None, description="PUSH ZeroMQ socket for images. In case multiple sockets are provided, images are streamed over multiple sockets. Images are serialized using CBOR. Address follows ZeroMQ convention for sockets - in practice ipc://<socket file> and tpc://<IP address>:<port> sockets are OK. 0.0.0.0 instead of IP address is accepted and means listening on all network interfaces. ")
|
||||
preview_socket: Optional[StrictStr] = Field(default=None, description="PUB ZeroMQ socket for preview images. This socket operates at a reduced frame rate. Images are serialized using CBOR. Address follows ZeroMQ convention for sockets - in practice ipc://<socket file> and tpc://<IP address>:<port> sockets are OK. 0.0.0.0 instead of IP address is accepted and means listening on all network interfaces. ")
|
||||
writer_notification_socket: Optional[StrictStr] = Field(default=None, description="PULL ZeroMQ socket for notifications from writer that it finished operation. This allows Jungfraujoch to operate in a synchronous manner, with end of acquisition being also end of writing. Address follows ZeroMQ convention for sockets - in practice ipc://<socket file> and tpc://<IP address>:<port> sockets are OK. 0.0.0.0 instead of IP address should be avoided, as this socket address is forwarded to the writer process via START ZerOMQ message and in case of multiple ineterfaces the address might be ambigous. Using * (star) instead of port number is allowed and it means a random free port number. ")
|
||||
__properties: ClassVar[List[str]] = ["send_watermark", "image_socket", "preview_socket", "writer_notification_socket"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of ZeromqSettings from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of ZeromqSettings from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"send_watermark": obj.get("send_watermark") if obj.get("send_watermark") is not None else 100,
|
||||
"image_socket": obj.get("image_socket"),
|
||||
"preview_socket": obj.get("preview_socket"),
|
||||
"writer_notification_socket": obj.get("writer_notification_socket")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
Reference in New Issue
Block a user