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

Bug in calc_frame_pos_angle function #1514

Open
pragyachawla opened this issue Jan 8, 2025 · 0 comments · May be fixed by #1515
Open

Bug in calc_frame_pos_angle function #1514

pragyachawla opened this issue Jan 8, 2025 · 0 comments · May be fixed by #1515

Comments

@pragyachawla
Copy link

While reading a measurement set using the from_file function, I get the following error message:

File /opt/conda/lib/python3.11/site-packages/pyuvdata/utils/phasing.py:1669, in calc_frame_pos_angle(time_array, app_ra, app_dec, telescope_loc, ref_frame, ref_epoch, telescope_frame, ellipsoid, offset_pos)
   1664 up_ra[up_dec > (np.pi / 2.0)] = np.mod(
   1665     up_ra[up_dec > (np.pi / 2.0)] + np.pi, 2.0 * np.pi
   1666 )
   1667 up_dec[up_dec > (np.pi / 2.0)] = np.pi - up_dec[up_dec > (np.pi / 2.0)]
-> 1669 dn_ra[-dn_dec > (np.pi / 2.0)] = np.mod(
   1670     dn_ra[dn_dec > (np.pi / 2.0)] + np.pi, 2.0 * np.pi
   1671 )
   1672 dn_dec[-dn_dec > (np.pi / 2.0)] = np.pi - dn_dec[-dn_dec > (np.pi / 2.0)]
ValueError: NumPy boolean array indexing assignment cannot assign 0 input values to the 705 output values where the mask is true

The from_file function is calling the calc_frame_pos_angle function in utils/phasing.py. Line 1670 in utils/phasing.py seems to have a bug in that the minus sign before dn_dec is missing. As far as I understand it, lines 1669 and 1670 should instead be:

dn_ra[-dn_dec > (np.pi / 2.0)] = np.mod(
    dn_ra[-dn_dec > (np.pi / 2.0)] + np.pi, 2.0 * np.pi)
telegraphic added a commit that referenced this issue Jan 9, 2025
@telegraphic telegraphic linked a pull request Jan 9, 2025 that will close this issue
11 tasks
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 a pull request may close this issue.

1 participant