forked from tangger/lerobot
[Vizualisation] independent column names (#783)
This commit is contained in:
@@ -245,16 +245,17 @@ def get_episode_data(dataset: LeRobotDataset | IterableNamespace, episode_index)
|
|||||||
if isinstance(dataset, LeRobotDataset)
|
if isinstance(dataset, LeRobotDataset)
|
||||||
else dataset.features[column_name].shape[0]
|
else dataset.features[column_name].shape[0]
|
||||||
)
|
)
|
||||||
header += [f"{column_name}_{i}" for i in range(dim_state)]
|
|
||||||
|
|
||||||
if "names" in dataset.features[column_name] and dataset.features[column_name]["names"]:
|
if "names" in dataset.features[column_name] and dataset.features[column_name]["names"]:
|
||||||
column_names = dataset.features[column_name]["names"]
|
column_names = dataset.features[column_name]["names"]
|
||||||
while not isinstance(column_names, list):
|
while not isinstance(column_names, list):
|
||||||
column_names = list(column_names.values())[0]
|
column_names = list(column_names.values())[0]
|
||||||
else:
|
else:
|
||||||
column_names = [f"motor_{i}" for i in range(dim_state)]
|
column_names = [f"{column_name}_{i}" for i in range(dim_state)]
|
||||||
columns.append({"key": column_name, "value": column_names})
|
columns.append({"key": column_name, "value": column_names})
|
||||||
|
|
||||||
|
header += column_names
|
||||||
|
|
||||||
selected_columns.insert(0, "timestamp")
|
selected_columns.insert(0, "timestamp")
|
||||||
|
|
||||||
if isinstance(dataset, LeRobotDataset):
|
if isinstance(dataset, LeRobotDataset):
|
||||||
|
|||||||
@@ -246,14 +246,16 @@
|
|||||||
<div class="flex gap-x-2 max-w-64 font-semibold px-1 break-all">
|
<div class="flex gap-x-2 max-w-64 font-semibold px-1 break-all">
|
||||||
<input type="checkbox" :checked="isRowChecked(rowIndex)"
|
<input type="checkbox" :checked="isRowChecked(rowIndex)"
|
||||||
@change="toggleRow(rowIndex)">
|
@change="toggleRow(rowIndex)">
|
||||||
<p x-text="`${rowLabels[rowIndex]}`"></p>
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<template x-for="(cell, colIndex) in row">
|
<template x-for="(cell, colIndex) in row">
|
||||||
<td x-show="cell" class="border border-slate-700">
|
<td x-show="cell" class="border border-slate-700">
|
||||||
<div class="flex gap-x-2 w-24 justify-between px-2" :class="{ 'hidden': cell.isNull }">
|
<div class="flex gap-x-2 justify-between px-2" :class="{ 'hidden': cell.isNull }">
|
||||||
<input type="checkbox" x-model="cell.checked" @change="updateTableValues()">
|
<div class="flex gap-x-2">
|
||||||
<span x-text="`${!cell.isNull ? cell.value.toFixed(2) : null}`"
|
<input type="checkbox" x-model="cell.checked" @change="updateTableValues()">
|
||||||
|
<span x-text="`${!cell.isNull ? cell.label : null}`"></span>
|
||||||
|
</div>
|
||||||
|
<span class="w-14 text-right" x-text="`${!cell.isNull ? (typeof cell.value === 'number' ? cell.value.toFixed(2) : cell.value) : null}`"
|
||||||
:style="`color: ${cell.color}`"></span>
|
:style="`color: ${cell.color}`"></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@@ -295,7 +297,6 @@
|
|||||||
videosKeys: {{ videos_info | map(attribute='filename') | list | tojson }},
|
videosKeys: {{ videos_info | map(attribute='filename') | list | tojson }},
|
||||||
videosKeysSelected: [],
|
videosKeysSelected: [],
|
||||||
columns: {{ columns | tojson }},
|
columns: {{ columns | tojson }},
|
||||||
rowLabels: {{ columns | tojson }}.reduce((colA, colB) => colA.value.length > colB.value.length ? colA : colB).value,
|
|
||||||
|
|
||||||
// alpine initialization
|
// alpine initialization
|
||||||
init() {
|
init() {
|
||||||
|
|||||||
Reference in New Issue
Block a user