1616from .galactocentric import Galactocentric
1717from .icrs import ICRS
1818from coordinax ._src .distances import Distance
19- from coordinax ._src .operators import (
20- GalileanRotation ,
21- GalileanSpatialTranslation ,
22- Identity ,
23- Pipe ,
24- VelocityBoost ,
25- simplify_op ,
26- )
19+ from coordinax ._src .operators import Add , Identity , Pipe , Rotate , simplify
2720
2821ScalarAngle : TypeAlias = Shaped [u .Quantity ["angle" ] | u .Angle , "" ]
2922RotationMatrix : TypeAlias = Shaped [Array , "3 3" ]
@@ -54,7 +47,7 @@ def frame_transform_op(
5447
5548 >>> @dispatch
5649 ... def frame_transform_op(from_frame: MySpaceFrame, to_frame: ICRS, /) -> cx.ops.AbstractOperator:
57- ... return cx.ops.GalileanRotation .from_euler("z", u.Quantity(10, "deg"))
50+ ... return cx.ops.Rotate .from_euler("z", u.Quantity(10, "deg"))
5851
5952 We can transform from `MySpaceFrame` to a Galacocentric frame, even though
6053 we don't have a direct transformation defined:
@@ -65,15 +58,15 @@ def frame_transform_op(
6558 >>> op = cx.frames.frame_transform_op(my_frame, gcf_frame)
6659 >>> op
6760 Pipe((
68- GalileanRotation (rotation=f32[3,3]),
61+ Rotate (rotation=f32[3,3]),
6962 ...
7063 ))
7164
7265 """ # noqa: E501
7366 fromframe_to_icrs = frame_transform_op (from_frame , _icrs_frame )
7467 icrs_to_toframe = frame_transform_op (_icrs_frame , to_frame )
7568 pipe = fromframe_to_icrs | icrs_to_toframe
76- return simplify_op (pipe )
69+ return simplify (pipe )
7770
7871
7972# ---------------------------------------------------------------
@@ -116,22 +109,22 @@ def frame_transform_op(from_frame: Galactocentric, to_frame: Galactocentric, /)
116109 >>> frame_op2 = cxf.frame_transform_op(gcf_frame, gcf_frame2)
117110 >>> frame_op2
118111 Pipe((
119- VelocityBoost (CartesianVel3D( ... )),
120- GalileanRotation (rotation=f32[3,3]),
121- GalileanSpatialTranslation (CartesianPos3D( ... )),
122- GalileanRotation (rotation=f32[3,3]),
123- GalileanRotation (rotation=f32[3,3]),
124- GalileanSpatialTranslation (CartesianPos3D( ... )),
125- GalileanRotation (rotation=f32[3,3]),
126- VelocityBoost (CartesianVel3D( ... ))
112+ Add (CartesianVel3D( ... )),
113+ Rotate (rotation=f32[3,3]),
114+ Add (CartesianPos3D( ... )),
115+ Rotate (rotation=f32[3,3]),
116+ Rotate (rotation=f32[3,3]),
117+ Add (CartesianPos3D( ... )),
118+ Rotate (rotation=f32[3,3]),
119+ Add (CartesianVel3D( ... ))
127120 ))
128121
129122 """
130123 if from_frame == to_frame :
131124 return Pipe ((Identity (),))
132125
133126 # TODO: not go through ICRS for the self-transformation
134- return simplify_op (
127+ return simplify (
135128 frame_transform_op (from_frame , ICRS ()) | frame_transform_op (ICRS (), to_frame )
136129 )
137130
@@ -193,10 +186,10 @@ def frame_transform_op(from_frame: ICRS, to_frame: Galactocentric, /) -> Pipe:
193186 >>> frame_op = cx.frames.frame_transform_op(icrs_frame, gcf_frame)
194187 >>> frame_op
195188 Pipe((
196- GalileanRotation (rotation=f32[3,3]),
197- GalileanSpatialTranslation (CartesianPos3D( ... )),
198- GalileanRotation (rotation=f32[3,3]),
199- VelocityBoost (CartesianVel3D( ... ))
189+ Rotate (rotation=f32[3,3]),
190+ Add (CartesianPos3D( ... )),
191+ Rotate (rotation=f32[3,3]),
192+ Add (CartesianVel3D( ... ))
200193 ))
201194
202195 Apply the transformation:
@@ -238,25 +231,23 @@ def frame_transform_op(from_frame: ICRS, to_frame: Galactocentric, /) -> Pipe:
238231
239232 """ # noqa: E501
240233 # rotation matrix to align x(ICRS) with the vector to the Galactic center
241- rot_lat = GalileanRotation .from_euler ("y" , to_frame .galcen .lat )
242- rot_lon = GalileanRotation .from_euler ("z" , - to_frame .galcen .lon )
234+ rot_lat = Rotate .from_euler ("y" , to_frame .galcen .lat )
235+ rot_lon = Rotate .from_euler ("z" , - to_frame .galcen .lon )
243236 # extra roll away from the Galactic x-z plane
244- roll = GalileanRotation .from_euler ("x" , to_frame .roll - to_frame .roll0 )
237+ roll = Rotate .from_euler ("x" , to_frame .roll - to_frame .roll0 )
245238 # construct transformation matrix
246239 R = (roll @ rot_lat @ rot_lon ).simplify ()
247240
248241 # Translation by Sun-Galactic center distance around x' and rotate about y'
249242 # to account for tilt due to Sun's height above the plane
250243 z_d = u .ustrip ("" , to_frame .z_sun / to_frame .galcen .distance ) # [radian]
251- H = GalileanRotation .from_euler ("y" , u .Quantity (jnp .asin (z_d ), "rad" ))
244+ H = Rotate .from_euler ("y" , u .Quantity (jnp .asin (z_d ), "rad" ))
252245
253246 # Post-rotation spatial offset to Galactic center.
254- offset_q = GalileanSpatialTranslation (
255- - to_frame .galcen .distance * jnp .asarray ([1 , 0 , 0 ])
256- )
247+ offset_q = Add (- to_frame .galcen .distance * jnp .asarray ([1 , 0 , 0 ]))
257248
258249 # Post-rotation velocity offset
259- offset_v = VelocityBoost (to_frame .galcen_v_sun )
250+ offset_v = Add (to_frame .galcen_v_sun )
260251
261252 # Total Operator
262253 return R | offset_q | H | offset_v
0 commit comments