Skip to content
Snippets Groups Projects

Added custom LofarDeviceProxy to enhance support for high-dimensional arrays in attribtues

Merged Jan David Mol requested to merge reshape-highdim-arrays into main
All threads resolved!
Compare and Show latest version
3 files
+ 29
12
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -20,8 +20,8 @@ This includes:
SSTCollector
"""
# logging use & lazy string
# pylint: disable=W1203
# logging use & lazy string, (too-few-public-methods)
# pylint: disable=W1203, R0903
import abc
import logging
@@ -61,13 +61,13 @@ class StatisticsCollector(abc.ABC):
"last_invalid_packet": numpy.zeros((9000,), dtype=numpy.uint8),
}
def process_packet(self, packet, obj=None):
def process_packet(self, packet):
"""Baseclass wrapper around performing parse_packet"""
self.parameters["nof_packets"] += numpy.uint64(1)
try:
self.parse_packet(packet, obj)
self._parse_packet(packet)
except Exception as err:
self.parameters["last_invalid_packet"] = numpy.frombuffer(
packet, dtype=numpy.uint8
@@ -77,7 +77,7 @@ class StatisticsCollector(abc.ABC):
raise ValueError("Could not parse statistics packet") from err
@abc.abstractmethod
def parse_packet(self, packet, obj):
def _parse_packet(self, packet):
"""Update any information based on this packet."""
raise NotImplementedError
@@ -124,7 +124,7 @@ class SSTCollector(StatisticsCollector):
return defaults
def parse_packet(self, packet, obj):
def _parse_packet(self, packet):
fields = SSTPacket(packet)
# determine which input this packet contains data for
@@ -265,7 +265,7 @@ class XSTCollector(StatisticsCollector):
# prefer the first one in case of multiple minima
return numpy.where(self.parameters["xst_timestamps"] == oldest_timestamp)[0][0]
def parse_packet(self, packet, obj=None):
def _parse_packet(self, packet):
fields = XSTPacket(packet)
if fields.payload_error:
@@ -466,7 +466,7 @@ class BSTCollector(StatisticsCollector):
return defaults
def parse_packet(self, packet, obj=None):
def _parse_packet(self, packet):
fields = BSTPacket(packet)
# To get the block_index we floor divide this beamlet_index by the max amount
Loading