@@ -209,7 +209,8 @@ def pt_map(
209209 True
210210
211211 """
212- del from_chart , to_chart , usys # unused
212+ del usys # unused
213+ assert from_chart .M == to_chart .M # noqa: S101
213214 return p
214215
215216
@@ -283,7 +284,8 @@ def pt_map(
283284 {'x': 5.0}
284285
285286 """
286- del to_chart , from_chart , usys # unused
287+ del usys # unused
288+ assert from_chart .M == to_chart .M # noqa: S101
287289 return {"x" : p ["r" ]}
288290
289291
@@ -313,7 +315,8 @@ def pt_map(
313315 {'r': 5.0}
314316
315317 """
316- del to_chart , from_chart , usys # unused
318+ del usys # unused
319+ assert from_chart .M == to_chart .M # noqa: S101
317320 return {"r" : p ["x" ]}
318321
319322
@@ -346,7 +349,7 @@ def pt_map(
346349 'y': Array(5., dtype=float64, ...)}
347350
348351 """
349- del to_chart , from_chart # unused
352+ assert from_chart . M == to_chart . M # noqa: S101
350353 theta = uconvert_to_rad (p ["theta" ], usys )
351354 x = p ["r" ] * jnp .cos (theta )
352355 y = p ["r" ] * jnp .sin (theta )
@@ -377,7 +380,8 @@ def pt_map(
377380 'theta': Array(0.92729522, dtype=float64, ...)}
378381
379382 """
380- del to_chart , from_chart , usys # unused
383+ del usys # unused
384+ assert from_chart .M == to_chart .M # noqa: S101
381385 r_ = jnp .hypot (p ["x" ], p ["y" ])
382386 theta = jnp .arctan2 (p ["y" ], p ["x" ])
383387 return {"r" : r_ , "theta" : theta }
@@ -409,7 +413,7 @@ def pt_map(
409413 'z': 2.0}
410414
411415 """
412- del to_chart , from_chart # unused
416+ assert from_chart . M == to_chart . M # noqa: S101
413417 phi = uconvert_to_rad (p ["phi" ], usys )
414418 x = p ["rho" ] * jnp .cos (phi )
415419 y = p ["rho" ] * jnp .sin (phi )
@@ -444,7 +448,7 @@ def pt_map(
444448 'z': Array(1.2246468e-16, dtype=float64, ...)}
445449
446450 """
447- del to_chart , from_chart # unused
451+ assert from_chart . M == to_chart . M # noqa: S101
448452 r_ = p ["r" ]
449453 theta = uconvert_to_rad (p ["theta" ], usys )
450454 phi = uconvert_to_rad (p ["phi" ], usys )
@@ -485,7 +489,7 @@ def pt_map(
485489 'z': Array(0., dtype=float64, ...)}
486490
487491 """
488- del to_chart , from_chart # unused
492+ assert from_chart . M == to_chart . M # noqa: S101
489493 r_ = p ["distance" ]
490494 lon = uconvert_to_rad (p ["lon" ], usys )
491495 lat = uconvert_to_rad (p ["lat" ], usys )
@@ -529,7 +533,7 @@ def pt_map(
529533 {'x': Q(1.2246468e-16, 'm'), 'y': Q(0., 'm'), 'z': Q(2., 'm')}
530534
531535 """
532- del to_chart , from_chart # unused
536+ assert from_chart . M == to_chart . M # noqa: S101
533537 lon_coslat , r_ = p ["lon_coslat" ], p ["distance" ]
534538 lat = uconvert_to_rad (p ["lat" ], usys )
535539 # Handle the poles where cos(lat) == 0
@@ -570,7 +574,7 @@ def pt_map(
570574 {'x': Q(2., 'm'), 'y': Q(0., 'm'), 'z': Q(1.2246468e-16, 'm')}
571575
572576 """
573- del to_chart , from_chart # unused
577+ assert from_chart . M == to_chart . M # noqa: S101
574578 r_ = p ["r" ]
575579 theta = uconvert_to_rad (p ["theta" ], usys )
576580 phi = uconvert_to_rad (p ["phi" ], usys )
@@ -621,7 +625,7 @@ def pt_map(
621625 'z': Array(1.11803399, dtype=float64)}
622626
623627 """
624- del to_chart
628+ assert from_chart . M == to_chart . M # noqa: S101
625629 # Calculate cylindrical distance
626630 nu , mu = p ["nu" ], p ["mu" ]
627631 if not isinstance (nu , ABCQ ) or not isinstance (mu , ABCQ ):
@@ -667,7 +671,8 @@ def pt_map(
667671 'z': 5.0}
668672
669673 """
670- del to_chart , from_chart , usys # Unused
674+ del usys # Unused
675+ assert from_chart .M == to_chart .M # noqa: S101
671676 rho = jnp .hypot (p ["x" ], p ["y" ])
672677 phi = jnp .atan2 (p ["y" ], p ["x" ])
673678 return {"rho" : rho , "phi" : phi , "z" : p ["z" ]}
@@ -736,7 +741,7 @@ def pt_map(
736741 'phi': Array(0., dtype=float64, ...)}
737742
738743 """
739- del to_chart , from_chart # unused
744+ assert from_chart . M == to_chart . M # noqa: S101
740745 x , y , z = p ["x" ], p ["y" ], p ["z" ]
741746 r = jnp .sqrt (x ** 2 + y ** 2 + z ** 2 )
742747 # Avoid division by zero: when r == 0, set theta = 0 by convention
@@ -776,7 +781,7 @@ def pt_map(
776781 'phi': 0}
777782
778783 """
779- del to_chart , from_chart # unused
784+ assert from_chart . M == to_chart . M # noqa: S101
780785 r_ = jnp .hypot (p ["rho" ], p ["z" ])
781786 # Avoid division by zero: when r == 0, set theta = 0 by convention
782787 theta = jnp .acos (jnp .where (r_ == 0 , jnp .ones (r_ .shape ), p ["z" ] / r_ ))
@@ -814,7 +819,7 @@ def pt_map(
814819 'z': Array(1.2246468e-16, dtype=float64, ...)}
815820
816821 """
817- del to_chart , from_chart # unused
822+ assert from_chart . M == to_chart . M # noqa: S101
818823 theta = uconvert_to_rad (p ["theta" ], usys )
819824 rho = p ["r" ] * jnp .sin (theta )
820825 z = p ["r" ] * jnp .cos (theta )
@@ -849,7 +854,7 @@ def pt_map(
849854 {'lon': 0, 'lat': 1.5707963267948966, 'distance': 1.0}
850855
851856 """
852- del to_chart , from_chart # unused
857+ assert from_chart . M == to_chart . M # noqa: S101
853858 lat = (
854859 u .Q (90 , "deg" ) if isinstance (p ["theta" ], ABCQ ) else jnp .pi / 2
855860 ) - uconvert_to_rad (p ["theta" ], usys )
@@ -886,7 +891,7 @@ def pt_map(
886891 'lat': 1.5707963267948966, 'distance': 1.0}
887892
888893 """
889- del to_chart , from_chart # unused
894+ assert from_chart . M == to_chart . M # noqa: S101
890895 lat = (
891896 u .Q (90 , "deg" ) if isinstance (p ["theta" ], ABCQ ) else jnp .pi / 2
892897 ) - uconvert_to_rad (p ["theta" ], usys )
@@ -922,7 +927,8 @@ def pt_map(
922927 {'r': 1.0, 'theta': 60, 'phi': 30}
923928
924929 """
925- del to_chart , from_chart , usys # Unused
930+ del usys # Unused
931+ assert from_chart .M == to_chart .M # noqa: S101
926932 return {"r" : p ["r" ], "theta" : p ["phi" ], "phi" : p ["theta" ]}
927933
928934
@@ -954,7 +960,8 @@ def pt_map(
954960 {'r': 1.0, 'theta': 30, 'phi': 60}
955961
956962 """
957- del to_chart , from_chart , usys # Unused
963+ del usys # Unused
964+ assert from_chart .M == to_chart .M # noqa: S101
958965 return {"r" : p ["r" ], "theta" : p ["phi" ], "phi" : p ["theta" ]}
959966
960967
@@ -999,7 +1006,7 @@ def pt_map(
9991006 'z': Array(1.11803399, dtype=float64)}
10001007
10011008 """
1002- del to_chart # Unused
1009+ assert from_chart . M == to_chart . M # noqa: S101
10031010 nu , mu = p ["nu" ], p ["mu" ]
10041011 if not isinstance (nu , ABCQ ) or not isinstance (mu , ABCQ ):
10051012 if usys is None :
@@ -1068,7 +1075,7 @@ def pt_map(
10681075 'nu': Array(2.47920271, dtype=float64), 'phi': 0}
10691076
10701077 """
1071- del from_chart # Unused
1078+ assert from_chart . M == to_chart . M # noqa: S101
10721079 # Pre-compute common terms
10731080 R2 = p ["rho" ] ** 2
10741081 z2 = p ["z" ] ** 2
@@ -1156,6 +1163,7 @@ def pt_map(
11561163 'phi': Q(0., 'rad')}
11571164
11581165 """
1166+ assert from_chart .M == to_chart .M # noqa: S101
11591167 # Cast to the result type
11601168 dtype = jnp .result_type (
11611169 to_chart .Delta , from_chart .Delta , * [v .dtype for v in p .values ()]
@@ -1220,7 +1228,7 @@ def pt_map(
12201228 {'x': Q(1., 'm'), 'y': Q(2., 'm'), 'z': Q(3., 'm')}
12211229
12221230 """
1223- del from_chart # Unused
1231+ # assert from_chart.M == to_chart.M # TODO: CartND manifold
12241232
12251233 # If target is CartND, we can't convert (would be infinite recursion)
12261234 if isinstance (to_chart , CartND ):
@@ -1304,7 +1312,7 @@ def pt_map(
13041312 {'q': Q([0., 0., 5.], 'm')}
13051313
13061314 """
1307- del to_chart # Unused
1315+ # assert from_chart.M == to_chart.M # TODO: CartND manifold
13081316
13091317 # If source is CartND, we can't convert (would be infinite recursion)
13101318 if isinstance (from_chart , CartND ):
@@ -1392,7 +1400,8 @@ def pt_map(
13921400 True
13931401
13941402 """
1395- del to_chart , from_chart , usys # Unused
1403+ del usys # Unused
1404+ assert from_chart .M == to_chart .M # noqa: S101
13961405 return q
13971406
13981407
0 commit comments