Skip to main content

grid_conditions

Function grid_conditions 

Source
pub fn grid_conditions(axes: &Value) -> Result<Vec<Condition>>
Expand description

The conditions of a grid as a specification writes it: the Cartesian product of its axes, the last one varying fastest. An axis is a list of values, {from, to, step}, {linspace: [start, stop, count]} or one scalar.

use comnum_spec::grid_conditions;
let conds = grid_conditions(&serde_json::json!({"m": [4, 16], "snr_db": {"from": 0, "to": 10, "step": 10}}))?;
assert_eq!(conds.len(), 4);
assert_eq!(conds[1].f64("snr_db")?, 10.0);

ยงErrors

Error::Config if axes is not a mapping or an axis is invalid.