add_atom_channel_by_expr
- macromol_voxelize.add_atom_channel_by_expr(atoms: DataFrame, expr: Expr | Series | str, channel: int)[source]
Add every atom for which the expression is true to the given channel.
- Parameters:
atoms – A dataframe representing the atoms to voxelize. The dataframe must already have a column named channels, in the format expected by
image_from_atoms().expr – A boolean expression that will be evaluated for each atom. If the expression is true, the atom will be added to the given channel.
channel – The channel to add the atoms to.
- Returns:
A copy of the input dataframe, with the channels column modified.