Skip to content

Commit 836fc0a

Browse files
authored
sai-cli diagnose: Remove --output_json option and make --output_html positional argument (#74)
1 parent 152f581 commit 836fc0a

File tree

1 file changed

+5
-18
lines changed

1 file changed

+5
-18
lines changed

python/cli/diagnose/diagnose.py

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212

1313
def define_args(parser):
1414
parser.add_argument("dataset_path", type=pathlib.Path, help="Path to dataset")
15-
parser.add_argument("--output_html", type=pathlib.Path, help="Path to calibration report HTML output.")
16-
parser.add_argument("--output_json", type=pathlib.Path, help="Path to JSON output.")
15+
parser.add_argument("output_html", type=pathlib.Path, help="Path to calibration report HTML output.")
1716
parser.add_argument("--zero", help="Rescale time to start from zero", action='store_true')
1817
parser.add_argument("--skip", type=float, help="Skip N seconds from the start")
1918
parser.add_argument("--max", type=float, help="Plot max N seconds from the start")
@@ -38,10 +37,6 @@ def generateReport(args):
3837
'dataset_path': str(jsonlFile.parent)
3938
}
4039

41-
if not args.output_html and not args.output_json:
42-
print("Either --output_html or --output_json is required")
43-
return
44-
4540
data = {
4641
'accelerometer': {"v": [], "t": [], "td": []},
4742
'gyroscope': {"v": [], "t": [], "td": []},
@@ -138,18 +133,10 @@ def addMeasurement(type, t, v):
138133
diagnoseGNSS(data, output)
139134
diagnoseCpu(data, output)
140135

141-
if args.output_json:
142-
if os.path.dirname(args.output_json):
143-
os.makedirs(os.path.dirname(args.output_json), exist_ok=True)
144-
with open(args.output_json, "w") as f:
145-
f.write(json.dumps(output, indent=4))
146-
print("Generated JSON report data at:", args.output_json)
147-
148-
if args.output_html:
149-
if os.path.dirname(args.output_html):
150-
os.makedirs(os.path.dirname(args.output_html), exist_ok=True)
151-
generateHtml(output, args.output_html)
152-
print("Generated HTML report at:", args.output_html)
136+
if os.path.dirname(args.output_html):
137+
os.makedirs(os.path.dirname(args.output_html), exist_ok=True)
138+
generateHtml(output, args.output_html)
139+
print("Generated HTML report at:", args.output_html)
153140

154141
if __name__ == '__main__':
155142
def parse_args():

0 commit comments

Comments
 (0)