DimensionRecordTable¶
- final class lsst.daf.butler.DimensionRecordTable(element: DimensionElement | str | None = None, records: Iterable[DimensionRecord] = (), universe: DimensionUniverse | None = None, table: pa.Table | None = None, batch_size: int | None = None)¶
- Bases: - object- A table-like container for - DimensionRecordobjects.- Parameters:
- elementDimensionElementorstr, optional
- The dimension element that defines the records held by this table. If not a - DimensionElementinstance,- universemust be provided. If not provided,- tablemust have an “element” entry in its metadata (as is the case for tables returned by the- to_arrowmethod).
- recordsIterable[DimensionRecord], optional
- Dimension records to add to the table. 
- universeDimensionUniverse, optional
- Object that defines all dimensions. Ignored if - elementis a- DimensionElementinstance.
- tablepyarrow.Table
- Arrow table to copy columns from. Must have schema returned by - make_arrow_schemafor this element. This argument is primarily intended to serve as the way to reconstruct a- DimensionRecordTablethat has been serialized to an Arrow-supported file or IPC format.
- batch_sizeint, optional
- How many elements of - recordsshould be processed at a time, with each batch yielding a- pyarrow.RecordBatchin the created table. Smaller values will reduce peak memory usage for large iterables. Ignored if- recordsis empty.
 
- element
 - Notes - DimensionRecordTableshould generally have a smaller memory footprint than- DimensionRecordSetif its rows are unique, and it provides fast column-oriented access and Arrow interoperability that- DimensionRecordSetlacks entirely. In other respects- DimensionRecordSetis more featureful and simpler to use efficiently.- Attributes Summary - The dimension element that defines the records of this table. - Methods Summary - column(name)- Return a single column from the table as an array. - extend(records)- Add new rows to the end of the table. - make_arrow_schema(element)- Return the Arrow schema of the table returned by - to_arrowwith the given dimension element.- to_arrow()- Return a Arrow table holding the same records. - Attributes Documentation - element¶
- The dimension element that defines the records of this table. 
 - Methods Documentation - column(name: str) ChunkedArray¶
- Return a single column from the table as an array. - Parameters:
- namestr
- Name of the column. Valid options are given by - DimensionElement.schema.names, and are the same as the attributes of the dimension records.
 
- name
- Returns:
- arraypyarrow.ChunkedArray
- An array view of the column. 
 
- array
 
 - extend(records: Iterable[DimensionRecord]) None¶
- Add new rows to the end of the table. - Parameters:
- recordsIterable[DimensionRecord]
- Dimension records to add to the table. 
 
- records
 
 - classmethod make_arrow_schema(element: DimensionElement) pa.Schema¶
- Return the Arrow schema of the table returned by - to_arrowwith the given dimension element.- Parameters:
- elementDimensionElement
- Dimension element that defines the schema. 
 
- element
- Returns:
- schemapyarrow.Schema
- Arrow schema. 
 
- schema
 
 - to_arrow() Table¶
- Return a Arrow table holding the same records.