Models

Particle Beam Models

Module with pydantic models to validate and store data structures relative to particle beams.

class pyhdtoolkit.models.beam.BeamParameters(*, pc_GeV: float | None = None, E_0_GeV: float | None = 0.9382720813, charge: float | None = 1, nemitt_x: float | None = None, nemitt_y: float | None = None, deltap_p: float | None = None)[source]

Added in version 0.12.0.

Class to encompass, validate and manipulate properties of a particle beam. One can find a usage example in the beam enveloppe demo.

property B_rho_Tm: float

Beam rigidity in [T/m].

property E_kin_GeV: float

Total beam energy in [GeV].

property E_tot_GeV: float

Total beam energy in [GeV].

property beta_rel: float

Relativistic beta.

property gamma_rel: float

Relativistic gamma.

property gemitt_x: float

Horizontal geometric emittance in [m].

property gemitt_y: float

Vertical geometric emittance in [m].

model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[Dict[str, FieldInfo]] = {'E_0_GeV': FieldInfo(annotation=Union[float, NoneType], required=False, default=0.9382720813), 'charge': FieldInfo(annotation=Union[float, NoneType], required=False, default=1), 'deltap_p': FieldInfo(annotation=Union[float, NoneType], required=False, default=None), 'nemitt_x': FieldInfo(annotation=Union[float, NoneType], required=False, default=None), 'nemitt_y': FieldInfo(annotation=Union[float, NoneType], required=False, default=None), 'pc_GeV': FieldInfo(annotation=Union[float, NoneType], required=False, default=None)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

HTCondor Models

Module with pydantic models to validate and store data obtained by querying the HTCondor queue.

class pyhdtoolkit.models.htc.BaseSummary(*, jobs: int, completed: int, removed: int, idle: int, running: int, held: int, suspended: int)[source]

Added in version 0.12.0.

Class to encompass and validate the cluster’s summary line in the condor_q output.

model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[Dict[str, FieldInfo]] = {'completed': FieldInfo(annotation=int, required=True), 'held': FieldInfo(annotation=int, required=True), 'idle': FieldInfo(annotation=int, required=True), 'jobs': FieldInfo(annotation=int, required=True), 'removed': FieldInfo(annotation=int, required=True), 'running': FieldInfo(annotation=int, required=True), 'suspended': FieldInfo(annotation=int, required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

class pyhdtoolkit.models.htc.ClusterSummary(*, scheduler_id: str, query: BaseSummary, user: BaseSummary, cluster: BaseSummary)[source]

Added in version 0.12.0.

Class to encompass and validate the cluster’s info line in the condor_q output.

model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[Dict[str, FieldInfo]] = {'cluster': FieldInfo(annotation=BaseSummary, required=True), 'query': FieldInfo(annotation=BaseSummary, required=True), 'scheduler_id': FieldInfo(annotation=str, required=True), 'user': FieldInfo(annotation=BaseSummary, required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

class pyhdtoolkit.models.htc.HTCTaskSummary(*, owner: str, batch_name: int, submitted: DateTime, done: int | str, run: int | str, idle: int | str, total: int, job_ids: str)[source]

Added in version 0.12.0.

Class to encompass and validate a specific job’s line in the condor_q output.

model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[Dict[str, FieldInfo]] = {'batch_name': FieldInfo(annotation=int, required=True), 'done': FieldInfo(annotation=Union[int, str], required=True), 'idle': FieldInfo(annotation=Union[int, str], required=True), 'job_ids': FieldInfo(annotation=str, required=True), 'owner': FieldInfo(annotation=str, required=True), 'run': FieldInfo(annotation=Union[int, str], required=True), 'submitted': FieldInfo(annotation=DateTime, required=True), 'total': FieldInfo(annotation=int, required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

MAD-X Models

Module with pydantic models to validate and store data obtained by interacting with the MAD-X process through cpymad.

class pyhdtoolkit.models.madx.MADXBeam(*, particle: ParticleEnum, mass: Annotated[float, Gt(gt=0)], charge: float, energy: Annotated[float, Gt(gt=0)], pc: float, gamma: float, beta: float, brho: float, ex: float, ey: float, et: float, exn: float, eyn: float, sigt: float, sige: float, kbunch: Annotated[int, Gt(gt=0)], npart: Annotated[int, Gt(gt=0)], bcurrent: float, bunched: bool, radiate: bool, bv: int)[source]

Added in version 0.12.0.

Class to encompass and validate BEAM attributes from the MAD-X process.

model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[Dict[str, FieldInfo]] = {'bcurrent': FieldInfo(annotation=float, required=True), 'beta': FieldInfo(annotation=float, required=True), 'brho': FieldInfo(annotation=float, required=True), 'bunched': FieldInfo(annotation=bool, required=True), 'bv': FieldInfo(annotation=int, required=True), 'charge': FieldInfo(annotation=float, required=True), 'energy': FieldInfo(annotation=float, required=True, metadata=[Gt(gt=0)]), 'et': FieldInfo(annotation=float, required=True), 'ex': FieldInfo(annotation=float, required=True), 'exn': FieldInfo(annotation=float, required=True), 'ey': FieldInfo(annotation=float, required=True), 'eyn': FieldInfo(annotation=float, required=True), 'gamma': FieldInfo(annotation=float, required=True), 'kbunch': FieldInfo(annotation=int, required=True, metadata=[Gt(gt=0)]), 'mass': FieldInfo(annotation=float, required=True, metadata=[Gt(gt=0)]), 'npart': FieldInfo(annotation=int, required=True, metadata=[Gt(gt=0)]), 'particle': FieldInfo(annotation=ParticleEnum, required=True), 'pc': FieldInfo(annotation=float, required=True), 'radiate': FieldInfo(annotation=bool, required=True), 'sige': FieldInfo(annotation=float, required=True), 'sigt': FieldInfo(annotation=float, required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

class pyhdtoolkit.models.madx.ParticleEnum(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Added in version 0.12.0.

Validator Enum defining the accepted particle names in MAD-X beams.