Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix docs-check job; numpy 2.x fixes #157

Merged
merged 12 commits into from
Jun 25, 2024
38 changes: 24 additions & 14 deletions azure-pipelines-data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,18 @@ stages:
inputs:
versionSpec: '3.9'

- bash: python3.9 -m venv venv
- bash: python3.9 -m venv $(Agent.TempDirectory)/venv
displayName: 'create venv'

- bash: ./venv/bin/pip install -U tox tox-uv uv
- bash: $(Agent.TempDirectory)/venv/bin/pip install -U tox tox-uv uv
displayName: 'install tox'

- ${{ if eq(parameters.recreate_tox, true) }}:
- bash: ./venv/bin/tox -e notebooks -r -- examples/*.ipynb -v
- bash: $(Agent.TempDirectory)/venv/bin/tox -e notebooks -r -- examples/*.ipynb -v
displayName: 'Run nbval tests $(Agent.OS) (recreating)'

- ${{ if eq(parameters.recreate_tox, false) }}:
- bash: ./venv/bin/tox -e notebooks -- examples/*.ipynb -v
- bash: $(Agent.TempDirectory)/venv/bin/tox -e notebooks -- examples/*.ipynb -v
displayName: 'Run nbval tests $(Agent.OS)'

- bash: ./scripts/codecov.sh -f ./coverage.xml
Expand Down Expand Up @@ -84,13 +84,16 @@ stages:
- bash: python3.11 -m venv $(Agent.TempDirectory)/venv
displayName: 'create venv'

- bash: $(Agent.TempDirectory)/venv/bin/pip install $(Build.SourcesDirectory)/LiberTEM/
- bash: $(Agent.TempDirectory)/venv/bin/pip install uv
displayName: 'install uv'

- bash: source $(Agent.TempDirectory)/venv/bin/activate && $(Agent.TempDirectory)/venv/bin/uv pip install $(Build.SourcesDirectory)/LiberTEM/
displayName: 'install LiberTEM'

- bash: $(Agent.TempDirectory)/venv/bin/pip install $(Build.SourcesDirectory)/LiberTEM-live/
- bash: source $(Agent.TempDirectory)/venv/bin/activate && $(Agent.TempDirectory)/venv/bin/uv pip install $(Build.SourcesDirectory)/LiberTEM-live/
displayName: 'install LiberTEM-live'

- bash: $(Agent.TempDirectory)/venv/bin/pip install -r $(Build.SourcesDirectory)/LiberTEM-live/test_requirements.txt
- bash: source $(Agent.TempDirectory)/venv/bin/activate && $(Agent.TempDirectory)/venv/bin/uv pip install -r $(Build.SourcesDirectory)/LiberTEM-live/test_requirements.txt
displayName: 'install LiberTEM-live test requirements'

- bash: cd $(Build.SourcesDirectory)/LiberTEM-live/ && $(Agent.TempDirectory)/venv/bin/pytest --durations=10 --cov=libertem_live --cov-report=term --cov-report=html --cov-report=xml --cov-config=setup.cfg --junitxml=junit.xml tests/
Expand Down Expand Up @@ -129,13 +132,13 @@ stages:
inputs:
versionSpec: '$(python.version)'

- bash: python3.9 -m venv venv
- bash: python3.9 -m venv $(Agent.TempDirectory)/venv
displayName: 'create venv'

- bash: ./venv/bin/pip install -U tox tox-uv uv
- bash: $(Agent.TempDirectory)/venv/bin/pip install -U tox tox-uv uv
displayName: 'install tox'

- bash: ./venv/bin/tox -r
- bash: $(Agent.TempDirectory)/venv/bin/tox -r
displayName: 'Run tox tests $(TOXENV) $(Agent.OS)'

- bash: ./scripts/codecov.sh -f ./coverage.xml
Expand Down Expand Up @@ -167,13 +170,20 @@ stages:

- bash: apt install -y pandoc
displayName: install required debian packages
- bash: pip install -U tox tox-uv uv
displayName: 'install requirements'

- bash: rm -rf venv
displayName: 'clean up old venv, if any'

- bash: python3.9 -m venv $(Agent.TempDirectory)/venv
displayName: 'create venv'

- bash: $(Agent.TempDirectory)/venv/bin/pip install -U tox
displayName: 'install tox'

- ${{ if eq(parameters.recreate_tox, true) }}:
- bash: tox -r
- bash: $(Agent.TempDirectory)/venv/bin/tox -r
displayName: 'Run tox tests $(TOXENV) $(Agent.OS) (recreating)'

- ${{ if eq(parameters.recreate_tox, false) }}:
- bash: tox
- bash: $(Agent.TempDirectory)/venv/bin/tox
displayName: 'Run tox tests $(TOXENV) $(Agent.OS)'
7 changes: 4 additions & 3 deletions src/libertem_live/detectors/merlin/decoders.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import numba
import numpy as np


@numba.njit(cache=True)
Expand All @@ -7,8 +8,8 @@ def decode_u2(inp, out):
row_out = out[y]
row_in = inp[y]
for i in range(row_in.shape[0] // 2):
o0 = row_in[i * 2 + 0] << 8
o1 = row_in[i * 2 + 1] << 0
o0 = np.uint16(row_in[i * 2 + 0]) << 8
o1 = np.uint16(row_in[i * 2 + 1]) << 0
row_out[i] = o0 | o1


Expand Down Expand Up @@ -183,7 +184,7 @@ def decode_r12(inp, out):
col = i % 4
pos = i // 4
out_pos = (pos + 1) * 4 - col - 1
row_out[out_pos] = (row_in[i * 2] << 8) + (row_in[i * 2 + 1] << 0)
row_out[out_pos] = (np.uint16(row_in[i * 2]) << 8) + (row_in[i * 2 + 1] << 0)


@numba.njit(nogil=True, cache=True, parallel=False)
Expand Down
Loading