imt-ring 1.3.5__tar.gz → 1.3.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. {imt_ring-1.3.5 → imt_ring-1.3.7}/PKG-INFO +1 -1
  2. {imt_ring-1.3.5 → imt_ring-1.3.7}/pyproject.toml +1 -1
  3. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/imt_ring.egg-info/PKG-INFO +1 -1
  4. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/algorithms/custom_joints/suntay.py +16 -1
  5. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/algorithms/generator/base.py +4 -1
  6. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/algorithms/sensors.py +3 -6
  7. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/base.py +2 -1
  8. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/ml/train.py +8 -6
  9. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/utils/utils.py +2 -0
  10. {imt_ring-1.3.5 → imt_ring-1.3.7}/tests/test_custom_joints.py +18 -10
  11. {imt_ring-1.3.5 → imt_ring-1.3.7}/tests/test_random.py +21 -14
  12. {imt_ring-1.3.5 → imt_ring-1.3.7}/readme.md +0 -0
  13. {imt_ring-1.3.5 → imt_ring-1.3.7}/setup.cfg +0 -0
  14. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/imt_ring.egg-info/SOURCES.txt +0 -0
  15. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/imt_ring.egg-info/dependency_links.txt +0 -0
  16. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/imt_ring.egg-info/requires.txt +0 -0
  17. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/imt_ring.egg-info/top_level.txt +0 -0
  18. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/__init__.py +0 -0
  19. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/algebra.py +0 -0
  20. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/algorithms/__init__.py +0 -0
  21. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/algorithms/_random.py +0 -0
  22. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/algorithms/custom_joints/__init__.py +0 -0
  23. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/algorithms/custom_joints/rr_imp_joint.py +0 -0
  24. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/algorithms/custom_joints/rr_joint.py +0 -0
  25. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/algorithms/dynamics.py +0 -0
  26. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/algorithms/generator/__init__.py +0 -0
  27. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/algorithms/generator/batch.py +0 -0
  28. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/algorithms/generator/motion_artifacts.py +0 -0
  29. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/algorithms/generator/pd_control.py +0 -0
  30. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/algorithms/generator/randomize.py +0 -0
  31. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/algorithms/generator/transforms.py +0 -0
  32. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/algorithms/generator/types.py +0 -0
  33. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/algorithms/jcalc.py +0 -0
  34. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/algorithms/kinematics.py +0 -0
  35. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/io/__init__.py +0 -0
  36. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/io/examples/branched.xml +0 -0
  37. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/io/examples/exclude/knee_trans_dof.xml +0 -0
  38. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/io/examples/exclude/standard_sys.xml +0 -0
  39. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/io/examples/exclude/standard_sys_rr_imp.xml +0 -0
  40. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/io/examples/inv_pendulum.xml +0 -0
  41. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/io/examples/knee_flexible_imus.xml +0 -0
  42. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/io/examples/spherical_stiff.xml +0 -0
  43. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/io/examples/symmetric.xml +0 -0
  44. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/io/examples/test_all_1.xml +0 -0
  45. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/io/examples/test_all_2.xml +0 -0
  46. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/io/examples/test_ang0_pos0.xml +0 -0
  47. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/io/examples/test_control.xml +0 -0
  48. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/io/examples/test_double_pendulum.xml +0 -0
  49. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/io/examples/test_free.xml +0 -0
  50. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/io/examples/test_kinematics.xml +0 -0
  51. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/io/examples/test_morph_system/four_seg_seg1.xml +0 -0
  52. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/io/examples/test_morph_system/four_seg_seg3.xml +0 -0
  53. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/io/examples/test_randomize_position.xml +0 -0
  54. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/io/examples/test_sensors.xml +0 -0
  55. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/io/examples/test_three_seg_seg2.xml +0 -0
  56. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/io/examples.py +0 -0
  57. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/io/test_examples.py +0 -0
  58. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/io/xml/__init__.py +0 -0
  59. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/io/xml/abstract.py +0 -0
  60. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/io/xml/from_xml.py +0 -0
  61. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/io/xml/test_from_xml.py +0 -0
  62. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/io/xml/test_to_xml.py +0 -0
  63. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/io/xml/to_xml.py +0 -0
  64. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/maths.py +0 -0
  65. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/ml/__init__.py +0 -0
  66. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/ml/base.py +0 -0
  67. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/ml/callbacks.py +0 -0
  68. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/ml/ml_utils.py +0 -0
  69. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/ml/optimizer.py +0 -0
  70. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/ml/params/0x13e3518065c21cd8.pickle +0 -0
  71. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/ml/ringnet.py +0 -0
  72. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/ml/training_loop.py +0 -0
  73. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/rendering/__init__.py +0 -0
  74. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/rendering/base_render.py +0 -0
  75. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/rendering/mujoco_render.py +0 -0
  76. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/rendering/vispy_render.py +0 -0
  77. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/rendering/vispy_visuals.py +0 -0
  78. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/sim2real/__init__.py +0 -0
  79. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/sim2real/sim2real.py +0 -0
  80. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/spatial.py +0 -0
  81. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/sys_composer/__init__.py +0 -0
  82. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/sys_composer/delete_sys.py +0 -0
  83. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/sys_composer/inject_sys.py +0 -0
  84. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/sys_composer/morph_sys.py +0 -0
  85. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/utils/__init__.py +0 -0
  86. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/utils/batchsize.py +0 -0
  87. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/utils/colab.py +0 -0
  88. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/utils/hdf5.py +0 -0
  89. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/utils/normalizer.py +0 -0
  90. {imt_ring-1.3.5 → imt_ring-1.3.7}/src/ring/utils/path.py +0 -0
  91. {imt_ring-1.3.5 → imt_ring-1.3.7}/tests/test_algebra.py +0 -0
  92. {imt_ring-1.3.5 → imt_ring-1.3.7}/tests/test_base.py +0 -0
  93. {imt_ring-1.3.5 → imt_ring-1.3.7}/tests/test_dynamics.py +0 -0
  94. {imt_ring-1.3.5 → imt_ring-1.3.7}/tests/test_generator.py +0 -0
  95. {imt_ring-1.3.5 → imt_ring-1.3.7}/tests/test_jcalc.py +0 -0
  96. {imt_ring-1.3.5 → imt_ring-1.3.7}/tests/test_jit.py +0 -0
  97. {imt_ring-1.3.5 → imt_ring-1.3.7}/tests/test_kinematics.py +0 -0
  98. {imt_ring-1.3.5 → imt_ring-1.3.7}/tests/test_maths.py +0 -0
  99. {imt_ring-1.3.5 → imt_ring-1.3.7}/tests/test_ml_utils.py +0 -0
  100. {imt_ring-1.3.5 → imt_ring-1.3.7}/tests/test_motion_artifacts.py +0 -0
  101. {imt_ring-1.3.5 → imt_ring-1.3.7}/tests/test_pd_control.py +0 -0
  102. {imt_ring-1.3.5 → imt_ring-1.3.7}/tests/test_randomize.py +0 -0
  103. {imt_ring-1.3.5 → imt_ring-1.3.7}/tests/test_rcmg.py +0 -0
  104. {imt_ring-1.3.5 → imt_ring-1.3.7}/tests/test_render.py +0 -0
  105. {imt_ring-1.3.5 → imt_ring-1.3.7}/tests/test_sensors.py +0 -0
  106. {imt_ring-1.3.5 → imt_ring-1.3.7}/tests/test_sim2real.py +0 -0
  107. {imt_ring-1.3.5 → imt_ring-1.3.7}/tests/test_sys_composer.py +0 -0
  108. {imt_ring-1.3.5 → imt_ring-1.3.7}/tests/test_train.py +0 -0
  109. {imt_ring-1.3.5 → imt_ring-1.3.7}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: imt-ring
3
- Version: 1.3.5
3
+ Version: 1.3.7
4
4
  Summary: RING: Recurrent Inertial Graph-based Estimator
5
5
  Author-email: Simon Bachhuber <simon.bachhuber@fau.de>
6
6
  Project-URL: Homepage, https://github.com/SimiPixel/ring
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "imt-ring"
7
- version = "1.3.5"
7
+ version = "1.3.7"
8
8
  authors = [
9
9
  { name="Simon Bachhuber", email="simon.bachhuber@fau.de" },
10
10
  ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: imt-ring
3
- Version: 1.3.5
3
+ Version: 1.3.7
4
4
  Summary: RING: Recurrent Inertial Graph-based Estimator
5
5
  Author-email: Simon Bachhuber <simon.bachhuber@fau.de>
6
6
  Project-URL: Homepage, https://github.com/SimiPixel/ring
@@ -293,12 +293,25 @@ def register_suntay(sconfig: SuntayConfig, name: str = "suntay"):
293
293
  ring.register_new_joint_type(name, joint_model, 1, overwrite=True)
294
294
 
295
295
 
296
+ def _scale_delta(method: str, key, xs, mn, mx, amin, amax, **kwargs):
297
+ if method == "normal":
298
+ delta = jnp.clip(jax.random.normal(key) + 0.5, 1.0)
299
+ elif method == "uniform":
300
+ delta = 1 / (jax.random.uniform(key) + 1e-2)
301
+ else:
302
+ raise NotImplementedError
303
+
304
+ return delta
305
+
306
+
296
307
  def Polynomial_DrawnFnPair(
297
308
  order: int = 2,
298
309
  center: bool = False,
299
310
  flexion_center_deg: Optional[float] = None,
300
311
  include_bias: bool = True,
301
312
  enable_scale_delta: bool = True,
313
+ scale_delta_method: str = "normal",
314
+ scale_delta_kwargs: dict = dict(),
302
315
  ) -> DrawnFnPairFactory:
303
316
  assert not (order == 0 and not include_bias)
304
317
 
@@ -343,7 +356,9 @@ def Polynomial_DrawnFnPair(
343
356
  amin, amax = jnp.min(values), jnp.max(values) + eps
344
357
  if enable_scale_delta:
345
358
  delta = amax - amin
346
- scale_delta = jnp.clip(jax.random.normal(c3) + 0.5, 1.0)
359
+ scale_delta = _scale_delta(
360
+ scale_delta_method, c3, xs, mn, mx, amin, amax, **scale_delta_kwargs
361
+ )
347
362
  amax = amin + delta * scale_delta
348
363
  return amin, amax, poly_factors, q0
349
364
 
@@ -140,8 +140,11 @@ class RCMG:
140
140
  batchsize: int = 1,
141
141
  sizes: int | list[int] = 1,
142
142
  seed: int = 1,
143
+ shuffle: bool = True,
143
144
  ) -> types.BatchedGenerator:
144
- return batch.batch_generators_eager(self.gens, sizes, batchsize, seed=seed)
145
+ return batch.batch_generators_eager(
146
+ self.gens, sizes, batchsize, seed=seed, shuffle=shuffle
147
+ )
145
148
 
146
149
  def to_lazy_gen(
147
150
  self, sizes: int | list[int] = 1, jit: bool = True
@@ -3,6 +3,7 @@ from typing import Optional
3
3
 
4
4
  import jax
5
5
  import jax.numpy as jnp
6
+
6
7
  from ring import algebra
7
8
  from ring import algorithms
8
9
  from ring import base
@@ -445,22 +446,18 @@ def _joint_axes_from_xs(sys, xs, sys_xs):
445
446
 
446
447
  def _joint_axes_from_sys(sys: base.Transform, N: int) -> dict:
447
448
  "`sys` should be `sys_noimu`. `N` is number of timesteps"
448
- xaxis = jnp.array([1.0, 0, 0])
449
- yaxis = jnp.array([0.0, 1, 0])
450
- zaxis = jnp.array([0.0, 0, 1])
451
- id_to_axis = {"x": xaxis, "y": yaxis, "z": zaxis}
452
449
  X = {}
453
450
 
454
451
  def f(_, __, name, link_type, link):
455
452
  joint_params = link.joint_params
456
453
  if link_type in ["rx", "ry", "rz"]:
457
- joint_axes = id_to_axis[link_type[1]]
454
+ joint_axes = maths.unit_vectors(link_type[1])
458
455
  elif link_type == "rr":
459
456
  joint_axes = joint_params["rr"]["joint_axes"]
460
457
  elif link_type[:6] == "rr_imp":
461
458
  joint_axes = joint_params[link_type]["joint_axes"]
462
459
  else:
463
- joint_axes = xaxis
460
+ joint_axes = maths.x_unit_vector
464
461
  X[name] = {"joint_axes": joint_axes}
465
462
 
466
463
  sys.scan(f, "lll", sys.link_names, sys.link_types, sys.links)
@@ -571,6 +571,7 @@ class System(_Base):
571
571
  new_damp: Optional[jax.Array] = None,
572
572
  new_stif: Optional[jax.Array] = None,
573
573
  new_zero: Optional[jax.Array] = None,
574
+ seed: int = 1,
574
575
  ):
575
576
  "By default damping, stiffness are set to zero."
576
577
  from ring.algorithms import get_joint_model
@@ -600,7 +601,7 @@ class System(_Base):
600
601
 
601
602
  jm = get_joint_model(new_joint_type)
602
603
  if jm.init_joint_params is not None:
603
- sys = sys.from_str(sys.to_str())
604
+ sys = sys.from_str(sys.to_str(), seed=seed)
604
605
 
605
606
  return sys
606
607
 
@@ -5,6 +5,8 @@ from typing import Callable, Optional, Tuple
5
5
  import jax
6
6
  import jax.numpy as jnp
7
7
  import optax
8
+ import tree_utils
9
+
8
10
  from ring import maths
9
11
  from ring.algorithms.generator import types
10
12
  from ring.ml import base as ml_base
@@ -15,8 +17,6 @@ from ring.utils import distribute_batchsize
15
17
  from ring.utils import expand_batchsize
16
18
  from ring.utils import parse_path
17
19
  from ring.utils import pickle_load
18
- import tree_utils
19
-
20
20
  import wandb
21
21
 
22
22
  # (T, N, F) -> Scalar
@@ -142,15 +142,17 @@ def train_fn(
142
142
  Wether or not the training run was killed by a callback.
143
143
  """
144
144
 
145
+ filter = filter.nojit()
146
+
145
147
  if checkpoint is not None:
146
148
  checkpoint = Path(checkpoint).with_suffix(".pickle")
147
149
  recv_checkpoint: dict = pickle_load(checkpoint)
148
- filter.params = recv_checkpoint["params"]
150
+ filter_params = recv_checkpoint["params"]
149
151
  opt_state = recv_checkpoint["opt_state"]
152
+ del recv_checkpoint
153
+ else:
154
+ filter_params = filter.search_attr("params")
150
155
 
151
- filter = filter.nojit()
152
-
153
- filter_params = filter.search_attr("params")
154
156
  if filter_params is None:
155
157
  X, _ = generator(jax.random.PRNGKey(1))
156
158
  filter_params, _ = filter.init(X=X, seed=seed_network)
@@ -122,6 +122,8 @@ def pytree_deepcopy(tree):
122
122
  return tuple(pytree_deepcopy(ele) for ele in tree)
123
123
  elif isinstance(tree, dict):
124
124
  return {key: pytree_deepcopy(value) for key, value in tree.items()}
125
+ elif isinstance(tree, _Base):
126
+ return tree
125
127
  else:
126
128
  raise NotImplementedError(f"Not implemented for type={type(tree)}")
127
129
 
@@ -1,5 +1,7 @@
1
1
  import jax
2
2
  import numpy as np
3
+ import pytest
4
+
3
5
  import ring
4
6
  from ring import MotionConfig
5
7
  from ring.algorithms import custom_joints
@@ -21,14 +23,19 @@ def pipeline_load_data_X(
21
23
  return gen(jax.random.PRNGKey(1))[0]
22
24
 
23
25
 
24
- def test_virtual_input_joint_axes_rr_joint():
25
- sys = ring.io.load_example("test_three_seg_seg2")
26
+ def _replace_ry_rz_with(sys, new_joint_type: str):
26
27
  sys_rr = sys.replace(
27
28
  link_types=[
28
- "rr" if link_type in ["ry", "rz"] else link_type
29
+ new_joint_type if link_type in ["ry", "rz"] else link_type
29
30
  for link_type in sys.link_types
30
31
  ]
31
32
  )
33
+ return sys_rr
34
+
35
+
36
+ def test_virtual_input_joint_axes_rr_joint():
37
+ sys = ring.io.load_example("test_three_seg_seg2")
38
+ sys_rr = _replace_ry_rz_with(sys, "rr")
32
39
  sys_rr = _init_joint_params(jax.random.PRNGKey(1), sys_rr)
33
40
  joint_axes = sys_rr.links.joint_params["rr"]["joint_axes"]
34
41
 
@@ -38,7 +45,7 @@ def test_virtual_input_joint_axes_rr_joint():
38
45
  np.testing.assert_allclose(
39
46
  X["seg1"]["joint_axes"],
40
47
  np.repeat(np.array([[0.0, -1, 0]]), 1000, axis=0),
41
- atol=1e-7,
48
+ atol=4e-7,
42
49
  )
43
50
  np.testing.assert_allclose(
44
51
  X["seg3"]["joint_axes"],
@@ -52,8 +59,8 @@ def test_virtual_input_joint_axes_rr_joint():
52
59
  np.testing.assert_allclose(
53
60
  X["seg1"]["joint_axes"],
54
61
  np.repeat(-joint_axes[1:2], 1000, axis=0),
55
- atol=3e-7,
56
- rtol=2e-6,
62
+ atol=4e-7,
63
+ rtol=2e-4,
57
64
  )
58
65
  np.testing.assert_allclose(
59
66
  X["seg3"]["joint_axes"],
@@ -63,6 +70,7 @@ def test_virtual_input_joint_axes_rr_joint():
63
70
  )
64
71
 
65
72
 
73
+ @pytest.mark.filterwarnings("ignore:The system has")
66
74
  def test_virtual_input_joint_axes_rr_imp_joint():
67
75
  custom_joints.register_rr_imp_joint(MotionConfig(T=10.0))
68
76
 
@@ -85,8 +93,8 @@ def test_virtual_input_joint_axes_rr_imp_joint():
85
93
  np.testing.assert_allclose(
86
94
  X["seg3"]["joint_axes"],
87
95
  np.repeat(-joint_axes[3:4], 1000, axis=0),
88
- atol=0.002,
89
- rtol=0.002,
96
+ atol=0.01,
97
+ rtol=0.032,
90
98
  )
91
99
 
92
100
  # test `make_generator`
@@ -97,10 +105,10 @@ def test_virtual_input_joint_axes_rr_imp_joint():
97
105
  np.testing.assert_allclose(
98
106
  X["seg1"]["joint_axes"],
99
107
  np.repeat(np.array([[0.0, -1, 0]]), 1000, axis=0),
100
- atol=1e-7,
108
+ atol=4e-7,
101
109
  )
102
110
  np.testing.assert_allclose(
103
111
  X["seg3"]["joint_axes"],
104
112
  np.repeat(np.array([[0.0, 0, 1]]), 1000, axis=0),
105
- atol=1e-7,
113
+ atol=4e-7,
106
114
  )
@@ -1,6 +1,7 @@
1
1
  from jax import random as jrand
2
2
  import numpy as np
3
3
  import pytest
4
+
4
5
  import ring
5
6
  from ring.algorithms._random import _resolve_range_of_motion
6
7
 
@@ -17,21 +18,27 @@ from ring.algorithms._random import _resolve_range_of_motion
17
18
  def test_delta_ang_min_max(
18
19
  range_of_motion, range_of_motion_method, delta_ang_min, delta_ang_max
19
20
  ):
21
+ max_iter = 100
22
+ t_min, t_max = 0.1, 3.1
20
23
  for seed in range(10):
21
- key = jrand.PRNGKey(seed)
22
- phi = _resolve_range_of_motion(
23
- range_of_motion,
24
- range_of_motion_method,
25
- 0.0,
26
- 3.14,
27
- float(delta_ang_min),
28
- float(delta_ang_max),
29
- 1.0,
30
- 0.0,
31
- key,
32
- 100,
33
- )
34
- assert delta_ang_min < abs(phi) < delta_ang_max
24
+ for prev_phi in [-3.0, 0.0, 3.0]:
25
+ key_t, key_ang = jrand.split(jrand.PRNGKey(seed))
26
+ dt, next_phi = _resolve_range_of_motion(
27
+ range_of_motion,
28
+ range_of_motion_method,
29
+ 0.0,
30
+ 3.14,
31
+ float(delta_ang_min),
32
+ float(delta_ang_max),
33
+ t_min,
34
+ t_max,
35
+ prev_phi,
36
+ key_t,
37
+ key_ang,
38
+ max_iter,
39
+ )
40
+ assert t_min <= dt <= t_max
41
+ assert delta_ang_min < abs(next_phi - prev_phi) < delta_ang_max
35
42
 
36
43
 
37
44
  @pytest.mark.parametrize(
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes