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

Fixed smear3 to work with newer numpy versions #346

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
7 changes: 4 additions & 3 deletions clarity/evaluator/msbg/smearing.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,11 @@ def smear3(f_smear: ndarray, inbuffer: ndarray) -> ndarray:
winwave = np.zeros(FFT_SIZE)
winwave[0:FRAME_SIZE] = window * inwave.flatten()
spectrum = np.fft.fft(winwave, FFT_SIZE)
power = spectrum[0:nyquist] * np.conj(spectrum[0:nyquist])
mag = np.sqrt(power)

mag = np.abs(spectrum[0:nyquist])
phasor = spectrum[0:nyquist] / (mag + (mag == 0))
smeared = np.dot(f_smear, power)

smeared = np.dot(f_smear, (mag**2).astype(complex))
spectrum[0:nyquist] = np.sqrt(smeared) * phasor
spectrum[nyquist] = 0
spectrum[(nyquist + 1) : FFT_SIZE] = np.conj(spectrum[nyquist - 1 : 0 : -1])
Expand Down
201 changes: 78 additions & 123 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,104 +1,92 @@
[build-system]
requires = [
"setuptools >= 45",
"setuptools_scm[toml]>=6.2",
"wheel",
]
requires = ["setuptools >= 45", "setuptools_scm[toml]>=6.2", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "pyclarity"
description = "Tools for the Clarity Challenge"
readme = "README.md"
license = {text = "MIT"}
license = { text = "MIT" }
dynamic = ["version"]
authors = [
{name = "The PyClarity Team", email = "claritychallengecontact@gmail.com"},
{ name = "The PyClarity Team", email = "claritychallengecontact@gmail.com" },
]
classifiers = [
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Natural Language :: English",
]
keywords = [
"hearing",
"signal processing",
"clarity challenge"
]
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Natural Language :: English",
]
keywords = ["hearing", "signal processing", "clarity challenge"]
requires-python = ">=3.8"
dependencies = [
"audioread>=2.1.9",
"gdown",
"hydra-core>=1.1.1",
"hydra-submitit-launcher>=1.1.6",
"importlib-metadata",
"librosa>=0.8.1",
"matplotlib",
"numba>=0.57.0rc",
"numpy>=1.21.6,<1.25.0",
"omegaconf>=2.1.1",
"pandas>=1.3.5",
"pyflac",
"pyloudnorm>=0.1.0",
"pystoi",
"pytorch-lightning",
"resampy",
"scikit-learn>=1.0.2",
"scipy>=1.7.3",
"SoundFile>=0.10.3.post1",
"soxr",
"torch>=2",
"torchaudio",
"tqdm>=4.62.3",
"typing_extensions",
"audioread>=2.1.9",
"gdown",
"hydra-core>=1.1.1",
"hydra-submitit-launcher>=1.1.6",
"importlib-metadata",
"librosa>=0.8.1",
"matplotlib",
"numba>=0.57.0rc",
"numpy>=1.21.6",
"omegaconf>=2.1.1",
"pandas>=1.3.5",
"pyflac",
"pyloudnorm>=0.1.0",
"pystoi",
"pytorch-lightning",
"resampy",
"scikit-learn>=1.0.2",
"scipy>=1.7.3",
"SoundFile>=0.10.3.post1",
"soxr",
"torch>=2",
"torchaudio",
"tqdm>=4.62.3",
"typing_extensions",
]

[project.optional-dependencies]
tests = [
"coverage",
"isort",
"flake8",
"flake8-print",
"Flake8-pyproject",
"mypy",
"pre-commit",
"py",
"py-cpuinfo",
"pytest",
"pytest-cov",
"pytest-mock",
"pytest-mpl",
"pytest-regtest",
"pytest-skip-slow",
"pytest-xdist",
"yamllint",
]
docs =[
"sphinx",
"myst_parser",
"pydata_sphinx_theme",
"sphinx_markdown_tables",
"sphinx_rtd_theme",
"sphinxcontrib-mermaid",
"sphinxcontrib-napoleon",
"coverage",
"isort",
"flake8",
"flake8-print",
"Flake8-pyproject",
"mypy",
"pre-commit",
"py",
"py-cpuinfo",
"pytest",
"pytest-cov",
"pytest-mock",
"pytest-mpl",
"pytest-regtest",
"pytest-skip-slow",
"pytest-xdist",
"yamllint",
]
docs = [
"sphinx",
"myst_parser",
"pydata_sphinx_theme",
"sphinx_markdown_tables",
"sphinx_rtd_theme",
"sphinxcontrib-mermaid",
"sphinxcontrib-napoleon",
]
dev = [
"black",
"pre-commit",
"pycodestyle",
"pylint",
"pylint-pytest",
"yamllint",
]
pypi =[
"build",
"wheel",
"setuptools_scm[toml]"
]
"black",
"pre-commit",
"pycodestyle",
"pylint",
"pylint-pytest",
"yamllint",
]
pypi = ["build", "wheel", "setuptools_scm[toml]"]

[project.urls]
Source = "https://github.com/claritychallenge/clarity"
Expand All @@ -118,17 +106,8 @@ exclude = ["tests*"]
namespaces = false

[tool.setuptools.package-data]
clarity = [
"*.json",
"*.mat",
"*.yaml"
]
recipes = [
"*.csv",
"*.json",
"*.mat",
"*.yaml"
]
clarity = ["*.json", "*.mat", "*.yaml"]
recipes = ["*.csv", "*.json", "*.mat", "*.yaml"]


[tool.setuptools_scm]
Expand All @@ -140,21 +119,12 @@ git_describe_command = "git describe --tags"
[tool.pytest.ini_options]
minversion = "7.0"
addopts = "--cov clarity"
testpaths = [
"tests",
]
filterwarnings = [
"ignore::UserWarning"
]
testpaths = ["tests"]
filterwarnings = ["ignore::UserWarning"]

[tool.coverage.run]
source = ["clarity"]
omit = [
"*conftest.py",
"*tests*",
"**/__init__*",
"clarity/_version.py",
]
omit = ["*conftest.py", "*tests*", "**/__init__*", "clarity/_version.py"]

[tool.black]
line-length = 88
Expand All @@ -171,23 +141,11 @@ exclude = '''
'''

[flake8]
ignore =[
"E203",
"E501",
"W503",
]
ignore = ["E203", "E501", "W503"]
# docstring-convention = ""
max-line-length = 88
max-complexity = 18
select = [
"B",
"C",
"E",
"F",
"W",
"T4",
"B9"
]
select = ["B", "C", "E", "F", "W", "T4", "B9"]

[tool.ruff]
exclude = [
Expand Down Expand Up @@ -221,7 +179,4 @@ fixable = ["A", "B", "C", "D", "E", "F", "R", "S", "W", "U"]

[tool.mypy]
ignore_missing_imports = true
exclude = [
"docs/*",
"build/*"
]
exclude = ["docs/*", "build/*"]