hypernets_processor.data_io.normalize_360 module

hypernets_processor.data_io.normalize_360.normalizedeg(num, lower=0.0, upper=360.0, b=False)

Normalize number to range [lower, upper) or [lower, upper]. Parameters ———- num : float

The number to be normalized.

lowerfloat

Lower limit of range. Default is 0.0.

upperfloat

Upper limit of range. Default is 360.0.

bbool

Type of normalization. See notes.

Returns

nfloat

A number in the range [lower, upper) or [lower, upper].

Raises

ValueError

If lower >= upper.

Notes

If the keyword b == False, the default, then the normalization is done in the following way. Consider the numbers to be arranged in a circle, with the lower and upper marks sitting on top of each other. Moving past one limit, takes the number into the beginning of the other end. For example, if range is [0 - 360), then 361 becomes 1. Negative numbers move from higher to lower numbers. So, -1 normalized to [0 - 360) becomes 359. If the keyword b == True then the given number is considered to “bounce” between the two limits. So, -91 normalized to [-90, 90], becomes -89, instead of 89. In this case the range is [lower, upper]. This code is based on the function fmt_delta of TPM. Range must be symmetric about 0 or lower == 0.