Encoder channel names in the Nexus file
Reported by @claustre
The Encoders
can have three counters named position
, position_raw
and position_error
. As a result you will have three NXdetector
's called position
, position_raw
and position_error
. Unless you have another encoder, in which case it will add the name of the upper level from the Redis db_name (which is SamplingCounterController.name
) to avoid name collisions.
Any suggestions @pithan @matias.guijarro ? From the nexus writer's perspective, each of those three are individual detectors with a name that is not very specific. It's like the P201 actually, but there the channel names are typically meaningful (like iodet, idet, ...) and the channels can be regarded as independent detectors.
Maybe the encoder counters should work like the diode7 from the test suite (STATS counter or whatever it is) or like the lima roi counters.
class Encoder:
def __init__(self, name, controller, config):
self._counter_controller = counter.SamplingCounterController(name)
self._counter_controller.create_counter(
SamplingCounter, "position", unit=config.get("unit")
)
class EncoderFilter(Encoder):
POSSIBLE_COUNTERS = ["position_raw", "position_error"]
def __init__(self, name, controller, config):
super().__init__(name, controller, config)
enable_counters = config.get("enable_counters", [])
for cnt_name in enable_counters:
if cnt_name not in EncoderFilter.POSSIBLE_COUNTERS:
raise ValueError(
f"Counter can't be {cnt_name} only "
f"be in {EncoderFilter.POSSIBLE_COUNTERS}"
)
self._counter_controller.create_counter(
SamplingCounter, cnt_name, unit=config.get("unit")
)