From 053003b6c72646acda2b719007f3e1e86eef823c Mon Sep 17 00:00:00 2001 From: John Lambert Date: Thu, 1 Jul 2021 17:16:54 -0400 Subject: [PATCH 1/2] create parent dir, when serializing Sim(2), if it doesnt exist --- argoverse/utils/sim2.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/argoverse/utils/sim2.py b/argoverse/utils/sim2.py index 2cad7bc5..3a59061c 100644 --- a/argoverse/utils/sim2.py +++ b/argoverse/utils/sim2.py @@ -8,6 +8,7 @@ import json import os +from pathlib import Path from typing import Union import numpy as np @@ -153,6 +154,9 @@ def save_as_json(self, save_fpath: _PathLike) -> None: Args: save_fpath: path to where json file should be saved """ + if not Path(save_fpath).exists(): + os.makedirs(Path(save_fpath).parent, exist_ok=True) + dict_for_serialization = { "R": self.rotation.flatten().tolist(), "t": self.translation.flatten().tolist(), From bdbce41abc4ac31fe6902e14082dd90978d9c67c Mon Sep 17 00:00:00 2001 From: John Lambert Date: Fri, 9 Jul 2021 21:30:10 -0400 Subject: [PATCH 2/2] reformat python black --- argoverse/utils/sim2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/argoverse/utils/sim2.py b/argoverse/utils/sim2.py index 3a59061c..b24d9175 100644 --- a/argoverse/utils/sim2.py +++ b/argoverse/utils/sim2.py @@ -156,7 +156,7 @@ def save_as_json(self, save_fpath: _PathLike) -> None: """ if not Path(save_fpath).exists(): os.makedirs(Path(save_fpath).parent, exist_ok=True) - + dict_for_serialization = { "R": self.rotation.flatten().tolist(), "t": self.translation.flatten().tolist(),