rtCommon.validationUtils

ValidationUtils - utils to help validate that arrays and data structures match. For example in testing and comparing to a known-good run from matlab.

Module Contents

Functions

compareArrays(→ dict)

Compute element-wise percent difference between A and B

areArraysClose(→ bool)

Compare to arrays element-wise and compute the percent difference.

compareMatStructs(→ dict)

For each field, not like __*__, walk the fields and compare the values.

isMeanWithinThreshold(→ bool)

Examine all ßmean stats in dictionary and compare to threshold value

compareMatFiles(→ dict)

Load both matlab files and call compareMatStructs.

pearsons_mean_corr(A, B)

Attributes

numpyAllNumCodes

StatsEqual

StatsNotEqual

rtCommon.validationUtils.numpyAllNumCodes
rtCommon.validationUtils.StatsEqual
rtCommon.validationUtils.StatsNotEqual
rtCommon.validationUtils.compareArrays(A: numpy.ndarray, B: numpy.ndarray) dict

Compute element-wise percent difference between A and B Return the mean, max, stddev, histocounts, histobins in a Dict

rtCommon.validationUtils.areArraysClose(A: numpy.ndarray, B: numpy.ndarray, mean_limit=0.01, stddev_limit=1.0) bool

Compare to arrays element-wise and compute the percent difference. Return True if the mean and stddev are withing the supplied limits. Default limits:{mean: .01, stddev: 1.0}, i.e. no stddev limit by default

exception rtCommon.validationUtils.StructureMismatchError

Bases: ValueError

Inappropriate argument value (of correct type).

rtCommon.validationUtils.compareMatStructs(A: rtCommon.structDict.MatlabStructDict, B: rtCommon.structDict.MatlabStructDict, field_list=None) dict

For each field, not like __*__, walk the fields and compare the values. If a field is missing from one of the structs raise an exception. If field_list is supplied, then only compare those fields. Return a dict with {fieldname: stat_results}.

rtCommon.validationUtils.isMeanWithinThreshold(cmpStats: dict, threshold: float) bool

Examine all ßmean stats in dictionary and compare to threshold value

rtCommon.validationUtils.compareMatFiles(filename1: str, filename2: str) dict

Load both matlab files and call compareMatStructs. Inspect the resulting stats_result to see if any mean is beyond some threshold. Also print out the stats results. Return the result stats.

rtCommon.validationUtils.pearsons_mean_corr(A: numpy.ndarray, B: numpy.ndarray)