# Path: concert/quantities.py

# 
# Path: concert/base.py
# class Quantity(Parameter):
# 
#     """A :class:`.Parameter` associated with a unit."""
# 
#     def __init__(self, unit, fget=None, fset=None, fget_target=None, lower=None, upper=None,
#                  data=None, check=None, external_lower_getter=None, external_upper_getter=None,
#                  user_lower_getter=None, user_lower_setter=None, user_upper_getter=None,
#                  user_upper_setter=None, help=None):
#         """
#         *fget*, *fset*, *data*, *check* and *help* are identical to the
#         :class:`.Parameter` constructor arguments.
# 
#         *unit* is a Pint quantity. *lower* and *upper* denote soft limits
#         between the :class:`.Quantity` values can lie.
#         """
#         super(Quantity, self).__init__(fget=fget, fset=fset, fget_target=fget_target, data=data,
#                                        check=check, help=help)
#         self.unit = unit
# 
#         self.upper = upper
#         self.lower = lower
#         self.external_lower_getter = external_lower_getter
#         self.external_upper_getter = external_upper_getter
#         self.user_lower_getter = user_lower_getter
#         self.user_lower_setter = user_lower_setter
#         self.user_upper_getter = user_upper_getter
#         self.user_upper_setter = user_upper_setter
# 
#     def convert(self, value):
#         return value.to(self.unit)
# 
# class AccessorNotImplementedError(NotImplementedError):
# 
#     """Raised when a setter or getter is not implemented."""
# 
# Path: concert/devices/base.py
# class Device(Parameterizable):
# 
#     """
#     A :class:`.Device` provides locked access to a real-world device.
# 
#     It implements the context protocol to provide locking::
# 
#         async with device:
#             # device is locked
#             await device.set_parameter(1 * q.m)
#             ...
# 
#         # device is unlocked again
#     """
# 
#     def __init__(self):
#         # We have to create the lock early on because it will be accessed in
#         # any add_parameter calls, especially those in the Parameterizable base
#         # class
#         self._lock = asyncio.Lock()
#         super(Device, self).__init__()
# 
#     async def __aenter__(self):
#         await self._lock.acquire()
# 
#         return self
# 
#     async def __aexit__(self, exc_type, exc, tb):
#         self._lock.release()
# 
#     @background
#     async def emergency_stop(self):
#         """Emergency stop."""
#         await self._emergency_stop()
# 
#     async def _emergency_stop(self):
#         """Emergency stop implementation."""
#         pass


from concert.quantities import q
from concert.base import Quantity, AccessorNotImplementedError
from concert.devices.base import Device
"""
Detector is a device which consists of a camera and an objective lens
which affects the effective pixel size.
"""


class Detector(Device):
    """
    A base detector class for holding cameras and optics necessary to
    do acquire image.
    """

    pixel_width = Quantity(q.m, help="Effective pixel width")

# Path: concert/quantities.py

# 
# Path: concert/base.py
# class Quantity(Parameter):
# 
#     """A :class:`.Parameter` associated with a unit."""
# 
#     def __init__(self, unit, fget=None, fset=None, fget_target=None, lower=None, upper=None,
#                  data=None, check=None, external_lower_getter=None, external_upper_getter=None,
#                  user_lower_getter=None, user_lower_setter=None, user_upper_getter=None,
#                  user_upper_setter=None, help=None):
#         """
#         *fget*, *fset*, *data*, *check* and *help* are identical to the
#         :class:`.Parameter` constructor arguments.
# 
#         *unit* is a Pint quantity. *lower* and *upper* denote soft limits
#         between the :class:`.Quantity` values can lie.
#         """
#         super(Quantity, self).__init__(fget=fget, fset=fset, fget_target=fget_target, data=data,
#                                        check=check, help=help)
#         self.unit = unit
# 
#         self.upper = upper
#         self.lower = lower
#         self.external_lower_getter = external_lower_getter
#         self.external_upper_getter = external_upper_getter
#         self.user_lower_getter = user_lower_getter
#         self.user_lower_setter = user_lower_setter
#         self.user_upper_getter = user_upper_getter
#         self.user_upper_setter = user_upper_setter
# 
#     def convert(self, value):
#         return value.to(self.unit)
# 
# class AccessorNotImplementedError(NotImplementedError):
# 
#     """Raised when a setter or getter is not implemented."""
# 
# Path: concert/devices/base.py
# class Device(Parameterizable):
# 
#     """
#     A :class:`.Device` provides locked access to a real-world device.
# 
#     It implements the context protocol to provide locking::
# 
#         async with device:
#             # device is locked
#             await device.set_parameter(1 * q.m)
#             ...
# 
#         # device is unlocked again
#     """
# 
#     def __init__(self):
#         # We have to create the lock early on because it will be accessed in
#         # any add_parameter calls, especially those in the Parameterizable base
#         # class
#         self._lock = asyncio.Lock()
#         super(Device, self).__init__()
# 
#     async def __aenter__(self):
#         await self._lock.acquire()
# 
#         return self
# 
#     async def __aexit__(self, exc_type, exc, tb):
#         self._lock.release()
# 
#     @background
#     async def emergency_stop(self):
#         """Emergency stop."""
#         await self._emergency_stop()
# 
#     async def _emergency_stop(self):
#         """Emergency stop implementation."""
#         pass


# Path: concert/devices/detectors/base.py
from concert.quantities import q
from concert.base import Quantity, AccessorNotImplementedError
from concert.devices.base import Device

"""
Detector is a device which consists of a camera and an objective lens
which affects the effective pixel size.
"""


class Detector(Device):
    """
    A base detector class for holding cameras and optics necessary to
    do acquire image.
    """

    pixel_width = Quantity(q.m, help="Effective pixel width")

    pixel_height = Quantity(q.m, help="Effective pixel height")