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

Fix parallax definition convention. #84

Merged
merged 3 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
5 changes: 2 additions & 3 deletions romanisim/gaia.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,9 @@ def gaia2romanisimcat(gaiacat, date, refepoch=2016.0, boost_parallax=1,
newxyz = (
xyz + rahat * dt * radpermas * pmra + dechat * dt * radpermas * pmdec)
plx = gaiacat['parallax'].to(u.mas).value * boost_parallax
newxyz -= (rahat * earthcoord.dot(rahat) * plx / 2 * radpermas
+ dechat * earthcoord.dot(dechat) * plx / 2 * radpermas)
newxyz -= (rahat * earthcoord.dot(rahat) * plx * radpermas
+ dechat * earthcoord.dot(dechat) * plx * radpermas)
# stars move in the opposite direction of the earth -> minus sign
# divide by two: parallax is the diameter rather than radius of the circle
newunitspherical = coordinates.UnitSphericalRepresentation.from_cartesian(
coordinates.CartesianRepresentation(newxyz))
newra = newunitspherical.lon
Expand Down
4 changes: 2 additions & 2 deletions romanisim/tests/test_gaia.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ def test_gaia():
# first source doesn't move it first catalog since it's observed at its
# epoch and has zero parallax
assert cats[0][field][0] == fakegaiacat[field][0]
# max separation when pm = 0 should be roughly parallax / 2
# max separation when pm = 0 should be roughly parallax
pm0 = (fakegaiacat['pmra'] == 0) & (fakegaiacat['pmdec'] == 0)
assert np.all(np.abs(maxsep[pm0] - fakegaiacat['parallax'][pm0] / 2)
assert np.all(np.abs(maxsep[pm0] - fakegaiacat['parallax'][pm0])
<= fakegaiacat['parallax'][pm0] * 0.01)
# sources with zero pmra and plx never move
assert np.all(sep[:, -1] == 0 * u.deg)
Expand Down
Loading