MCPcopy Create free account
hub / github.com/SingleRust/SingleRust / get_select_info_obs

Function get_select_info_obs

src/shared/processing/mod.rs:6–24  ·  view source on GitHub ↗
(
    obs_mask: Option<ArrayView<'_, bool, Ix1>>,
)

Source from the content-addressed store, hash-verified

4use polars::prelude::DataType;
5
6pub fn get_select_info_obs(
7 obs_mask: Option<ArrayView<'_, bool, Ix1>>,
8) -> anyhow::Result<Vec<SelectInfoElem>> {
9 // Convert masks to indices
10 let obs_indices = obs_mask.map(|mask| {
11 mask.iter()
12 .enumerate()
13 .filter_map(|(i, &b)| if b { Some(i) } else { None })
14 .collect::<Vec<_>>()
15 });
16
17 // Create a selection based on the masks
18 let mut selection = vec![SelectInfoElem::full(), SelectInfoElem::full()];
19 if let Some(obs_idx) = obs_indices {
20 selection[0] = SelectInfoElem::Index(obs_idx);
21 }
22
23 Ok(selection)
24}
25
26pub fn get_select_info_vars(
27 vars_mask: Option<ArrayView<'_, bool, Ix1>>,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected