Skip to content

Implement switch nodes for categorical decisions #310

@nsmith-

Description

@nsmith-

Hi @nsmith-,

Thank you for your reply and sorry for a delayed response. I think new node type proposal sounds good. I'm proposing the name "Comparison" instead to be a bit consistent with CMSSW string parser, but we don't need to.

For the Filter node, maybe we can add operator option to use either logical and or logical or of the Comparison nodes. Since you can give both true_value and false_value, I think the name Switch node might be better.

class Comparison(Model):
    variable: str
    cmp: Literal[">", "<", ">=", "<=", "==", "!="]
    value: float

class Switch(Model):
    nodetype: Literal["filter"]
    inputs: List[str]
    selections: List[Comparison]
    operator: Literal["and", "or"]
    true_value: Content
    false_value: Content

Do you think you can implement these? Otherwise, I can also take a look and try to implement these as well.

Originally posted by @patinkaew in #268

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions