diff --git a/swiftest/init_cond.py b/swiftest/init_cond.py index 30b292d5e..0c57ddecf 100644 --- a/swiftest/init_cond.py +++ b/swiftest/init_cond.py @@ -140,11 +140,13 @@ def get_rotrate(raw_response): def get_rotpole(jpl): RA = jpl.ephemerides()['NPole_RA'][0] DEC = jpl.ephemerides()['NPole_DEC'][0] + if np.ma.is_masked(RA) or np.ma.is_masked(DEC): return np.array([0.0,0.0,1.0]) - rotpole = SkyCoord(ra=RA * u.degree, dec=DEC * u.degree).cartesian + rotpole = SkyCoord(ra=RA * u.degree, dec=DEC * u.degree,frame='icrs').transform_to('barycentricmeanecliptic').cartesian + return np.array([rotpole.x.value, rotpole.y.value, rotpole.z.value]) if type(altid) != list: diff --git a/swiftest/tool.py b/swiftest/tool.py index c275eff86..159e45b5b 100644 --- a/swiftest/tool.py +++ b/swiftest/tool.py @@ -550,7 +550,7 @@ def rotate_to_vector(ds, new_pole, skip_vars=['space','Ip']): original_vector = unit_pole.reshape(1, 3) # Use align_vectors to get the rotation that aligns the z-axis with Mars_rot - rotation, _ = R.align_vectors(target_vector, original_vector.reshape(1, 3)) + rotation, _ = R.align_vectors(target_vector, original_vector) # Define a function to apply the rotation, which will be used with apply_ufunc def apply_rotation(vector, rotation):