Browse Source

Camera exposure time fixed.

master
Carlos Reding 1 year ago
parent
commit
c90dd4993c
2 changed files with 8 additions and 6 deletions
  1. 1
    1
      puppeteer/__init__.py
  2. 7
    5
      puppeteer/_core.py

+ 1
- 1
puppeteer/__init__.py View File

@@ -48,7 +48,7 @@ def Controller(USR_INSTRUCTIONS, Connection, cancel_switch, ConnectionStatus,
device_filters = tuple(Box._filter_set)
user_filters = [device_filters[f] for f in USR_INSTRUCTIONS.user_filters]
if len(user_filters) == 1:
user_filters = tuple(user_filters) # make singleton (iterable)
user_filters = tuple(user_filters) # make singleton (interable. `int' is not).
# Configure protocol. Additional field: notes='' as **kwarg
Protocol = SetProtocol(with_device=Box, filters=user_filters,
and_wavelenghts=USR_INSTRUCTIONS.user_wavelengths,

+ 7
- 5
puppeteer/_core.py View File

@@ -79,7 +79,6 @@ else:
# Replicates
__REPLICATES__ = 3


def _img_settings(Camera, Filter=None):
"""
Define camera settings. Auto-exposure or auto-white-balance result
@@ -100,7 +99,7 @@ def _img_settings(Camera, Filter=None):
Camera.hflip = True # Ensures well A1 is in the bottom-left.
Camera.awb_mode = 'off'
Camera.awb_gains = (1.45, 1.45)
SHUTTER_SPEED = __SHUTTER_SPEED__
SHUTTER_SPEED = __SHUTTER_SPEED__ # Shutter speed _IN SECONDS_.
if Filter == "Filter_1":
Camera.iso = ISO_F1
elif Filter == "Filter_2":
@@ -110,12 +109,13 @@ def _img_settings(Camera, Filter=None):
Camera.iso = ISO_F3
else:
Camera.iso = DEFAULT_ISO
Camera.shutter_speed = int(SHUTTER_SPEED * 10**6) # Translate SHUTTER_SPEED to µs.
Camera.framerate = 10 # slowst SHUTTER_SPEED = 1/framerate.
Camera.shutter_speed = int(SHUTTER_SPEED * 10**6) # Translate SHUTTER_SPEED to µS.
# max_res = Camera.MAX_RESOLUTION # How big can the image be?
# Camera.resolution = (int(max_res[0]), int(max_res[1]))
Camera.resolution = (1640, 1232) # Smallest resolution with full FoV (partial FoV results in plate not fully captured).
# imdev v2 has issues with 'exposure_mode = off' causing black img.
t.sleep(0.1) # Solves those issues (WTF?) as long as it's _BEFORE_ exposure_mode.
t.sleep(0.25) # Solves those issues (WTF?) as long as it's _BEFORE_ exposure_mode.
Camera.exposure_mode = 'off' # Lock Settings.
return Camera

@@ -212,6 +212,7 @@ def _average_image(self, photo_path, Replicate_name, Replicates=__REPLICATES__):
def _get_response(Connection, BUFFER_SIZE):
return Connection.recv(BUFFER_SIZE)


class SetupDevice:
"""
Initialise all components and allows the instrument to be programmed.
@@ -563,6 +564,7 @@ class SetupDevice:

self._FILTER_PIN = FILTER_PIN
self._HEATER_PIN = HEATER_PIN
self.__SHUTTER_SPEED__ = __SHUTTER_SPEED__
# Initialise hardware.
self._light_panel, self._heater,\
@@ -802,7 +804,7 @@ class SetProtocol:
# Update temperature (even with `ambient', to keep track of it).
self._update_temperature(current_time)
# Handle cancel_protocol event.
# Handle cancel_protocol event (multithreading).
if event.is_set():
# cancel_protocol.is_set() is now True. STOP.
if temperature is not 0:

Loading…
Cancel
Save