Adds normaliser
Some checks failed
gitea-physics/pdme/pipeline/head There was a failure building this commit
Some checks failed
gitea-physics/pdme/pipeline/head There was a failure building this commit
This commit is contained in:
parent
778361bece
commit
a07d51b5e3
@ -1,11 +1,13 @@
|
|||||||
import numpy
|
import numpy
|
||||||
import operator
|
import operator
|
||||||
|
import logging
|
||||||
|
|
||||||
|
|
||||||
# flips px, py, pz
|
# flips px, py, pz
|
||||||
SIGN_ARRAY_7 = numpy.array((-1, -1, -1, 1, 1, 1, 1))
|
SIGN_ARRAY_7 = numpy.array((-1, -1, -1, 1, 1, 1, 1))
|
||||||
SIGN_ARRAY_4 = numpy.array((-1, 1, 1, 1))
|
SIGN_ARRAY_4 = numpy.array((-1, 1, 1, 1))
|
||||||
|
|
||||||
|
|
||||||
def flip_chunk_to_positive_px(pt: numpy.ndarray) -> numpy.ndarray:
|
def flip_chunk_to_positive_px(pt: numpy.ndarray) -> numpy.ndarray:
|
||||||
if pt[0] > 0:
|
if pt[0] > 0:
|
||||||
return pt
|
return pt
|
||||||
@ -15,6 +17,9 @@ def flip_chunk_to_positive_px(pt: numpy.ndarray) -> numpy.ndarray:
|
|||||||
return SIGN_ARRAY_7 * pt
|
return SIGN_ARRAY_7 * pt
|
||||||
elif len(pt) == 4:
|
elif len(pt) == 4:
|
||||||
return SIGN_ARRAY_4 * pt
|
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:
|
def normalise_point_list(pts: numpy.ndarray, pt_length) -> numpy.ndarray:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user