scippneutron.io.cif.Loop#

class scippneutron.io.cif.Loop(columns, *, comment='', schema=None)#

A CIF loop.

Contains a mapping from strings to Scipp variables. The strings are arbitrary and Loop can merge items from different categories into a single loop. All variables must have the same length.

__init__(columns, *, comment='', schema=None)#

Create a new CIF loop.

Parameters:
  • columns (Union[Mapping[str, Variable], Iterable[tuple[str, Variable]], None]) – Defines a mapping from column names (including their category) to column values as Scipp variables.

  • comment (str, default: '') – Optional comment that can be written above the loop in the file.

  • schema (Union[CIFSchema, Iterable[CIFSchema], None], default: None) – CIF Schema used for the loop. Content is not checked against the schema, but the schema is written to the file.

Methods

__init__(columns, *[, comment, schema])

Create a new CIF loop.

write(f)

Write this loop to a file.

Attributes

comment

Optional comment that can be written above the loop in the file.

schema

CIF Schema used for the loop.

property comment: str#

Optional comment that can be written above the loop in the file.

property schema: set[CIFSchema]#

CIF Schema used for the loop.

write(f)#

Write this loop to a file.

Used mainly internally, use scippneutron.io.cif.save_cif() instead.

Parameters:

f (TextIOBase) – File handle.

Return type:

None