ATLAS Offline Software
Loading...
Searching...
No Matches
normphi.py
Go to the documentation of this file.
1# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
2
3#
4# File: normphi.py
5# Created: sss, 2004.
6# Purpose: Normalize an angle to within the range -pi...pi.
7#
8# This is intended for use only when the initial angle is already
9# close to being within the range.
10#
11
12
13from math import pi
14
15def normphi (phi):
16 """Normalize an angle to within the range -pi...pi.
17
18This is intended for use only when the initial angle is already
19close to being within the range.
20"""
21
22 while phi < -pi:
23 phi += 2*pi
24 while phi > pi:
25 phi -= 2*pi
26 return phi
27
28