Tests with only microphone *or* source from a SOFA file
(
src_pattern_id,
src_sofa_file_name,
mic_pattern_id,
mic_sofa_file_name,
min_phase,
save_flag,
plot_flag,
)
| 343 | SOFA_TWO_SIDES_PARAMETERS, |
| 344 | ) |
| 345 | def test_sofa_two_sides( |
| 346 | src_pattern_id, |
| 347 | src_sofa_file_name, |
| 348 | mic_pattern_id, |
| 349 | mic_sofa_file_name, |
| 350 | min_phase, |
| 351 | save_flag, |
| 352 | plot_flag, |
| 353 | ): |
| 354 | """ |
| 355 | Tests with only microphone *or* source from a SOFA file |
| 356 | """ |
| 357 | |
| 358 | if min_phase: |
| 359 | pra.constants.set("octave_bands_n_fft", 128) |
| 360 | pra.constants.set("octave_bands_keep_dc", True) |
| 361 | else: |
| 362 | pra.constants.set("octave_bands_n_fft", 512) |
| 363 | pra.constants.set("octave_bands_keep_dc", False) |
| 364 | |
| 365 | # make sure all the files are present |
| 366 | # in case tests are run out of order |
| 367 | download_sofa_files(overwrite=False, verbose=False) |
| 368 | |
| 369 | # create room |
| 370 | room = pra.ShoeBox( |
| 371 | room_dim, |
| 372 | fs=16000, |
| 373 | max_order=2, |
| 374 | materials=all_materials, |
| 375 | air_absorption=True, |
| 376 | ray_tracing=False, |
| 377 | min_phase=min_phase, |
| 378 | ) |
| 379 | |
| 380 | src_factory = MeasuredDirectivityFile( |
| 381 | path=src_sofa_file_name, |
| 382 | fs=room.fs, |
| 383 | interp_order=interp_order, |
| 384 | ) |
| 385 | src_directivity = src_factory.get_source_directivity( |
| 386 | src_pattern_id, |
| 387 | Rotation3D( |
| 388 | [0, 0], rot_order="yz" |
| 389 | ), # DirectionVector(azimuth=0, colatitude=0, degrees=True) |
| 390 | ) |
| 391 | |
| 392 | mic_factory = MeasuredDirectivityFile( |
| 393 | path=mic_sofa_file_name, |
| 394 | fs=room.fs, |
| 395 | interp_order=interp_order, |
| 396 | ) |
| 397 | mic_directivity = mic_factory.get_mic_directivity( |
| 398 | mic_pattern_id, |
| 399 | Rotation3D( |
| 400 | [0, 0], rot_order="yz" |
| 401 | ), # DirectionVector(azimuth=0, colatitude=0, degrees=True) |
| 402 | ) |
no test coverage detected