Bladeren bron

Fix to allow all flexiGrab combinations.

master
Carlos Reding 1 jaar geleden
bovenliggende
commit
05c5fed080
2 gewijzigde bestanden met toevoegingen van 29 en 16 verwijderingen
  1. 22
    8
      puppeteer/_core.py
  2. 7
    8
      pupuicon/translator/_core.py

+ 22
- 8
puppeteer/_core.py Bestand weergeven

@@ -55,11 +55,13 @@ else:
FILTER_PIN = 3 # Servo holding filters.
HEATER_PIN = 10 # Heating unit.
__FILTER_PWM__ = dict() # Filter locations
__FILTER_PWM__['Filter_1'] = 1775 # 475nm band-pass.
# Filter locations. All set to 1460 µS to prevent possible damages to the
# servo, and _force_ the user to set it up.
__FILTER_PWM__ = dict()
__FILTER_PWM__['Filter_1'] = 1460 # 475nm band-pass.
__FILTER_PWM__['Filter_2'] = 1460 # 520nm band-pass (centre).
__FILTER_PWM__['Filter_3'] = 1130 # 590 long-pass + 610nm short-pass.
__FILTER_PWM__['No_Filter'] = 850 # No filter (RGB image).
__FILTER_PWM__['Filter_3'] = 1460 # 590 long-pass + 610nm short-pass.
__FILTER_PWM__['No_Filter'] = 1460 # No filter (RGB image).
# Default camera settings
__SHUTTER_SPEED__ = 0.25 # Shutter speed time in SECONDS. Defaults to 0.25s
@@ -157,7 +159,7 @@ def img_acquisition_routine(self, light_range, wavelength, photo_path,
else:
self._device._modulate_LED_intensity(0, channel=wavelength)

def img_acquisition_routine_triplicate(self, light_intensity, wavelength,
def img_acquisition_routine_replicates(self, light_intensity, wavelength,
photo_path, file_name, flag=False,
Replicates=__REPLICATES__):
"""
@@ -623,7 +625,7 @@ class SetProtocol:
# can accelerate this further, but at the expense of a lower quality
# image.
for light_intensity in light_range:
self._device._camera.capture_sequence(img_acquisition_routine_triplicate(self,
self._device._camera.capture_sequence(img_acquisition_routine_replicates(self,
light_intensity,
wavelength,
photo_path,
@@ -827,8 +829,14 @@ class SetProtocol:
# Read plate
init_time = t.time() # Used to account for plate reading time.
for flt, wavelength in zip(self._filters, self._wavelengths):
warmup_init_t = t.time()
if flt == "Filter_2":
self._device._light_panel.set_PWM_frequency(self._device._GPIO_PIN[wavelength], LIGHT_FREQ_F2)
# Check if `wavelenght' is WHITE, as it is produced by combining mutiple PIN
if wavelength == 3:
for PIN in range(len(self._device._GPIO_PIN)):
self._device._light_panel.set_PWM_frequency(self._device._GPIO_PIN[PIN], LIGHT_FREQ_F2)
else:
self._device._light_panel.set_PWM_frequency(self._device._GPIO_PIN[wavelength], LIGHT_FREQ_F2)
# Set camera on-the-fly to adapt to different wavelenghts.
# Because this step happens with any filter, it does not require
# a post-read reset.
@@ -837,10 +845,16 @@ class SetProtocol:
servo_state = self._device.set_filter(flt, current_pwm=servo_state)
# self._data_acquisition(light_range, current_time, flt,
# wavelength, singleRead)
print("Time between reads: " + str(round(t.time() - warmup_init_t, 3)) + "s.")
self._data_acquisition_triplicate(light_range, current_time, flt,
wavelength, singleRead)
if flt == "Filter_2":
self._device._light_panel.set_PWM_frequency(self._device._GPIO_PIN[wavelength], DEFAULT_LIGHT_FREQ)
# Check if `wavelenght' is WHITE, as it is produced by combining mutiple PIN.
if wavelength == 3:
for PIN in range(len(self._device._GPIO_PIN)):
self._device._light_panel.set_PWM_frequency(self._device._GPIO_PIN[PIN], DEFAULT_LIGHT_FREQ)
else:
self._device._light_panel.set_PWM_frequency(self._device._GPIO_PIN[wavelength], DEFAULT_LIGHT_FREQ)
# Turn LED off
self._device._modulate_LED_intensity(0, channel=wavelength)

+ 7
- 8
pupuicon/translator/_core.py Bestand weergeven

@@ -45,13 +45,13 @@ class ProtocolHandler:
self.user_filters = [ f[1] - 1 for f in UserProtocol.filterToLEDPairing
if f[1] >= 0 ]
if -1 in self.user_filters:
idx = self.user_filters.index(-1)
self.user_filters[idx] = 3
for w in range(self.user_filters.count(-1)):
idx = self.user_filters.index(-1)
self.user_filters[idx] = 3
if len(self.user_filters) == 1:
self.user_filters = tuple(self.user_filters) # Singleton. `int' is not iterable.
else:
self.user_filters.sort() # Sort to minimise servo moves.

# LiMO wavelenghts:
# The GUI's wavelengths are laballed 0..3, where 0 corresponds to the
# WHITE light. In a multi-LED light panel containing RED (1), GREEN (2),
@@ -61,13 +61,12 @@ class ProtocolHandler:
self.user_wavelengths = [ f[0] - 1 for f in UserProtocol.filterToLEDPairing
if f[0] >= 0 ]
if -1 in self.user_wavelengths:
idx = self.user_wavelengths.index(-1)
self.user_wavelengths[idx] = 3
for w in range(self.user_wavelengths.count(-1)):
idx = self.user_wavelengths.index(-1)
self.user_wavelengths[idx] = 3
if len(self.user_wavelengths) == 1:
self.user_wavelengths = tuple(self.user_wavelengths) # Singleton. `int' is not iterable.
else:
self.user_wavelengths.sort() # Sort to minimise servo moves.

# LiMO data-processing flag
self.process_data = UserProtocol.doDataAnalysisOnLimo

Laden…
Annuleren
Opslaan