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

catching up with main #366

Merged
merged 3 commits into from
Apr 2, 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
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ repos:
- id: check-toml

- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
rev: v3.15.2
hooks:
- id: pyupgrade
args: [--py38-plus]

- repo: https://github.com/psf/black
rev: 23.12.1
rev: 24.3.0
hooks:
- id: black
types: [python]
Expand All @@ -52,34 +52,34 @@ repos:
args: ["--profile", "black"]

- repo: https://github.com/nbQA-dev/nbQA
rev: 1.7.1
rev: 1.8.5
hooks:
- id: nbqa-black
- id: nbqa-flake8
args: ["--extend-ignore=E203,E402,E501"]
- id: nbqa-isort

- repo: https://github.com/kynan/nbstripout
rev: 0.6.1
rev: 0.7.1
hooks:
- id: nbstripout

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
rev: v1.9.0
hooks:
- id: mypy
args:
- --explicit-package-bases

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: "v0.1.13"
rev: "v0.3.5"
hooks:
- id: ruff

# Serious pylint errors that will be enforced by CI
- repo: https://github.com/pycqa/pylint
rev: v3.0.3
rev: v3.1.0
hooks:
- id: pylint
args:
Expand Down
1 change: 1 addition & 0 deletions clarity/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""pyClarity"""

from importlib.metadata import PackageNotFoundError, version

try:
Expand Down
1 change: 1 addition & 0 deletions clarity/data/HOA_tools_cec2.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tools to support higher order ambisonic processing."""

from __future__ import annotations

import logging
Expand Down
1 change: 1 addition & 0 deletions clarity/data/demo_data.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions for downloading demo data."""

import os
from pathlib import Path

Expand Down
1 change: 1 addition & 0 deletions clarity/data/scene_builder_cec2.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Code for building the scenes.json files."""

from __future__ import annotations

import itertools
Expand Down
1 change: 1 addition & 0 deletions clarity/data/scene_renderer_cec1.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Scene rendering for CEC1 challenge."""

import logging
import math
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions clarity/data/scene_renderer_cec2.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Clarity ambisonic scene rendering."""

import json
import logging
import math
Expand Down
1 change: 1 addition & 0 deletions clarity/data/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utilities for data generation."""

from __future__ import annotations

from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions clarity/engine/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Adopted from Asteroid
https://github.com/asteroid-team/asteroid/blob/master/asteroid/engine/system.py
"""

import pytorch_lightning as pl
from torch.optim.lr_scheduler import ReduceLROnPlateau

Expand Down
1 change: 1 addition & 0 deletions clarity/enhancer/compressor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Compressor Class"""

from __future__ import annotations

from typing import Any, Final
Expand Down
1 change: 1 addition & 0 deletions clarity/enhancer/dnn/mc_conv_tasnet.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Adopted from https://github.com/kaituoxu/Conv-TasNet"""

from __future__ import annotations

import math
Expand Down
1 change: 1 addition & 0 deletions clarity/evaluator/haaqi/haaqi.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Matlab's haaqi version 1 to python version."""

from __future__ import annotations

import logging
Expand Down
1 change: 1 addition & 0 deletions clarity/evaluator/haspi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""HASPI intelligibility index."""

from clarity.evaluator.haspi.haspi import haspi_v2, haspi_v2_be

__all__ = ["haspi_v2", "haspi_v2_be"]
1 change: 1 addition & 0 deletions clarity/evaluator/haspi/eb.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for HASPI, HASQI, HAAQI EBs"""

from __future__ import annotations

# pylint: disable=import-error
Expand Down
1 change: 1 addition & 0 deletions clarity/evaluator/haspi/ebm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""HASPI EBM module"""

from __future__ import annotations

from math import floor
Expand Down
1 change: 1 addition & 0 deletions clarity/evaluator/haspi/haspi.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""HASPI intelligibility Index"""

from __future__ import annotations

import logging
Expand Down
1 change: 1 addition & 0 deletions clarity/evaluator/haspi/ip.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions for HASPI neural network stage."""

from __future__ import annotations

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions clarity/evaluator/mbstoi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Modified Binaural Short-Time Objective Intelligibility Evaluator"""

from clarity.evaluator.mbstoi.mbstoi import mbstoi

__all__ = ["mbstoi"]
1 change: 1 addition & 0 deletions clarity/evaluator/mbstoi/mbstoi.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Modified Binaural Short-Time Objective Intelligibility (MBSTOI) Measure"""

import importlib.resources as pkg_resources
import logging
import math
Expand Down
1 change: 1 addition & 0 deletions clarity/evaluator/mbstoi/mbstoi_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utilities for MBSTOI processing."""

from __future__ import annotations

import logging
Expand Down
1 change: 1 addition & 0 deletions clarity/evaluator/msbg/cochlea.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Gammatone filterbank simulation of the Cochlea."""

from __future__ import annotations

import logging
Expand Down
1 change: 1 addition & 0 deletions clarity/evaluator/msbg/msbg.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implementation of the MSBG hearing loss model."""

from __future__ import annotations

import logging
Expand Down
1 change: 1 addition & 0 deletions clarity/evaluator/msbg/msbg_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Support for the MSBG hearing loss model."""

from __future__ import annotations

import json
Expand Down
1 change: 1 addition & 0 deletions clarity/evaluator/msbg/smearing.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Temporal smearing component of MSBG model."""

from __future__ import annotations

import math
Expand Down
1 change: 1 addition & 0 deletions clarity/predictor/torch_msbg.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
An FIR-based torch implementation of approximated MSBG hearing loss model
"""

from __future__ import annotations

import json
Expand Down
1 change: 1 addition & 0 deletions clarity/predictor/torch_stoi.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
and star the repo. The pip version of torch_stoi does not include EPS in line 127 & 128,
hence could lead to sqrt(0)
"""

from typing import Final

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions clarity/utils/audiogram.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Dataclass to represent a monaural audiogram"""

from __future__ import annotations

import json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

These are 2 separated class to keep the logic separated
"""

from __future__ import annotations

from typing import Final
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Class to generate the car noise signal.
"""

from __future__ import annotations

from typing import Final
Expand Down
1 change: 1 addition & 0 deletions clarity/utils/file_io.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""File I/O functions."""

from __future__ import annotations

import json
Expand Down
1 change: 1 addition & 0 deletions clarity/utils/flac_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Class for encoding and decoding audio signals
using flac compression.
"""

from __future__ import annotations

import logging
Expand Down
1 change: 1 addition & 0 deletions clarity/utils/results_support.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Dataclass to save challenges results to a CSV file."""

from __future__ import annotations

# pylint: disable=import-error
Expand Down
1 change: 1 addition & 0 deletions clarity/utils/signal_processing.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Signal processing utilities."""

# pylint: disable=import-error
from __future__ import annotations

Expand Down
1 change: 1 addition & 0 deletions clarity/utils/source_separation_support.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module that contains functions for source separation."""

from __future__ import annotations

# pylint: disable=import-error
Expand Down
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Sphinx configuration"""

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
Expand Down
1 change: 1 addition & 0 deletions recipes/cad1/task1/baseline/enhance.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" Run the dummy enhancement. """

from __future__ import annotations

# pylint: disable=too-many-locals
Expand Down
1 change: 1 addition & 0 deletions recipes/cad1/task1/baseline/evaluate.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Evaluate the enhanced signals using the HAAQI metric."""

from __future__ import annotations

# pylint: disable=too-many-locals
Expand Down
1 change: 1 addition & 0 deletions recipes/cad1/task1/baseline/test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" Run the baseline enhancement. """

from __future__ import annotations

# pylint: disable=import-error
Expand Down
1 change: 1 addition & 0 deletions recipes/cad1/task2/baseline/audio_manager.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A utility class for managing audio files."""

from __future__ import annotations

import logging
Expand Down
1 change: 1 addition & 0 deletions recipes/cad1/task2/baseline/baseline_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utility functions for the baseline model."""

from __future__ import annotations

# pylint: disable=import-error
Expand Down
1 change: 1 addition & 0 deletions recipes/cad1/task2/baseline/car_scene_acoustics.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A class for the car acoustic environment."""

# pylint: disable=import-error
# pylint: disable=too-many-instance-attributes
from __future__ import annotations
Expand Down
1 change: 1 addition & 0 deletions recipes/cad1/task2/baseline/enhance.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" Run the dummy enhancement. """

# pylint: disable=too-many-locals
# pylint: disable=import-error
from __future__ import annotations
Expand Down
1 change: 1 addition & 0 deletions recipes/cad1/task2/baseline/evaluate.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Evaluate the enhanced signals using the HAAQI metric."""

# pylint: disable=too-many-locals
# pylint: disable=import-error
from __future__ import annotations
Expand Down
1 change: 1 addition & 0 deletions recipes/cad1/task2/baseline/test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" Run the dummy enhancement. """

# pylint: disable=too-many-locals
# pylint: disable=import-error
from __future__ import annotations
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module to Generate the metadata for the scenes in the CAD-1 Task-2 challenge."""

# pylint: disable=import-error
from __future__ import annotations

Expand Down
1 change: 1 addition & 0 deletions recipes/cad_icassp_2024/baseline/enhance.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" Run the dummy enhancement. """

from __future__ import annotations

import json
Expand Down
1 change: 1 addition & 0 deletions recipes/cad_icassp_2024/baseline/evaluate.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Evaluate the enhanced signals using the HAAQI metric."""

from __future__ import annotations

# pylint: disable=import-error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- The metadata of the music at the hearing aids microphone.
- The music signals at the hearing aids microphone.
"""

from __future__ import annotations

# pylint: disable=import-error
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module to generate the scenes and scene-listeners metadata files for training"""

from __future__ import annotations

# pylint: disable=import-error
Expand Down
1 change: 1 addition & 0 deletions recipes/cpc1/e029_sheffield/prepare_data.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Data preparation for the E029 Sheffield CPC1 recipe."""

import csv
import json
import logging
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

Modified by Zehai Tu for uncertainty estimation with ensemble
"""

import speechbrain as sb
import torch
from speechbrain.decoders.ctc import CTCPrefixScorer
Expand Down
1 change: 1 addition & 0 deletions recipes/cpc1/e032_sheffield/prepare_data.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Data preparation for the E032 Sheffield CPC1 recipe."""

import csv
import json
import logging
Expand Down
1 change: 1 addition & 0 deletions recipes/cpc1/e032_sheffield/transformer_cpc1_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Mirco Ravanelli 2020
* Sung-Lin Yeh 2020
"""

import speechbrain as sb
import torch
from speechbrain.decoders.ctc import CTCPrefixScorer
Expand Down
1 change: 1 addition & 0 deletions recipes/cpc2/baseline/compute_haspi.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" Compute the HASPI scores. """

from __future__ import annotations

import hashlib
Expand Down
1 change: 1 addition & 0 deletions recipes/cpc2/baseline/evaluate.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Evaluate the predictions against the ground truth correctness values"""

import json
import logging
from pathlib import Path
Expand Down
Loading
Loading