data_stat

libra_py.data_stat.bootstrapping(X, nB, rnd)[source]

Bootstrapping the sample

Parameters
  • X (list of N int/double) – the original sample

  • nB (int) – the number of bootstrapping cycles

Returns:

libra_py.data_stat.cmat_distrib(X, i, j, component, xmin, xmax, dx)[source]

Computes the distribution of the matrix element values in the list of CMATRIX(N,N) objects

Parameters
  • X (list of CMATRIX(N,N) objects) – the data to be analyzed

  • i (int) – row index of the matrix element to analyze

  • j (int) – column index of the matrix element to analyze

  • component (int = 0 or 1) – determines whether to analyze the real (0) or imaginary (1) component of the data series

  • xmin (double) – the minimal value of the bin support

  • xmax (double) – the maximal value of the bin support

  • dx (double) – the value of the bin support grid spacing

Returns

( bin_support, dens, cum ), where:

  • bin_support ( list of doubles ): the range of values the distribution is computed for

  • dens ( list of doubles ): the probability density

  • cum ( list of doubles ): the cumulative distribution function

Return type

tuple

libra_py.data_stat.cmat_stat(X)[source]

Computes the average and standard deviation of list of CMATRIX(N,N) objects

Parameters

X (list of CMATRIX(N,N) objects) – the data to be analyzed

Returns

(res, res2): where

  • res ( CMATRIX(N,N) ): average of each matrix element of data

  • res2 ( CMATRIX(N,N) ): standard deviation of each matrix element of data

Return type

tuple

libra_py.data_stat.cmat_stat2(X, opt)[source]

Computes the norm-N average of a list of CMATRIX(N,N) objects

Parameters
  • X (list of CMATRIX(N,N) objects) – the data to be analyzed

  • opt (int) –

    the option for averaging:

    • opt == 0 : t_ij = <x_ij> + i <y_ij>

    • opt == 1 : t_ij = <|x_ij|> + i <|y_ij|>

    • opt == 2 : t_ij = sqrt(<x_ij^2>) + i sqrt(<y_ij^2>)

    • opt == 3 : t_ij = sqrt(<x_ij^2> + <y_ij^2>) = sqrt(|z_ij|^2)

Returns

norm-N average of each matrix element of data

Return type

CMATRIX(N,N)

libra_py.data_stat.compute_density(X, Y, minx, maxx, dx)[source]

Computes the probability density from the non-uniform distribution of pair points

Parameters
  • X (list of double) – the original values of x

  • Y (list of double) – the original values of y

  • minx (double) – the minimal value of the new X axis

  • maxx (double) – the max value of the new X axis

  • dx (double) – the grid spacing of the new X axis

Note

The pair relationship X[i] - Y[i] is expected

Returns

( nX, nY ): where

  • nX ( list of doubles ) - new, uniform X axis

  • nY ( list of doubles ) - renormalized Y axis

Return type

tuple

libra_py.data_stat.find_maxima(data, params)[source]

This function finds all the maxima of the data set and sorts them according to the data The maxima are defined as data[i-1] < data[i] > data[i+1]

Parameters
  • data (list of doubles) – data to be analyzed

  • params (Python dictionary) –

    parameters controlling the execution

    • **params[“do_output”] ( Boolean ): wheather to output the data to file [ default: False ]

    • **params[“logname”] ( Boolean ): the name of the output file [ default: “data_maxima.txt” ]

    • **params[“verbose”] ( int ): the amount of the debug/descriptive info to print out [ default: 0 ]

Returns

our[i][v], where:

out[i][0] - containing indices of the maximal values

Return type

list of 2-element lists

Examples

>>> res = find_maxima( [0.01, 1.0, 0.1, 0.25, 0.5, 0.75, -1.0 ], {} )
>>> print res
>>> [ [1, 1.0], [5, 0.75] ]
>>> res = find_maxima( [0.01, 0.75, 0.1, 0.25, 0.5, 1.75, -1.0 ], {} )
>>> print res
>>> [ [5, 1.75], [1, 0.75] ]
libra_py.data_stat.mat_average(data)[source]

This function computes the average value of the data series

Parameters

data (list of MATRIX(ndof, 1) objects) – sequence of real-valued ndof-dimensional vectors

Returns

the average value for each DOF in the time-series

Return type

MATRIX(ndof, 1)

libra_py.data_stat.mat_center_data(data)[source]

This function centers data on zero, by subtracting the average value from each element, dof by dof

Parameters

data (list of MATRIX(ndof, 1) objects) – sequence of real-valued ndof-dimensional vectors

Returns

the fluctuation (deviation) value for each DOF in the time-series (dX(t) = X(t) -<X> )

Return type

MATRIX(ndof, 1)

libra_py.data_stat.mat_stat(X)[source]

Computes the average and standard deviation of list of MATRIX(N,N) objects

Parameters

X (list of MATRIX(N,N) objects) – the data to be analyzed

Returns

(res, res2, dw_bound, up_bound): where

  • res ( MATRIX(N,N) ): average of each matrix element of data

  • res2 ( MATRIX(N,N) ): standard deviation of each matrix element of data

  • dw_bound ( MATRIX(N,N) ): lower bounds of the data for each matrix element

  • up_bound ( MATRIX(N,N) ): upper bounds of the data for each matrix element

Return type

tuple

libra_py.data_stat.scalar_stat(data)[source]

The function computes some simple descriptive statistics of the scalar data series.

Parameters

data (list of doubles) – the data to be analyzed

Returns

(res, res2), where:

  • res ( double ): average of data

  • res2 ( double ): standard deviation of data

Return type

tuple

libra_py.data_stat.vec_average(data)[source]

This function computes the average value of the data series

Parameters

data (list of VECTOR objects) – sequence of real-valued ndof-dimensional vectors

Returns

the average value for each DOF in the time-series

Return type

VECTOR

libra_py.data_stat.vec_center_data(data)[source]

This function centers data on zero, by subtracting the average value from each element, dof by dof

Parameters

data (list of VECTOR objects) – sequence of real-valued ndof-dimensional vectors

Returns

the fluctuation (deviation) value for each DOF in the time-series (dX(t) = X(t) -<X> )

Return type

VECTOR