From ec0b39b070bbbe311abdf7fb0e4e6c8a161c879b Mon Sep 17 00:00:00 2001 From: Kanishka Ganguly Date: Sun, 23 Apr 2023 17:27:44 -0700 Subject: [PATCH] Fix py_structs import errors across codebase --- multical/app/calibrate.py | 2 +- multical/app/intrinsic.py | 4 ++-- multical/board/__init__.py | 2 +- multical/board/aprilgrid.py | 4 ++-- multical/board/board.py | 2 +- multical/board/charuco.py | 2 +- multical/board/common.py | 2 +- multical/camera.py | 8 ++++---- multical/camera_fisheye.py | 10 +++++----- multical/config/arguments.py | 2 +- multical/config/runtime.py | 2 +- multical/config/workspace.py | 4 ++-- multical/display.py | 4 ++-- multical/image/detect.py | 2 +- multical/io/detections.py | 4 ++-- multical/io/export_calib.py | 2 +- multical/io/import_calib.py | 4 ++-- multical/io/logging.py | 2 +- multical/motion/hand_eye.py | 4 ++-- multical/motion/rolling_frames.py | 4 ++-- multical/motion/static_frames.py | 4 ++-- multical/optimization/calibration.py | 4 ++-- multical/optimization/hand_eye.py | 6 +++--- multical/optimization/parameters.py | 4 ++-- multical/optimization/pose_set.py | 4 ++-- multical/tables.py | 4 ++-- multical/threading.py | 2 +- multical/transform/matrix.py | 4 ++-- multical/workspace.py | 4 ++-- 29 files changed, 53 insertions(+), 53 deletions(-) diff --git a/multical/app/calibrate.py b/multical/app/calibrate.py index e5375bc..2d8f42b 100644 --- a/multical/app/calibrate.py +++ b/multical/app/calibrate.py @@ -2,7 +2,7 @@ from multical.io.logging import setup_logging from .vis import visualize_ws -from structs.struct import struct, map_none, to_structs +from py_structs import struct, map_none, to_structs import numpy as np from multical.config import * diff --git a/multical/app/intrinsic.py b/multical/app/intrinsic.py index bccb56f..cf811db 100644 --- a/multical/app/intrinsic.py +++ b/multical/app/intrinsic.py @@ -8,10 +8,10 @@ from multical.io.logging import setup_logging from multical.io.logging import info -from structs.struct import map_list, pformat_struct, split_dict +from py_structs import struct, map_list, pformat_struct, split_dict from multical import image -from structs.numpy import struct, shape +from py_structs.numpy import shape from multical.config.arguments import * diff --git a/multical/board/__init__.py b/multical/board/__init__.py index 0291d71..679b0e5 100644 --- a/multical/board/__init__.py +++ b/multical/board/__init__.py @@ -8,7 +8,7 @@ from typing import Tuple from omegaconf.omegaconf import OmegaConf, MISSING -from structs.struct import struct +from py_structs import struct from multical.io.logging import debug, info, error diff --git a/multical/board/aprilgrid.py b/multical/board/aprilgrid.py index 7a90602..5cc9fbc 100644 --- a/multical/board/aprilgrid.py +++ b/multical/board/aprilgrid.py @@ -2,14 +2,14 @@ from multical.io.logging import error from multical.board.board import Board -from structs.numpy import Table +from py_structs.numpy import Table from multical.board.common import * from pprint import pformat from cached_property import cached_property import cv2 import numpy as np -from structs.struct import struct, choose, subset +from py_structs import struct, choose, subset from multical.optimization.parameters import Parameters diff --git a/multical/board/board.py b/multical/board/board.py index afd6094..02f36d1 100644 --- a/multical/board/board.py +++ b/multical/board/board.py @@ -1,6 +1,6 @@ from cached_property import cached_property import numpy as np -from structs.struct import struct +from py_structs import struct class Board(object): diff --git a/multical/board/charuco.py b/multical/board/charuco.py index eb01b4a..57eeda1 100644 --- a/multical/board/charuco.py +++ b/multical/board/charuco.py @@ -5,7 +5,7 @@ import numpy as np from .common import * -from structs.struct import struct, choose, subset +from py_structs import struct, choose, subset from multical.optimization.parameters import Parameters class CharucoBoard(Parameters, Board): diff --git a/multical/board/common.py b/multical/board/common.py index 7dd9939..9c49206 100644 --- a/multical/board/common.py +++ b/multical/board/common.py @@ -2,7 +2,7 @@ import numpy as np -from structs.struct import struct +from py_structs import struct from multical.transform import rtvec diff --git a/multical/camera.py b/multical/camera.py index 521b6ec..775436d 100644 --- a/multical/camera.py +++ b/multical/camera.py @@ -3,15 +3,15 @@ from cached_property import cached_property import numpy as np import cv2 -from structs.numpy import shape +from py_structs.numpy import shape -from structs.struct import subset, transpose_structs, transpose_lists +from py_structs import subset, transpose_structs, transpose_lists from pprint import pformat from .transform import rtvec, matrix -from structs.struct import struct +from py_structs import struct from .optimization.parameters import Parameters from multiprocessing.pool import ThreadPool @@ -20,7 +20,7 @@ import cv2 from tqdm import tqdm -from structs.struct import split_list +from py_structs import split_list diff --git a/multical/camera_fisheye.py b/multical/camera_fisheye.py index 5e1a9b3..8ee3691 100644 --- a/multical/camera_fisheye.py +++ b/multical/camera_fisheye.py @@ -2,9 +2,9 @@ import operator from cached_property import cached_property import numpy as np -from structs.numpy import shape +from py_structs.numpy import shape -from structs.struct import subset, transpose_structs, transpose_lists +from py_structs import subset, transpose_structs, transpose_lists from pprint import pformat @@ -12,7 +12,7 @@ from . import camera from .transform import rtvec, matrix -from structs.struct import struct +from py_structs import struct from .optimization.parameters import Parameters from multiprocessing.pool import ThreadPool @@ -21,7 +21,7 @@ import cv2 from tqdm import tqdm -from structs.struct import split_list +from py_structs import split_list @@ -202,4 +202,4 @@ def stereo_calibrate_fisheye(cameras, matches, max_iter=60, eps=1e-6, left = CameraFisheye(dist=d1, intrinsic=K1, image_size=image_size, model=model) right = CameraFisheye(dist=d2, intrinsic=K2, image_size=image_size, model=model) - return left, right, matrix.join(R, T.flatten()), err \ No newline at end of file + return left, right, matrix.join(R, T.flatten()), err diff --git a/multical/config/arguments.py b/multical/config/arguments.py index 9eda9bd..f3c8089 100644 --- a/multical/config/arguments.py +++ b/multical/config/arguments.py @@ -4,7 +4,7 @@ import os from typing import List, Optional, Union -from structs.struct import Struct +from py_structs import Struct from simple_parsing import ArgumentParser, choice from simple_parsing.helpers import list_field diff --git a/multical/config/runtime.py b/multical/config/runtime.py index 5edac60..b7eff0f 100644 --- a/multical/config/runtime.py +++ b/multical/config/runtime.py @@ -3,7 +3,7 @@ from multical.io.logging import info from os import path -from structs.struct import struct +from py_structs import struct from multical.board import load_config, load_calico diff --git a/multical/config/workspace.py b/multical/config/workspace.py index 7c1cdca..4ffb85b 100644 --- a/multical/config/workspace.py +++ b/multical/config/workspace.py @@ -1,4 +1,4 @@ -from structs.struct import map_none +from py_structs import map_none from multical.io.import_calib import load_calibration from multical.motion.static_frames import StaticFrames from multical.motion.rolling_frames import RollingFrames @@ -52,4 +52,4 @@ def optimize(ws : Workspace, opt : OptimizerOpts = OptimizerOpts()): auto_scale=opt.auto_scale, outlier_threshold=opt.outlier_threshold, quantile=opt.outlier_quantile) - return ws \ No newline at end of file + return ws diff --git a/multical/display.py b/multical/display.py index 21e24ab..1ef2335 100644 --- a/multical/display.py +++ b/multical/display.py @@ -4,7 +4,7 @@ from .transform import rtvec from . import tables -from structs.struct import struct +from py_structs import struct from .image.display import display_stacked import palettable.colorbrewer.qualitative as palettes @@ -89,4 +89,4 @@ def draw_detections(image, detections, **options): def display_boards(boards, pixels_mm=1): board_images = [board.draw(pixels_mm=pixels_mm) for board in boards] - display_stacked(board_images) \ No newline at end of file + display_stacked(board_images) diff --git a/multical/image/detect.py b/multical/image/detect.py index d83ab34..dbe49f1 100644 --- a/multical/image/detect.py +++ b/multical/image/detect.py @@ -8,7 +8,7 @@ from multical.camera import stereo_calibrate from multical.threading import parmap_lists -from structs.struct import transpose_structs, struct, filter_none +from py_structs import transpose_structs, struct, filter_none def load_image(filename): assert path.isfile(filename), f"load_image: file {filename} does not exist" diff --git a/multical/io/detections.py b/multical/io/detections.py index 19c320d..7b8ab62 100644 --- a/multical/io/detections.py +++ b/multical/io/detections.py @@ -2,7 +2,7 @@ import pickle from multical.io.logging import info -from structs.struct import struct +from py_structs import struct def try_load_detections(filename, cache_key={}): try: @@ -24,4 +24,4 @@ def write_detections(filename, detected_points, cache_key={}): detected_points = detected_points ) with open(filename, "wb") as file: - pickle.dump(data, file) \ No newline at end of file + pickle.dump(data, file) diff --git a/multical/io/export_calib.py b/multical/io/export_calib.py index 8776aa0..dd3d8fa 100644 --- a/multical/io/export_calib.py +++ b/multical/io/export_calib.py @@ -2,7 +2,7 @@ from os import path import numpy as np -from structs.struct import struct, to_dicts, transpose_lists +from py_structs import struct, to_dicts, transpose_lists from multical.transform import matrix diff --git a/multical/io/import_calib.py b/multical/io/import_calib.py index 0d64d33..3979204 100644 --- a/multical/io/import_calib.py +++ b/multical/io/import_calib.py @@ -1,7 +1,7 @@ import json import numpy as np -from structs.struct import struct, to_structs +from py_structs import struct, to_structs from multical.transform import matrix from multical.camera import Camera @@ -93,4 +93,4 @@ def import_cameras(calib_data): def load_calibration(filename): calib_data = load_json(filename) - return import_cameras(calib_data) \ No newline at end of file + return import_cameras(calib_data) diff --git a/multical/io/logging.py b/multical/io/logging.py index 9303b6d..edf3ccc 100644 --- a/multical/io/logging.py +++ b/multical/io/logging.py @@ -6,7 +6,7 @@ from copy import copy import numpy as np -from structs.struct import struct +from py_structs import struct logger = logging.getLogger("calibration") diff --git a/multical/motion/hand_eye.py b/multical/motion/hand_eye.py index dccb348..21a9675 100644 --- a/multical/motion/hand_eye.py +++ b/multical/motion/hand_eye.py @@ -1,6 +1,6 @@ from multical.motion.static_frames import project_points import numpy as np -from structs.struct import struct, subset +from py_structs import struct, subset from multical import tables from multical.io.export_calib import export_poses from multical.optimization.parameters import IndexMapper, Parameters @@ -104,4 +104,4 @@ def copy(self, **k): """Copy object and change some attribute (no mutation)""" d = self.__getstate__() d.update(k) - return self.__class__(**d) \ No newline at end of file + return self.__class__(**d) diff --git a/multical/motion/rolling_frames.py b/multical/motion/rolling_frames.py index 51d1134..d0f5c08 100644 --- a/multical/motion/rolling_frames.py +++ b/multical/motion/rolling_frames.py @@ -1,12 +1,12 @@ from multical.motion.static_frames import project_cameras from cached_property import cached_property import numpy as np -from structs.struct import struct, subset +from py_structs import struct, subset from .motion_model import MotionModel from multical.optimization.parameters import IndexMapper, Parameters from multical import tables -from structs.numpy import Table, shape +from py_structs.numpy import Table, shape from multical.transform import rtvec, matrix from multical.transform.interpolate import interpolate_poses, lerp diff --git a/multical/motion/static_frames.py b/multical/motion/static_frames.py index 3006fe2..4cb4cda 100644 --- a/multical/motion/static_frames.py +++ b/multical/motion/static_frames.py @@ -2,8 +2,8 @@ from multical.motion.motion_model import MotionModel from multical.optimization.pose_set import PoseSet import numpy as np -from structs.numpy import Table, shape -from structs.struct import struct, subset +from py_structs.numpy import Table, shape +from py_structs import struct, subset from multical import tables diff --git a/multical/optimization/calibration.py b/multical/optimization/calibration.py index 7cae322..f24f0c6 100644 --- a/multical/optimization/calibration.py +++ b/multical/optimization/calibration.py @@ -18,8 +18,8 @@ from . import parameters from .parameters import ParamList -from structs.numpy import Table, shape -from structs.struct import concat_lists, apply_none, struct, choose, subset, when +from py_structs.numpy import Table, shape +from py_structs import concat_lists, apply_none, struct, choose, subset, when from scipy import optimize diff --git a/multical/optimization/hand_eye.py b/multical/optimization/hand_eye.py index c49f679..a3b207c 100644 --- a/multical/optimization/hand_eye.py +++ b/multical/optimization/hand_eye.py @@ -1,8 +1,8 @@ from multical.io.report import report_pose_errors from cached_property import cached_property import numpy as np -from structs.numpy import table -from structs.struct import subset +from py_structs.numpy import table +from py_structs import subset from .calibration import Calibration from multical.transform.hand_eye import hand_eye_robot_world @@ -95,4 +95,4 @@ def copy(self, **k): d = self.__getstate__() d.update(k) return self.__class__(**d) - \ No newline at end of file + diff --git a/multical/optimization/parameters.py b/multical/optimization/parameters.py index 3c96758..0a816fe 100644 --- a/multical/optimization/parameters.py +++ b/multical/optimization/parameters.py @@ -3,11 +3,11 @@ from pprint import pformat from typing import Any, Dict, Generic, List, TypeVar import numpy as np -from structs.numpy import map_arrays, reduce_arrays, shape +from py_structs.numpy import map_arrays, reduce_arrays, shape from cached_property import cached_property from scipy.sparse import lil_matrix -from structs.struct import subset +from py_structs import subset from numbers import Number diff --git a/multical/optimization/pose_set.py b/multical/optimization/pose_set.py index 21a2cf5..675ea14 100644 --- a/multical/optimization/pose_set.py +++ b/multical/optimization/pose_set.py @@ -1,5 +1,5 @@ from multical import tables -from structs.struct import struct, subset +from py_structs import struct, subset from multical.optimization.parameters import Parameters from cached_property import cached_property from multical.io.export_calib import export_poses @@ -70,4 +70,4 @@ def copy(self, **k): """Copy object and change some attribute (no mutation)""" d = self.__getstate__() d.update(k) - return self.__class__(**d) \ No newline at end of file + return self.__class__(**d) diff --git a/multical/tables.py b/multical/tables.py index 9a873ba..8874767 100644 --- a/multical/tables.py +++ b/multical/tables.py @@ -3,8 +3,8 @@ from .io.logging import debug, info import numpy as np -from structs.struct import transpose_structs, invert_keys -from structs.numpy import shape_info, struct, Table, shape +from py_structs import struct, transpose_structs, invert_keys +from py_structs.numpy import shape_info, Table, shape from .transform import rtvec, matrix from . import graph diff --git a/multical/threading.py b/multical/threading.py index 8c20ffa..c0cd985 100644 --- a/multical/threading.py +++ b/multical/threading.py @@ -3,7 +3,7 @@ from multiprocessing import Pool, cpu_count, get_logger from multiprocessing.pool import ThreadPool -from structs.struct import map_list, concat_lists, split_list +from py_structs import map_list, concat_lists, split_list from tqdm import tqdm import traceback diff --git a/multical/transform/matrix.py b/multical/transform/matrix.py index 80654c0..de25a8b 100644 --- a/multical/transform/matrix.py +++ b/multical/transform/matrix.py @@ -1,8 +1,8 @@ import numpy as np import math -from structs.numpy import shape -from structs.struct import choose, struct +from py_structs.numpy import shape +from py_structs import choose, struct from . import common from scipy.spatial.transform import Rotation as R diff --git a/multical/workspace.py b/multical/workspace.py index b83bfbb..16eefb9 100644 --- a/multical/workspace.py +++ b/multical/workspace.py @@ -16,11 +16,11 @@ from multical.image.detect import common_image_size from multical.optimization.calibration import Calibration, select_threshold -from structs.struct import map_list, split_dict, struct, subset, to_dicts +from py_structs import map_list, split_dict, struct, subset, to_dicts from . import tables, image from .camera import calibrate_cameras -from structs.numpy import shape +from py_structs.numpy import shape from .camera_fisheye import calibrate_cameras_fisheye from .io.logging import MemoryHandler, info