scippneutron.io.cif.Loop#
- class scippneutron.io.cif.Loop(columns, *, comment='', schema=None)[source]#
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)[source]#
Create a new CIF loop.
- Parameters:
columns (
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 schemas used for the loop. Content is not checked against the schema, but the schema is written to the file.
Methods
Attributes
comment
Optional comment that can be written above the object in the file.
schema
CIF schemas used for the object.
- write(f)[source]#
Write this loop to a file.
Used mainly internally, use
scippneutron.io.cif.save_cif()
instead.