sofa#
Impulse response datasets in SOFA format.
- irdl.sofa.get_fabian(kind: str = 'measured', hato: int = 0, path: str = PosixPath('/home/runner/.cache/irdl'), output_format: str = 'pyfar')#
Download and extract the FABIAN HRTF Database v4 from DepositOnce.
DOI: 10.14279/depositonce-5718.5
- Parameters:
- kind
str Type of HRTF to download. Either
'measured'or'modeled'.- hato
int Head-above-torso-rotation of HRTFs in degrees. Either 0, 10, 20, 30, 40, 50, 310, 320, 330, 340 or 350.
- path
strorpathlib.Path Path to the directory where the data should be stored. Will be overwritten, if the environment variable
IRDL_DATA_DIRis set. Default is the user cache directory.- output_format
str Output format of the returned data. Either
'pyfar'(default),'hdf5', or'numpy'.
- kind
- Returns:
- data
dictorpathlib.Path Returned data depends on
output_format:'pyfar':dictwith keys'impulse_response'(pyfar.Signal),'source_coordinates'(pyfar.Coordinates), and'receiver_coordinates'(pyfar.Coordinates).'hdf5':pathlib.Pathto the HDF5 file containing the data.'numpy':dictwith keys'impulse_response'(numpy.ndarray),'source_coordinates'(numpy.ndarray),'receiver_coordinates'(numpy.ndarray), and'sampling_rate'(float).
- data
- irdl.sofa.load_sofa(file)#
Load raw arrays from a SOFA file.
- Parameters:
- file
pathlib.Pathorstr Path to the SOFA file.
- file
- Returns:
- data
dict Dictionary with the following keys:
'impulse_response':numpy.ndarray— Impulse response data.'source_coordinates':numpy.ndarray— Source positions as cartesian coordinates.'receiver_coordinates':numpy.ndarray— Receiver positions as cartesian coordinates.'sampling_rate':float— Sampling rate in Hz.
- data
- irdl.sofa.sofa_to_h5(file, extracted_already)#
Convert a SOFA file to HDF5 format and return the path.
- Parameters:
- file
pathlib.Pathorstr Path to the SOFA file.
- extracted_already
bool Check whether the SOFA file existed before extraction. If
False, the SOFA file is deleted after conversion.
- file
- Returns:
- h5_path
pathlib.Path Path to the converted HDF5 file.
- h5_path
- irdl.sofa.sofa_to_pyfar(file)#
Load data from a SOFA file and return as dictionary of pyfar objects.
- Parameters:
- file
pathlib.Pathorstr Path to the SOFA file.
- file
- Returns:
- data
dict Dictionary with the following keys:
'impulse_response':pyfar.Signal— Impulse response data.'source_coordinates':pyfar.Coordinates— Source positions.'receiver_coordinates':pyfar.Coordinates— Receiver positions.
- data