Skip to content

Commit 017e46f

Browse files
committed
args: Add ability to ignore a field
Allows to exclude fields from the visualization
1 parent b4f33bb commit 017e46f

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

multivariate_view/app/app.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,17 @@ def __init__(self, server=None):
4343
dest="preprocess",
4444
action='store_true',
4545
)
46+
self.server.cli.add_argument(
47+
"--ignore-fields",
48+
help="Fields to ignore from the dataset",
49+
default=[],
50+
nargs='+',
51+
type=str,
52+
)
4653

4754
args, _ = self.server.cli.parse_known_args()
4855
self.enable_preprocessing = args.preprocess
56+
self.ignore_fields = args.ignore_fields
4957
file_to_load = args.data
5058
if file_to_load is None:
5159
EXAMPLE_DATA_DIR.mkdir(parents=True, exist_ok=True)
@@ -85,6 +93,15 @@ def __init__(self, server=None):
8593
def load_data(self, file_to_load):
8694
header, data = load_dataset(Path(file_to_load))
8795

96+
for key in self.ignore_fields:
97+
if key in header:
98+
index_to_remove = header.index(key)
99+
data = np.delete(data, index_to_remove, axis=3)
100+
else:
101+
print(
102+
f"Warning: field {key} is not part of the provided dataset.\nThe available fields are {header}"
103+
)
104+
88105
self.state.component_labels = header
89106

90107
if self.enable_preprocessing:

0 commit comments

Comments
 (0)