MCPcopy Create free account
hub / github.com/google-deepmind/dm_control / sample_elements

Method sample_elements

dm_control/mjcf/physics_test.py:46–56  ·  view source on GitHub ↗
(self, namespace, single_element)

Source from the content-addressed store, hash-verified

44 self.random = np.random.RandomState(0)
45
46 def sample_elements(self, namespace, single_element):
47 all_elements = self.model.find_all(namespace)
48 if single_element:
49 # A single randomly chosen element from this namespace.
50 elements = self.random.choice(all_elements)
51 full_identifiers = elements.full_identifier
52 else:
53 # A random permutation of all elements in this namespace.
54 elements = self.random.permutation(all_elements)
55 full_identifiers = [element.full_identifier for element in elements]
56 return elements, full_identifiers
57
58 def test_construct_and_reload_from_mjcf_model(self):
59 physics = mjcf.Physics.from_mjcf_model(self.model)

Callers 5

test_idMethod · 0.95
test_attribute_accessMethod · 0.95
test_indexingMethod · 0.95
test_dirtyMethod · 0.95

Calls 1

find_allMethod · 0.45

Tested by

no test coverage detected