# Utilities

`CorrelationFunctions.read_cuboid`

— Function`read_cuboid(cfgpath :: String)`

Read 3D array from a disk. The data on disk consists of two files: JSON configuration file (which is passed to this function) and a raw binary array data.

Scheme of the configuration file is as follows, where `x`

, `y`

and `z`

are dimensions of the array:

```
{
"dimensions": [x, y, z],
"datapath": "file-with-data"
}
```

The file with binary data, whose name is specified in `datapath`

field, is searched relatively to the directory with the JSON configuration file. Its size must be exactly `x`

⋅`y`

⋅`z`

bytes, each byte containing an element of the resulting array.

`read_cuboid(datapath :: String, side, dim)`

Read 3D array from a disk. The data on the disk must be in binary format, one octet per sample. Totally, there must be $side^{dim}$ octets which are read into $side \times side \times \dots \times side$ array.

`CorrelationFunctions.Directional.lowfreq_energy_ratio`

— Function`lowfreq_energy_ratio(array, fraction = 0.5)`

Calculate a ratio $E_a/E$ where $E$ is a total energy of a signal `array`

and $E_a$ is the energy concentrated in frequencies $[0, af/2]$ where $f$ is the sampling rate and $a$ is set via parameter `fraction`

. `mean(array)`

is subtracted from the array before calculations.

This function can be helpful in estimating if `array`

is suitable for calculating surface-surface or surface-void function. An empirical criterion is that if this function returns a value greater than `0.95`

, the array is good.