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

Method get_columns

dm_control/viewer/application.py:135–165  ·  view source on GitHub ↗

Returns the text to display in two columns.

(self)

Source from the content-addressed store, hash-verified

133 self._runtime.on_episode_begin += self._clear_error
134
135 def get_columns(self):
136 """Returns the text to display in two columns."""
137 if self._frame_timer.measured_time > 0:
138 self._fps_counter.value = 1. / self._frame_timer.measured_time
139 self._value[_FPS_LABEL] = '{0:.1f}'.format(self._fps_counter.value)
140
141 if self._runtime:
142 if self._runtime.state == runtime.State.STOPPED:
143 self._value[_STATUS_LABEL] = _RUNTIME_STOPPED_LABEL
144 else:
145 self._value[_STATUS_LABEL] = str(self._runtime.state)
146
147 self._cpu_counter.value = self._runtime.simulation_time
148
149 self._value[_TIME_LABEL] = '{0:.1f} ({1}x)'.format(
150 self._runtime.get_time(), str(self._time_multiplier))
151 self._value[_CPU_LABEL] = '{0:.2f}ms'.format(
152 self._cpu_counter.value * 1000.0)
153 else:
154 self._value[_STATUS_LABEL] = _MISSING_STATUS_ENTRY
155 self._value[_TIME_LABEL] = _MISSING_STATUS_ENTRY
156 self._value[_CPU_LABEL] = _MISSING_STATUS_ENTRY
157
158 if self._camera:
159 self._value[_CAMERA_LABEL] = self._camera.name
160 else:
161 self._value[_CAMERA_LABEL] = _MISSING_STATUS_ENTRY
162
163 self._value[_PAUSED_LABEL] = str(self._pause.value)
164
165 return list(self._value.items()) # For Python 2/3 compatibility.
166
167 def _clear_error(self):
168 self._value[_ERROR_LABEL] = _MISSING_STATUS_ENTRY

Callers

nothing calls this directly

Calls 2

get_timeMethod · 0.80
itemsMethod · 0.80

Tested by

no test coverage detected