8000 Set to use nominal roll range 0-360 by jeanconn · Pull Request #34 · sot/ska_sun · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Set to use nominal roll range 0-360 #34

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

Merged
merged 3 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ default_language_version:

repos:
- repo: https://github.com/psf/black
rev: 23.7.0
rev: 23.9.1
hooks:
- id: black

Expand Down
6 changes: 5 additions & 1 deletion ska_sun/sun.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ def nominal_roll(ra, dec, time=None, sun_ra=None, sun_dec=None):
:param sun_ra: Sun right ascension (instead of ``time``)
:param sun_dec: Sun declination (instead of ``time``)

:returns: nominal roll angle (deg)
:returns: nominal roll angle (deg) in 0-360 range

"""
if time is not None:
Expand All @@ -399,6 +399,10 @@ def _nominal_roll(ra, dec, sun_ra, sun_dec):
np.sum(body_z**2)
) # shouldn't be needed but do it anyway
roll = np.degrees(np.arctan2(body_y[2], body_z[2]))

# Convert to 0-360 range (arctan2 is -pi to pi)
roll = roll % 360

return roll


Expand Down
5 changes: 5 additions & 0 deletions ska_sun/tests/test_sun.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ def test_nominal_roll():
assert np.allclose(roll, 68.83020) # vs. 68.80 for obsid 12393 in JAN1711A


def test_nominal_roll_range():
roll = nominal_roll(0, 89.9, time="2019:006:12:00:00")
assert np.allclose(roll, 287.24879) # range in 0-360 and value for sparkles test


def test_off_nominal_roll_and_pitch():
att = (198.392135, 36.594359, 33.983322) # RA, Dec, Roll of obsid 16354
oroll = off_nominal_roll(att, "2015:335:00:00:00") # NOT the 16354 time
Expand Down
0