-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added tolerance to parallel channels #634
base: develop
Are you sure you want to change the base?
Conversation
Modifications to function get_parallel_channels: -Fixed bug where it attempted to save differently sized numpy arrays into a single array, causing an error -Removed repeats of parallel or individual channels from being returned -Added a tolerance parameter, which allows for there to be deviation in parallel channels and still be counted as parallel. Necessary for detector descriptions of real experiments whose antennas may deviate by a few degrees
Added tolernace to determining parallel channels
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is an improvement but not yet doing what it should.
E.g. if one angle is 0.1deg and the other 359.9, the difference is 359.8. Or in other words, the periodicity needs to be taken into account.
The other thing is the restriction to 180deg interval for the rotation angle. Antennas can be anti-parallel which makes a difference (the trace is inverted, i.e. multiplied with -1). I would make it optional to return also anti-parallel channels or not.
-Added helper function for finding tolerance within periodicity of angles -Removed case where an antenna could be parallel in one orientation, but not another, resulting in a repeat of the channel. Ie before, it could return [[0, 1], [0]]. Now it only returns at minimum pairs, unless the channel is not parallel to any other channels.
Updated to account for the periodicity of the angles. Also included an option for anti-parallel. Example using a sample detector, with 0-3 standard downward LPDAs, 4-6 are standard upward with the 4th LPDA removed, and ch7 is a bicone.: There are repeated channels still in some cases. This existed in the old version of this function, and I believe causes no issues with modules that use this. It might be preferred, as I believe this happens because we have 4 axis of rotation, and its possible that given a set of 3 orientations (a, b & c), that [a,b] can be parallel within tolerance, and [b, c] can be, but [a, c] cannot be. |
def angle_diff(a, b, anti_parallel=False): | ||
if anti_parallel: | ||
return np.abs(hp.get_normalized_angle(a - b, interval=np.deg2rad([0, 90]))) | ||
return np.abs(hp.get_normalized_angle(a - b, interval=np.deg2rad([0, 180]))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the intervals need to be [-90, 90] and [-180,180].
Modifications to function get_parallel_channels:
-Fixed bug where it attempted to save differently sized numpy arrays into a single array, causing an error
-Removed repeats of parallel or individual channels from being returned
-Added a tolerance parameter, which allows for there to be deviation in parallel channels and still be counted as parallel. Necessary for detector descriptions of real experiments whose antennas may deviate by a few degrees.