Skip to content
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

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

rricesmith
Copy link

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.

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
Copy link
Collaborator

@cg-laser cg-laser left a 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.
@rricesmith
Copy link
Author

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.:
tol=1deg: [array([7]), array([0, 2]), array([1, 3]), array([4, 6]), array([5])]
tol=91deg: [array([7]), array([0, 2]), array([0, 1, 2, 3]), array([4, 6]), array([4, 5, 6])]

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])))
Copy link
Collaborator

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].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants