Skip to main content

from_columns

Function from_columns 

Source
pub fn from_columns(
    columns: Bound<'_, PyDict>,
    p4s: Option<Vec<String>>,
    aux: Option<Vec<String>>,
    aliases: Option<Bound<'_, PyDict>>,
) -> PyResult<PyDataset>
Expand description

Build a Dataset from columnar arrays.

This is the canonical high-throughput ingestion path used by Python reader helpers.

§Examples

import laddu.io as ldio # doctest: +SKIP dataset = ldio.from_columns( # doctest: +SKIP … { … ‘beam_px’: [0.0], … ‘beam_py’: [0.0], … ‘beam_pz’: [8.5], … ‘beam_e’: [8.5], … ‘proton_px’: [0.0], … ‘proton_py’: [0.0], … ‘proton_pz’: [-0.2], … ‘proton_e’: [0.959], … ‘pol_magnitude’: [0.4], … ‘pol_angle’: [0.3], … ‘weight’: [1.0], … }, … p4s=[‘beam’, ‘proton’], … aux=[‘pol_magnitude’, ‘pol_angle’], … aliases={‘target’: ‘proton’}, … ) dataset[0].p4(‘target’) # doctest: +SKIP Vec4(px=0.0, py=0.0, pz=-0.2, e=0.959)