# salt.thorium.calc

Used to manage the thorium register. The thorium register is where compound values are stored and computed, such as averages etc.

Added in version 2016.11.0.

depends:

  statistics PyPi module

salt.thorium.calc.add(name, num, minimum=0, maximum=0, ref=None)

  Adds together the `num` most recent values. Requires a list.

  USAGE:

      foo:
        calc.add:
          - name: myregentry
          - num: 5

salt.thorium.calc.calc(name, num, oper, minimum=0, maximum=0, ref=None)

  Perform a calculation on the `num` most recent values. Requires a list. Valid values for `oper` are:

  - add: Add last `num` values together

  - mul: Multiple last `num` values together

  - mean: Calculate mean of last `num` values

  - median: Calculate median of last `num` values

  - median_low: Calculate low median of last `num` values

  - median_high: Calculate high median of last `num` values

  - median_grouped: Calculate grouped median of last `num` values

  - mode: Calculate mode of last `num` values

  USAGE:

      foo:
        calc.calc:
          - name: myregentry
          - num: 5
          - oper: mean

salt.thorium.calc.mean(name, num, minimum=0, maximum=0, ref=None)

  Calculates the mean of the `num` most recent values. Requires a list.

  USAGE:

      foo:
        calc.mean:
          - name: myregentry
          - num: 5

salt.thorium.calc.median(name, num, minimum=0, maximum=0, ref=None)

  Calculates the mean of the `num` most recent values. Requires a list.

  USAGE:

      foo:
        calc.median:
          - name: myregentry
          - num: 5

salt.thorium.calc.median_grouped(name, num, minimum=0, maximum=0, ref=None)

  Calculates the grouped mean of the `num` most recent values. Requires a list.

  USAGE:

      foo:
        calc.median_grouped:
          - name: myregentry
          - num: 5

salt.thorium.calc.median_high(name, num, minimum=0, maximum=0, ref=None)

  Calculates the high mean of the `num` most recent values. Requires a list.

  USAGE:

      foo:
        calc.median_high:
          - name: myregentry
          - num: 5

salt.thorium.calc.median_low(name, num, minimum=0, maximum=0, ref=None)

  Calculates the low mean of the `num` most recent values. Requires a list.

  USAGE:

      foo:
        calc.median_low:
          - name: myregentry
          - num: 5

salt.thorium.calc.mode(name, num, minimum=0, maximum=0, ref=None)

  Calculates the mode of the `num` most recent values. Requires a list.

  USAGE:

      foo:
        calc.mode:
          - name: myregentry
          - num: 5

salt.thorium.calc.mul(name, num, minimum=0, maximum=0, ref=None)

  Multiplies together the `num` most recent values. Requires a list.

  USAGE:

      foo:
        calc.mul:
          - name: myregentry
          - num: 5