(
obs_mask: Option<ArrayView<'_, bool, Ix1>>,
)
| 4 | use polars::prelude::DataType; |
| 5 | |
| 6 | pub 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 | |
| 26 | pub fn get_select_info_vars( |
| 27 | vars_mask: Option<ArrayView<'_, bool, Ix1>>, |
nothing calls this directly
no outgoing calls
no test coverage detected