Skip to content

Commit 57a2390

Browse files
committed
Modifies sofa.py to be able to get the path to the SOFA database via an environment variable.
1 parent 5e913f2 commit 57a2390

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

CHANGELOG.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,14 @@ Changed
1515
~~~~~~~
1616

1717
- Modernized the build system to use ``pyproject.toml`` and ``CMake``.
18-
- External dependencies (``Eigen``, ``nanoflann``, ``pybind11``) are now automatically managed via CMake's ``FetchContent``.
18+
- External dependencies (``Eigen``, ``nanoflann``, ``pybind11``) are now
19+
automatically managed via CMake's ``FetchContent``.
1920
- Switched to dynamic versioning using ``setuptools_scm``.
2021
- Relocated the test suite from the source package to a top-level ``tests/`` directory.
21-
- Update the continuous integration to use cibuildwheel to handle all platforms including manylinux.
22+
- Update the continuous integration to use cibuildwheel to handle all platforms
23+
including manylinux.
24+
- The location of the SOFA files can be specified by the
25+
``PYROOMACOUSTICS_DATA_PATH`` environment variable.
2226

2327

2428
`0.10.0`_ - 2026-04-01

pyroomacoustics/datasets/sofa.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,25 @@
6767
for more details.
6868
6969
70+
71+
The default location for the SOFA files is in the ``data/sofa`` folder of
72+
the ``pyroomacoustics`` package. This location can be overridden by setting the
73+
environment variable ``PYROOMACOUSTICS_DATA_PATH`` to a different path.
74+
7075
"""
7176

7277
import json
78+
import os
7379
import typing as tp
7480
from dataclasses import dataclass
7581
from pathlib import Path
7682

7783
from .utils import AttrDict, download_multiple
7884

7985
_pra_data_folder = Path(__file__).parents[1] / "data"
80-
DEFAULT_SOFA_PATH = _pra_data_folder / "sofa"
86+
DEFAULT_SOFA_PATH = Path(
87+
os.environ.get("PYROOMACOUSTICS_DATA_PATH", _pra_data_folder / "sofa")
88+
)
8189
SOFA_INFO = _pra_data_folder / "sofa_files.json"
8290

8391
_DIRPAT_FILES = [

0 commit comments

Comments
 (0)