Skip to content
Snippets Groups Projects
Commit d40d8e70 authored by David Hammer's avatar David Hammer
Browse files

Merge branch 'dev/correction-addons-interface' into 'master'

Fix correction addon interface

See merge request !128
parents 7cc4ab90 8558374c
No related branches found
No related tags found
1 merge request!128Fix correction addon interface
......@@ -545,9 +545,7 @@ class BaseCorrection(PythonDevice):
addon_prefix = f"addons.{addon_class.__name__}"
if not self.get(f"{addon_prefix}.enable"):
continue
addon = addon_class(self._parameters[addon_prefix])
addon._device = self
addon._prefix = addon_prefix
addon = addon_class(self, addon_prefix, self._parameters[addon_prefix])
self._enabled_addons.append(addon)
if (
(self.get("useShmemHandles") != self._use_shmem_handles)
......
......@@ -15,9 +15,10 @@ class BaseCorrectionAddon:
and add properties to it."""
pass
def __init__(self, config):
def __init__(self, device, prefix, config):
"""Will be given the node from extend_device_schema, no prefix needed here"""
pass
self._device = device
self._prefix = prefix
def post_correction(
self, train_id, processed_data, cell_table, pulse_table, output_hash
......
......@@ -11,7 +11,8 @@ def maybe_get(a):
class IntegratedIntensity(BaseCorrectionAddon):
def __init__(self, config):
def __init__(self, device, prefix, config):
super().__init__(device, prefix, config)
global cupy
import cupy
......
......@@ -6,7 +6,8 @@ from .base_addon import BaseCorrectionAddon
class LitPixelCounter(BaseCorrectionAddon):
def __init__(self, config):
def __init__(self, device, prefix, config):
super().__init__(device, prefix, config)
global cupy
import cupy
......
......@@ -169,7 +169,8 @@ class Peakfinder9(BaseCorrectionAddon):
except AttributeError:
pass
def __init__(self, config):
def __init__(self, device, prefix, config):
super().__init__(device, prefix, config)
global cupy
import cupy
......
......@@ -30,7 +30,8 @@ class RandomFrames(BaseCorrectionAddon):
.commit(),
)
def __init__(self, config):
def __init__(self, device, prefix, config):
super().__init__(device, prefix, config)
# TODO: figure out why no / 100 here...
self._probability = config["probability"]
......
......@@ -87,7 +87,8 @@ def saturation_monitoring_schema(schema=None):
class SaturationMonitor(BaseCorrectionAddon):
def __init__(self, config):
def __init__(self, device, prefix, config):
super().__init__(device, prefix, config)
global cupy
import cupy
self._alarmThreshold = config["alarmThreshold"]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment