Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix py_structs import errors across codebase #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion multical/app/calibrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 *
Expand Down
4 changes: 2 additions & 2 deletions multical/app/intrinsic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 *

Expand Down
2 changes: 1 addition & 1 deletion multical/board/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions multical/board/aprilgrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion multical/board/board.py
Original file line number Diff line number Diff line change
@@ -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):

Expand Down
2 changes: 1 addition & 1 deletion multical/board/charuco.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion multical/board/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import numpy as np


from structs.struct import struct
from py_structs import struct
from multical.transform import rtvec


Expand Down
8 changes: 4 additions & 4 deletions multical/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -20,7 +20,7 @@
import cv2
from tqdm import tqdm

from structs.struct import split_list
from py_structs import split_list



Expand Down
10 changes: 5 additions & 5 deletions multical/camera_fisheye.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
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


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
Expand All @@ -21,7 +21,7 @@
import cv2
from tqdm import tqdm

from structs.struct import split_list
from py_structs import split_list



Expand Down Expand Up @@ -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
return left, right, matrix.join(R, T.flatten()), err
2 changes: 1 addition & 1 deletion multical/config/arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion multical/config/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
4 changes: 2 additions & 2 deletions multical/config/workspace.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
return ws
4 changes: 2 additions & 2 deletions multical/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
display_stacked(board_images)
2 changes: 1 addition & 1 deletion multical/image/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions multical/io/detections.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
pickle.dump(data, file)
2 changes: 1 addition & 1 deletion multical/io/export_calib.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
4 changes: 2 additions & 2 deletions multical/io/import_calib.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -93,4 +93,4 @@ def import_cameras(calib_data):

def load_calibration(filename):
calib_data = load_json(filename)
return import_cameras(calib_data)
return import_cameras(calib_data)
2 changes: 1 addition & 1 deletion multical/io/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
4 changes: 2 additions & 2 deletions multical/motion/hand_eye.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
return self.__class__(**d)
4 changes: 2 additions & 2 deletions multical/motion/rolling_frames.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions multical/motion/static_frames.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
4 changes: 2 additions & 2 deletions multical/optimization/calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions multical/optimization/hand_eye.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -95,4 +95,4 @@ def copy(self, **k):
d = self.__getstate__()
d.update(k)
return self.__class__(**d)


4 changes: 2 additions & 2 deletions multical/optimization/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
4 changes: 2 additions & 2 deletions multical/optimization/pose_set.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
return self.__class__(**d)
4 changes: 2 additions & 2 deletions multical/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion multical/threading.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions multical/transform/matrix.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions multical/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down