scippneutron.metadata.Beamline#

class scippneutron.metadata.Beamline(**data)[source]#

A beamline / instrument.

name should be the canonical spelling of the beamline name. The location of the beamline is split into facility and site, where a ‘facility’ is located at a ‘site’. For example:

>>> from scippneutron.metadata import Beamline
>>> beamline = Beamline(
...     name='Amor',
...     facility='SINQ',
...     site='PSI',
... )

If there is no separate facility and site, either omit site or use the same value for both facility and site. For example:

>>> beamline = Beamline(
...     name='ESTIA',
...     facility='ESS',
...     site='ESS',  # can be omitted
... )

If the beamline has been upgraded, provide a revision to indicate which version of the beamline was used.

Attributes

model_computed_fields

model_config

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

model_extra

Get extra fields set during validation.

model_fields

model_fields_set

Returns the set of fields that have been explicitly set on this model instance.

name

Name of the beamline.

facility

Facility where the beamline is located.

site

Site where the facility is located.

revision

Revision of the beamline in case of upgrades.

facility: Annotated[str | None, BeforeValidator(_unpack_variable)]#

Facility where the beamline is located.

classmethod from_nexus_entry(entry, *, instrument_name=None)[source]#

Construct a Beamline object from a Nexus entry.

NeXus does not have a standard method for specifying the facility, site, or revision. This function only sets those fields for known instruments.

Parameters:
  • entry (Group) – ScippNexus group for a NeXus entry. The entry needs to contain an NXinstrument with a ‘name’ field to identify the instrument.

  • instrument_name (Optional[str], default: None) – If the entry contains more than one NXinstrument group, this parameter must be the name of one of these groups.

Returns:

Beamline – A Beamline object constructed from the given Nexus entry.

model_config: ClassVar[ConfigDict] = {}#

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

name: Annotated[str, BeforeValidator(_unpack_variable)]#

Name of the beamline.

revision: Annotated[str | None, BeforeValidator(_unpack_variable)]#

Revision of the beamline in case of upgrades.

site: Annotated[str | None, BeforeValidator(_unpack_variable)]#

Site where the facility is located.