diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index e5ad6c8..e2c86ae 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -17,6 +17,7 @@ jobs: fail-fast: False matrix: python-version: ["3.9", "3.10", "3.11"] + numpy-version: [ "numpy<2.0" , "numpy>=2.0" ] steps: # try to cache package install @@ -24,28 +25,33 @@ jobs: with: apt: protobuf-compiler - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} + + - name: Set up Python ${{ matrix.python-version }} ${{ matrix.numpy-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + cache-dependency-path: | + **/pyproject.toml + **/requirements*.txt + - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install flake8 pytest wheel setuptools + python -m pip install flake8 pytest wheel setuptools build if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: build and binary module run: | python setup.py build_proto_c python -m pip wheel ./ python -m pip install ./ - - - name: Archive wheel - uses: actions/upload-artifact@v4 - with: - name: bact_archiver_${{ matrix.python-version }} - path: bact_archiver*.whl - retention-days: 14 - + + #- name: Archive wheel + # uses: actions/upload-artifact@v4 + # with: + # name: bact_archiver_${{ matrix.python-version }} + # path: bact_archiver*.whl + # retention-days: 14 + - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names diff --git a/bact_archiver/carchiver.py b/bact_archiver/carchiver.py index 836efd9..ae52def 100644 --- a/bact_archiver/carchiver.py +++ b/bact_archiver/carchiver.py @@ -100,7 +100,7 @@ def get_data_from_archiver(data): res.append(chunk.value) header = chunk.header years.extend(chunk.header.year * - np.ones(len(chunk.value[0]), dtype=np.int)) + np.ones(len(chunk.value[0]), dtype=int)) logger.debug(chunk.header) # print('found data:',len(chunk.value[0])) else: @@ -158,13 +158,16 @@ def get_data(data, *, return_type='pandas', time_format='timestamp', return None elif len(res) == 1: values, secs, nanos = res[0] - years = years[0] * np.ones(len(secs), dtype=np.int) + years = years[0] * np.ones(len(secs), dtype=int) # print('One Chunk Only') # print('chunk.header.year = ',chunk.header.year) else: # if multible chunks, combine data and return # print("{} chunks found".format(len(res))) values = np.concatenate([r[0] for r in res]) + + + secs = np.concatenate([r[1] for r in res]) nanos = np.concatenate([r[2] for r in res]) diff --git a/proto/epics_event.pyx b/proto/epics_event.pyx index 7edeea8..56ee129 100644 --- a/proto/epics_event.pyx +++ b/proto/epics_event.pyx @@ -196,7 +196,7 @@ cdef read_chunk_i4(char[:] seq, int N, np.ndarray[np.int32_t] secs, np.ndarray[n @cython.boundscheck(False) @cython.wraparound(False) cdef read_chunk_f8(char[:] seq, int N, np.ndarray[np.int32_t] secs, np.ndarray[np.int32_t] nanos): - cdef np.ndarray[np.float_t] values = np.empty(N,dtype=np.float) + cdef np.ndarray[np.float_t] values = np.empty(N,dtype=float) cdef ScalarDouble event diff --git a/pyproject.toml b/pyproject.toml index d87c7d6..4779476 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta" name = "bact-archiver" # url = # fullname = "BACT epics archiver appliance access" -version = "0.2.2" +version = "0.2.3" description = "EPICS archiver appliance access using google protobuf" readme="README.rst" authors = [ diff --git a/tests/test_carchiver.py b/tests/test_carchiver.py index 7a4a3c7..ef2dc3f 100644 --- a/tests/test_carchiver.py +++ b/tests/test_carchiver.py @@ -3,6 +3,7 @@ import logging from bact_archiver.pyarchiver import get_data +from bact_archiver.carchiver import get_data_from_archiver as get_data from common import test_data_dir log = logging.getLogger('test') @@ -21,6 +22,8 @@ def read(self, fname): def run_decode(self, *, fname=None, **kw): data = self.read(fname) + tmp = get_data(data) + return header, values = get_data(data) log.debug('Header %s', header)