timeflux_example.nodes.arithmetic


Simple example nodes

arithmetic

class timeflux_example.nodes.arithmetic.Add(value)[source]

Bases: timeflux.core.node.Node

Adds value to each cell of the input.

This is one of the simplest possible nodes.

Variables
  • i (Port) – Default input, expects DataFrame.

  • o (Port) – Default output, provides DataFrame.

Example

graphs:

  - nodes:
    - id: node_1
      module: timeflux.nodes.random
      class: Random
      params:
        columns: 5
        rows_min: 1
        rows_max: 10
        value_min: 0
        value_max: 5
        seed: 1
    - id: node_2
      module: timeflux_example.nodes.arithmetic
      class: Add
      params:
        value: 1
    - id: node_3
      module: timeflux.nodes.debug
      class: Display

    edges:
    - source: node_1
      target: node_2
    - source: node_2
      target: node_3
Parameters

value (int) – The value to add to each cell.

update()[source]

Update the input and output ports.

class timeflux_example.nodes.arithmetic.MatrixAdd[source]

Bases: timeflux.core.node.Node

Sum two input matrices together.

This node illustrates multiple named inputs. Note that it is not necessary to declare the ports. They will be created dynamically.

Variables
  • i_m1 (Port) – First matrix, expects DataFrame.

  • i_m2 (Port) – Second matrix, expects DataFrame.

  • o (Port) – Default output, provides DataFrame.

Example

graphs:

  - id: multi
    nodes:
    - id: matrix_1
      module: timeflux.nodes.random
      class: Random
      params:
        columns: 2
        rows_min: 2
        rows_max: 2
        value_min: 1
        value_max: 1
        seed: 1
    - id: matrix_2
      module: timeflux.nodes.random
      class: Random
      params:
        columns: 2
        rows_min: 2
        rows_max: 2
        value_min: 2
        value_max: 2
        seed: 1
    - id: matrix_add
      module: timeflux_example.nodes.arithmetic
      class: MatrixAdd
    - id: display_matrix_1
      module: timeflux.nodes.debug
      class: Display
    - id: display_matrix_2
      module: timeflux.nodes.debug
      class: Display
    - id: display_matrix_add
      module: timeflux.nodes.debug
      class: Display

    edges:
    - source: matrix_1
      target: matrix_add:m1
    - source: matrix_2
      target: matrix_add:m2
    - source: matrix_1
      target: display_matrix_1
    - source: matrix_2
      target: display_matrix_2
    - source: matrix_add
      target: display_matrix_add

    rate: 0.1

Instantiate the node.

update()[source]

Update the input and output ports.

class timeflux_example.nodes.arithmetic.MatrixDivide[source]

Bases: timeflux.core.node.Node

Divide one matrix by another.

Variables
  • i_m1 (Port) – First matrix, expects DataFrame.

  • i_m2 (Port) – Second matrix, expects DataFrame.

  • o (Port) – Default output, provides DataFrame.

Instantiate the node.

update()[source]

Update the input and output ports.