cpalgnodes.utils module

Helper functions and classes for alg nodes

class cpalgnodes.utils.DataType(value)

Bases: Enum

The different types of data that are run over

The values of the enum are meant to match those in the ParticleDataType C++ enum

property is_data

Is this a data sample

property is_simulation

Is this a simulated sample

cpalgnodes.utils.add_sys_pattern(name)

If the provided name doesn’t contain the ‘%SYS%’ pattern add it to the end

cpalgnodes.utils.replace_sys_pattern(name: str, replace_with: str | None = None)

Replace the %SYS% pattern in the provided string

In order to deal with the (usual) case where the pattern is added as a ‘_%SYS%’ suffix and the pattern to be replaced with is an empty string, this whole suffix will just be removed. In order to prevent this, just supply an empty string to the replace_with parameter