From be86f40bf96b3584936827ae1e7936780f96543b Mon Sep 17 00:00:00 2001 From: Aaron Parsons Date: Wed, 8 May 2024 11:46:55 -0700 Subject: [PATCH 1/3] Updated SNAPADC interface to conform to new casperfpga method for building block interfaces --- setup.py | 2 +- src/casperfpga.py | 11 ++++++++--- src/snapadc.py | 8 ++++++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index 2dc7f90..001cba0 100644 --- a/setup.py +++ b/setup.py @@ -54,7 +54,7 @@ 'IPython', 'future', 'numpy', - 'katcp==0.9.1', + 'katcp>=0.9.3', 'katversion', 'odict', 'setuptools', diff --git a/src/casperfpga.py b/src/casperfpga.py index ecf57d2..25ab824 100644 --- a/src/casperfpga.py +++ b/src/casperfpga.py @@ -4,7 +4,12 @@ import socket from time import strptime import string -import collections +try: + from collections import Callable +except(ImportError): + # starting in Python 3.10, Callable is in abc + from collections.abc import Callable + from . import register from . import sbram @@ -625,7 +630,7 @@ def _create_memory_devices(self, device_dict, memorymap_dict, legacy_reg_map=Tru except KeyError: pass else: - if not isinstance(known_device_class, collections.Callable): + if not isinstance(known_device_class, Callable): raise TypeError('%s is not a callable Memory class - ' 'that\'s a problem.' % known_device_class) @@ -692,7 +697,7 @@ def _create_casper_adc_devices(self, device_dict, initialise=False, **kwargs): except KeyError: pass else: - if not isinstance(known_device_class, collections.Callable): + if not isinstance(known_device_class, Callable): errmsg = '{} is not a callable ADC Class'.format(known_device_class) raise TypeError(errmsg) diff --git a/src/snapadc.py b/src/snapadc.py index 5cadf43..a48b769 100644 --- a/src/snapadc.py +++ b/src/snapadc.py @@ -1020,7 +1020,7 @@ def isLaneBonded(self, bondAllAdcs=False): def from_device_info(cls, parent, device_name, device_info, initialize=False, **kwargs): """ Process device info and the memory map to get all the necessary info - and return a SKARAB ADC instance. + and return a ADC instance. :param parent: The parent device, normally a casperfpga instance :param device_name: :param device_info: @@ -1029,4 +1029,8 @@ def from_device_info(cls, parent, device_name, device_info, initialize=False, ** :param kwargs: :return: """ - return cls(parent, device_name, device_info, initialize, **kwargs) + host = parent + #return cls(parent, device_name, device_info, initialize, **kwargs) + # XXX should device_info be passed as kwargs to cls? Would require renaming + # some parameters, so am not for now. + return cls(host) From 3da210a792f4e8f0d00ddb740f7f837d2d66bd7d Mon Sep 17 00:00:00 2001 From: Aaron Parsons Date: Wed, 8 May 2024 13:32:42 -0700 Subject: [PATCH 2/3] Put the chip argument back in to SnapADC.rampTest (as it had been in HERA) --- src/snapadc.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/snapadc.py b/src/snapadc.py index a48b769..ff65bac 100644 --- a/src/snapadc.py +++ b/src/snapadc.py @@ -962,8 +962,9 @@ def isFrameClockAligned(self): logger.error('Frame clock NOT aligned.\n{0}'.format(str(errs))) return False - def rampTest(self, nchecks=300, retry=False): - chips = self.adcList + def rampTest(self, chips=None, nchecks=300, retry=False): + if chips is None: + chips = self.adcList self.logger.debug('Ramp test on ADCs: %s' % str(chips)) failed_chips = {} self.setDemux(numChannel=1) @@ -972,7 +973,7 @@ def rampTest(self, nchecks=300, retry=False): self.adc.test("en_ramp") for cnt in range(nchecks): self.snapshot() - for chip,d in self.readRAM(signed=False).items(): + for chip,d in self.readRAM(chips, signed=False).items(): ans = (predicted + d[0,0]) % 256 failed_lanes = np.sum(d != ans, axis=0) if np.any(failed_lanes) > 0: From 30fcba071b160de989c36edc9dbc9938eb26604f Mon Sep 17 00:00:00 2001 From: Aaron Parsons Date: Thu, 16 May 2024 10:11:31 -0700 Subject: [PATCH 3/3] Updated .github/workflows/run_test.yaml to target py38 and py311 tests --- .github/workflows/run_test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run_test.yaml b/.github/workflows/run_test.yaml index fcbea1a..ee12b8a 100644 --- a/.github/workflows/run_test.yaml +++ b/.github/workflows/run_test.yaml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.8.3"] + python-version: [3.8, 3.11] steps: - uses: actions/checkout@v3