Adds normaliser
Some checks failed
gitea-physics/pdme/pipeline/head There was a failure building this commit

This commit is contained in:
Deepak Mallubhotla 2022-01-17 01:31:36 -06:00
parent 778361bece
commit a07d51b5e3
Signed by: deepak
GPG Key ID: 64BF53A3369104E7

View File

@ -1,11 +1,13 @@
import numpy
import operator
import logging
# flips px, py, pz
SIGN_ARRAY_7 = numpy.array((-1, -1, -1, 1, 1, 1, 1))
SIGN_ARRAY_4 = numpy.array((-1, 1, 1, 1))
def flip_chunk_to_positive_px(pt: numpy.ndarray) -> numpy.ndarray:
if pt[0] > 0:
return pt
@ -15,6 +17,9 @@ def flip_chunk_to_positive_px(pt: numpy.ndarray) -> numpy.ndarray:
return SIGN_ARRAY_7 * pt
elif len(pt) == 4:
return SIGN_ARRAY_4 * pt
else:
logging.warning(f"Could not normalise pt: {pt}. Returning as is...")
return pt
def normalise_point_list(pts: numpy.ndarray, pt_length) -> numpy.ndarray: