← All procedures

quantity.mean

This function gives the arithmetic mean. For a logarithmic level, it gives the energy mean: 10·log10 of the mean power.

CLI
Package
@procedures/quantity · README
Path
["quantity","mean"]
CLI
mark quantity mean --amounts <object[]>
As data
{"$proc":["quantity","mean"],"input":{}}

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/quantity/register"; // registers its procedures

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["quantity","mean"], { amounts: [] });
console.log(JSON.stringify(result));

From the command line

$ mark quantity mean --amounts <object[]>

As data, in a program

{ "$proc": ["quantity", "mean"], "input": { "amounts": [] } }

Input

FieldTypeRequiredDefaultDescription
amountsobject[]yes
unitstringno

Output

FieldTypeRequiredDefaultDescription
valuenumberyes
unitstringyes
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "amounts": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "value": {
              "type": "number"
            },
            "unit": {
              "type": "string"
            }
          },
          "required": [
            "value",
            "unit"
          ],
          "additionalProperties": {}
        }
      },
      "unit": {
        "type": "string"
      }
    },
    "required": [
      "amounts"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": "object",
    "properties": {
      "value": {
        "type": "number"
      },
      "unit": {
        "type": "string"
      }
    },
    "required": [
      "value",
      "unit"
    ],
    "additionalProperties": {}
  }
}