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

pass all pytest tests #6

Merged
merged 4 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 30 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,34 @@
name: Run Unit Test via Pytest

on: [push]

name: "Test"
on:
push:
pull_request:
workflow_dispatch:
jobs:
tests:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]

steps:
- uses: actions/[email protected]
- uses: cachix/install-nix-action@v17
- run: nix flake check
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with Ruff
run: |
pip install ruff
ruff --format=github --target-version=py310 .
continue-on-error: true
- name: Test with pytest
run: |
pip install coverage pytest
coverage run -m pytest -v -s
- name: Generate Coverage Report
run: |
coverage report -m

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.vscode

*.py[cod]

*.pyc
Expand Down
1 change: 0 additions & 1 deletion acoustic_toolbox/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
The acoustic_toolbox module.

"""
import acoustic_toolbox.aio
import acoustic_toolbox.ambisonics
import acoustic_toolbox.atmosphere
import acoustic_toolbox.bands
Expand Down
115 changes: 0 additions & 115 deletions acoustic_toolbox/aio.py

This file was deleted.

3 changes: 2 additions & 1 deletion acoustic_toolbox/room.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ def mean_alpha(alphas, surfaces):
:param alphas: Absorption coefficients :math:`\\alpha`.
:param surfaces: Surfaces :math:`S`.
"""
return np.average(alphas, axis=0, weights=surfaces)
axis = None if np.ndim(alphas) == 0 else 0
return np.average(alphas, axis=axis, weights=surfaces)


def nrc(alphas):
Expand Down
2 changes: 0 additions & 2 deletions acoustic_toolbox/standards/iec_61672_1_2013.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,6 @@ def integrate(data, sample_frequency, integration_time):
This results in a drift of samples for longer signals (e.g. 60 minutes at 44.1 kHz).

"""
integration_time = np.asarray(integration_time)
sample_frequency = np.asarray(sample_frequency)
samples = data.shape[-1]
b, a = zpk2tf([1.0], [1.0, integration_time], [1.0])
b, a = bilinear(b, a, fs=sample_frequency)
Expand Down
Loading
Loading