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

Replace file-relative imports with root-relative imports #252

Merged
merged 1 commit into from
Dec 25, 2017
Merged
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 pocs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""
Panoptes Observatory Control System (POCS) is a library for controlling a
PANOPTES hardware unit. POCS provides complete automation of all observing
processes and is inteded to be run in an automated fashion.
processes and is intended to be run in an automated fashion.
"""

from __future__ import absolute_import
Expand Down
2 changes: 2 additions & 0 deletions pocs/camera/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from pocs.camera.camera import AbstractCamera
from pocs.camera.camera import AbstractGPhotoCamera
12 changes: 6 additions & 6 deletions pocs/camera/camera.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from .. import PanBase
from pocs import PanBase

from ..utils import error
from ..utils import listify
from ..utils import load_module
from ..utils import images
from pocs.utils import error
from pocs.utils import listify
from pocs.utils import load_module
from pocs.utils import images

from ..focuser.focuser import AbstractFocuser
from pocs.focuser import AbstractFocuser

from astropy.io import fits

Expand Down
8 changes: 4 additions & 4 deletions pocs/camera/canon_gphoto2.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
from threading import Event
from threading import Timer

from ..utils import current_time
from ..utils import error
from ..utils import images
from .camera import AbstractGPhotoCamera
from pocs.utils import current_time
from pocs.utils import error
from pocs.utils import images
from pocs.camera import AbstractGPhotoCamera


class Camera(AbstractGPhotoCamera):
Expand Down
10 changes: 5 additions & 5 deletions pocs/camera/sbig.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
from astropy import units as u
from astropy.io import fits

from ..utils import current_time
from ..utils import images
from .camera import AbstractCamera
from .sbigudrv import INVALID_HANDLE_VALUE
from .sbigudrv import SBIGDriver
from pocs.utils import current_time
from pocs.utils import images
from pocs.camera import AbstractCamera
from pocs.camera.sbigudrv import INVALID_HANDLE_VALUE
from pocs.camera.sbigudrv import SBIGDriver
from pocs.focuser.birger import Focuser as BirgerFocuser


Expand Down
2 changes: 1 addition & 1 deletion pocs/camera/sbigudrv.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from astropy.io import fits
from astropy.time import Time

from .. import PanBase
from pocs import PanBase


################################################################################
Expand Down
4 changes: 2 additions & 2 deletions pocs/camera/simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
from astropy.io import fits
from astropy.time import Time

from ..utils import current_time
from pocs.utils import current_time

from .camera import AbstractCamera
from pocs.camera import AbstractCamera


class Camera(AbstractCamera):
Expand Down
1 change: 1 addition & 0 deletions pocs/focuser/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from pocs.focuser.focuser import AbstractFocuser
2 changes: 1 addition & 1 deletion pocs/focuser/birger.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import time
import glob

from pocs.focuser.focuser import AbstractFocuser
from pocs.focuser import AbstractFocuser

# Birger adaptor serial numbers should be 5 digits
serial_number_pattern = re.compile('^\d{5}$')
Expand Down
6 changes: 3 additions & 3 deletions pocs/focuser/focuser.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
from threading import Thread


from .. import PanBase
from ..utils import current_time
from ..utils import images
from pocs import PanBase
from pocs.utils import current_time
from pocs.utils import images

palette = copy(plt.cm.cubehelix)
palette.set_over('w', 1.0)
Expand Down
2 changes: 1 addition & 1 deletion pocs/focuser/simulator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .focuser import AbstractFocuser
from pocs.focuser import AbstractFocuser

import time
import random
Expand Down
4 changes: 2 additions & 2 deletions pocs/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
from astropy.time import Time
from collections import namedtuple

from . import PanBase
from .utils import images as img_utils
from pocs import PanBase
from pocs.utils import images as img_utils

OffsetError = namedtuple('OffsetError', ['delta_ra', 'delta_dec', 'magnitude'])

Expand Down
1 change: 1 addition & 0 deletions pocs/mount/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from pocs.mount.mount import AbstractMount
6 changes: 3 additions & 3 deletions pocs/mount/bisque.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
from astropy.coordinates import SkyCoord
from string import Template

from ..utils import error
from ..utils import theskyx
from pocs.utils import error
from pocs.utils import theskyx

from .mount import AbstractMount
from pocs.mount import AbstractMount


class Mount(AbstractMount):
Expand Down
6 changes: 3 additions & 3 deletions pocs/mount/ioptron.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
from astropy import units as u
from astropy.coordinates import SkyCoord

from ..utils import current_time
from ..utils import error as error
from .serial import AbstractSerialMount
from pocs.utils import current_time
from pocs.utils import error as error
from pocs.mount.serial import AbstractSerialMount


class Mount(AbstractSerialMount):
Expand Down
4 changes: 2 additions & 2 deletions pocs/mount/mount.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

from pocs import PanBase

from ..utils import current_time
from ..utils import error
from pocs.utils import current_time
from pocs.utils import error


class AbstractMount(PanBase):
Expand Down
6 changes: 3 additions & 3 deletions pocs/mount/serial.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import os
import yaml

from ..utils import error
from ..utils import rs232
from pocs.utils import error
from pocs.utils import rs232

from .mount import AbstractMount
from pocs.mount import AbstractMount


class AbstractSerialMount(AbstractMount):
Expand Down
4 changes: 2 additions & 2 deletions pocs/mount/simulator.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import time

from ..utils import current_time
from .mount import AbstractMount
from pocs.utils import current_time
from pocs.mount import AbstractMount


class Mount(AbstractMount):
Expand Down
18 changes: 9 additions & 9 deletions pocs/observatory.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
from astropy.coordinates import get_moon
from astropy.coordinates import get_sun

from . import PanBase
from pocs import PanBase
import pocs.dome
from .images import Image
from .scheduler.constraint import Duration
from .scheduler.constraint import MoonAvoidance
from .utils import current_time
from .utils import error
from .utils import images as img_utils
from .utils import list_connected_cameras
from .utils import load_module
from pocs.images import Image
from pocs.scheduler.constraint import Duration
from pocs.scheduler.constraint import MoonAvoidance
from pocs.utils import current_time
from pocs.utils import error
from pocs.utils import images as img_utils
from pocs.utils import list_connected_cameras
from pocs.utils import load_module


class Observatory(PanBase):
Expand Down
1 change: 1 addition & 0 deletions pocs/scheduler/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from pocs.scheduler.scheduler import BaseScheduler
2 changes: 1 addition & 1 deletion pocs/scheduler/constraint.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from astropy import units as u

from .. import PanBase
from pocs import PanBase


class BaseConstraint(PanBase):
Expand Down
6 changes: 3 additions & 3 deletions pocs/scheduler/dispatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

from astropy.coordinates import get_moon

from ..utils import current_time
from ..utils import listify
from .scheduler import BaseScheduler
from pocs.utils import current_time
from pocs.utils import listify
from pocs.scheduler import BaseScheduler


class Scheduler(BaseScheduler):
Expand Down
4 changes: 2 additions & 2 deletions pocs/scheduler/observation.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from astropy import units as u
from collections import OrderedDict

from .. import PanBase
from .field import Field
from pocs import PanBase
from pocs.scheduler.field import Field


class Observation(PanBase):
Expand Down
8 changes: 4 additions & 4 deletions pocs/scheduler/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
from astroplan import Observer
from astropy import units as u

from .. import PanBase
from ..utils import current_time
from .field import Field
from .observation import Observation
from pocs import PanBase
from pocs.utils import current_time
from pocs.scheduler.field import Field
from pocs.scheduler.observation import Observation


class BaseScheduler(PanBase):
Expand Down
6 changes: 3 additions & 3 deletions pocs/state/machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

from transitions import State

from ..utils import error
from ..utils import listify
from ..utils import load_module
from pocs.utils import error
from pocs.utils import listify
from pocs.utils import load_module

can_graph = False
try: # pragma: no cover
Expand Down
2 changes: 1 addition & 1 deletion pocs/state/states/default/observing.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ....utils import error
from pocs.utils import error
from time import sleep

wait_interval = 15.
Expand Down
4 changes: 2 additions & 2 deletions pocs/state/states/default/pointing.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from time import sleep

from ....images import Image
from ....utils import error
from pocs.images import Image
from pocs.utils import error

wait_interval = 3.
timeout = 150.
Expand Down
2 changes: 1 addition & 1 deletion pocs/tests/test_base_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from astroplan import Observer

from pocs.scheduler.scheduler import BaseScheduler as Scheduler
from pocs.scheduler import BaseScheduler as Scheduler

from pocs.scheduler.constraint import Duration
from pocs.scheduler.constraint import MoonAvoidance
Expand Down
2 changes: 1 addition & 1 deletion pocs/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def load_module(module_name):
Returns:
module: an imported module name
"""
from ..utils import error
from pocs.utils import error
try:
module = resolve_name(module_name)
except ImportError:
Expand Down
2 changes: 1 addition & 1 deletion pocs/utils/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from astropy.utils.exceptions import AstropyWarning

from .. import PanBase
from pocs import PanBase


class PanError(AstropyWarning, PanBase):
Expand Down
2 changes: 1 addition & 1 deletion pocs/utils/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import logging.config
from tempfile import gettempdir

from .config import load_config
from pocs.utils.config import load_config


class PanLogger(object):
Expand Down
4 changes: 2 additions & 2 deletions pocs/utils/rs232.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import serial as serial
import time

from .. import PanBase
from .error import BadSerialConnection
from pocs import PanBase
from pocs.utils.error import BadSerialConnection


class SerialData(PanBase):
Expand Down