# Path: concert/quantities.py

# 
# Path: concert/devices/cameras/dummy.py
# class Base(base.Camera):
# 
#     exposure_time = Quantity(q.s)
#     sensor_pixel_width = Quantity(q.micrometer)
#     sensor_pixel_height = Quantity(q.micrometer)
#     roi_x0 = Quantity(q.pixel)
#     roi_y0 = Quantity(q.pixel)
#     roi_width = Quantity(q.pixel)
#     roi_height = Quantity(q.pixel)
# 
#     def __init__(self):
#         super(Base, self).__init__()
#         self._frame_rate = 1000 / q.s
#         self._trigger_source = self.trigger_sources.AUTO
#         self._exposure_time = 1 * q.ms
#         self._roi_x0 = 0 * q.pixel
#         self._roi_y0 = 0 * q.pixel
#         self._roi_width = 640 * q.pixel
#         self._roi_height = 480 * q.pixel
# 
#     async def _get_sensor_pixel_width(self):
#         return 5 * q.micrometer
# 
#     async def _get_sensor_pixel_height(self):
#         return 5 * q.micrometer
# 
#     async def _get_roi_x0(self):
#         return self._roi_x0
# 
#     async def _set_roi_x0(self, x0):
#         self._roi_x0 = x0
# 
#     async def _get_roi_y0(self):
#         return self._roi_y0
# 
#     async def _set_roi_y0(self, y0):
#         self._roi_y0 = y0
# 
#     async def _get_roi_width(self):
#         return self._roi_width
# 
#     async def _set_roi_width(self, roi):
#         self._roi_width = roi
# 
#     async def _get_roi_height(self):
#         return self._roi_height
# 
#     async def _set_roi_height(self, roi):
#         self._roi_height = roi
# 
#     async def _get_exposure_time(self):
#         return self._exposure_time
# 
#     async def _set_exposure_time(self, value):
#         self._exposure_time = value
# 
#     async def _get_frame_rate(self):
#         return self._frame_rate
# 
#     async def _set_frame_rate(self, frame_rate):
#         self._frame_rate = frame_rate
# 
#     async def _get_trigger_source(self):
#         return self._trigger_source
# 
#     async def _set_trigger_source(self, source):
#         self._trigger_source = source
# 
#     @transition(target='recording')
#     async def _record_real(self):
#         pass
# 
#     @transition(target='standby')
#     async def _stop_real(self):
#         pass
# 
#     async def _trigger_real(self):
#         pass


import scipy.misc
from scipy.ndimage import gaussian_filter
from concert.quantities import q
from concert.devices.cameras.dummy import Base as DummyCameraBase


FOCUS_POSITION = 35 * q.mm


class BlurringCamera(DummyCameraBase):

    def __init__(self, motor):
        super(BlurringCamera, self).__init__()
        self._original = scipy.misc.ascent()
        self.motor = motor

    async def _grab_real(self):
        sigma = abs((await self.motor.get_position() - FOCUS_POSITION).magnitude)

# Path: concert/quantities.py

# 
# Path: concert/devices/cameras/dummy.py
# class Base(base.Camera):
# 
#     exposure_time = Quantity(q.s)
#     sensor_pixel_width = Quantity(q.micrometer)
#     sensor_pixel_height = Quantity(q.micrometer)
#     roi_x0 = Quantity(q.pixel)
#     roi_y0 = Quantity(q.pixel)
#     roi_width = Quantity(q.pixel)
#     roi_height = Quantity(q.pixel)
# 
#     def __init__(self):
#         super(Base, self).__init__()
#         self._frame_rate = 1000 / q.s
#         self._trigger_source = self.trigger_sources.AUTO
#         self._exposure_time = 1 * q.ms
#         self._roi_x0 = 0 * q.pixel
#         self._roi_y0 = 0 * q.pixel
#         self._roi_width = 640 * q.pixel
#         self._roi_height = 480 * q.pixel
# 
#     async def _get_sensor_pixel_width(self):
#         return 5 * q.micrometer
# 
#     async def _get_sensor_pixel_height(self):
#         return 5 * q.micrometer
# 
#     async def _get_roi_x0(self):
#         return self._roi_x0
# 
#     async def _set_roi_x0(self, x0):
#         self._roi_x0 = x0
# 
#     async def _get_roi_y0(self):
#         return self._roi_y0
# 
#     async def _set_roi_y0(self, y0):
#         self._roi_y0 = y0
# 
#     async def _get_roi_width(self):
#         return self._roi_width
# 
#     async def _set_roi_width(self, roi):
#         self._roi_width = roi
# 
#     async def _get_roi_height(self):
#         return self._roi_height
# 
#     async def _set_roi_height(self, roi):
#         self._roi_height = roi
# 
#     async def _get_exposure_time(self):
#         return self._exposure_time
# 
#     async def _set_exposure_time(self, value):
#         self._exposure_time = value
# 
#     async def _get_frame_rate(self):
#         return self._frame_rate
# 
#     async def _set_frame_rate(self, frame_rate):
#         self._frame_rate = frame_rate
# 
#     async def _get_trigger_source(self):
#         return self._trigger_source
# 
#     async def _set_trigger_source(self, source):
#         self._trigger_source = source
# 
#     @transition(target='recording')
#     async def _record_real(self):
#         pass
# 
#     @transition(target='standby')
#     async def _stop_real(self):
#         pass
# 
#     async def _trigger_real(self):
#         pass


# Path: concert/tests/util/focus.py
import scipy.misc
from scipy.ndimage import gaussian_filter
from concert.quantities import q
from concert.devices.cameras.dummy import Base as DummyCameraBase



FOCUS_POSITION = 35 * q.mm


class BlurringCamera(DummyCameraBase):

    def __init__(self, motor):
        super(BlurringCamera, self).__init__()
        self._original = scipy.misc.ascent()
        self.motor = motor

    async def _grab_real(self):
        sigma = abs((await self.motor.get_position() - FOCUS_POSITION).magnitude)

        return gaussian_filter(self._original, sigma)