# percept_analyzer

## Utility functions to operate on percept data.

Utility functions to operate on percept data. These functions should be considered experimental. Behaviour may change in future releases.

#### Functions

### minmax(Data::[{X, Y}]) -> {MinX, MinY, MaxX, MaxY}

`X = number()`

`Y = number()`

`MinX = number()`

`MinY = number()`

`MaxX = number()`

`MaxY = number()`

Returns the min and max of a set of 2-dimensional numbers.

### mean(List::[number()]) -> {Mean, StdDev, N}

`Mean = float()`

`StdDev = float()`

`N = integer()`

Calculates the mean and the standard deviation of a set of numbers.

### activities2count(Acts::#activity{}, StartTs::timestamp()) -> Result

`Result = [{Time, ProcessCount, PortCount}]`

`Time = float()`

`ProcessCount = integer()`

`PortCount = integer()`

Calculate the resulting active processes and ports during the activity interval. Also checks active/inactive consistency. A task will always begin with an active state and end with an inactive state.

### activities2count(Acts, StartTs, Type) -> term()

### waiting_activities(Activities::[#activity{}]) -> FunctionList

`FunctionList = [{Seconds, Mfa, {Mean, StdDev, N}}]`

`Seconds = float()`

`Mfa = mfa()`

`Mean = float()`

`StdDev = float()`

`N = integer()`

Calculates the time, both average and total, that a process has spent in a receive state at specific function. However, if there are multiple receives in a function it cannot differentiate between them.

### seconds2ts(Seconds::float(), StartTs::{integer(), integer(), integer()}) -> timestamp()

Calculates a timestamp given a duration in seconds and a starting timestamp.

### minmax_activities(Activities::[#activity{}], Count::integer()) -> {integer(), integer()}

Calculates the minimum and maximum of runnable activites (processes and ports) during the interval of reffered by the activity list.