Skip to content

Commit

Permalink
Merge pull request #67 from casper-astro/py311
Browse files Browse the repository at this point in the history
Updates to make py311 compatible, and a couple of snapadc tweaks.
  • Loading branch information
jkocz authored May 16, 2024
2 parents 0b07705 + a641376 commit 6ee0e57
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/run_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8"]

python-version: [3.8, 3.11]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
'IPython',
'future',
'numpy',
'katcp==0.9.3',
'katcp>=0.9.3',
'katversion',
'odict',
'setuptools',
Expand Down
6 changes: 5 additions & 1 deletion src/casperfpga.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
import socket
from time import strptime
import string
from collections.abc import Callable
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
Expand Down
15 changes: 10 additions & 5 deletions src/snapadc.py
Original file line number Diff line number Diff line change
Expand Up @@ -982,8 +982,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)
Expand All @@ -992,7 +993,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:
Expand Down Expand Up @@ -1040,7 +1041,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:
Expand All @@ -1049,4 +1050,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)

0 comments on commit 6ee0e57

Please sign in to comment.