sofacoustics / SOFAtoolbox

SOFA Toolbox (API for Matlab, Octave)
http://sofaconventions.org
European Union Public License 1.2
116 stars 31 forks source link

CIPIC files on sofaconventions.org have mirrored lateral angles #42

Closed jpauwels closed 2 years ago

jpauwels commented 2 years ago

Hi all, the SOFA files on http://sofacoustics.org/data/database/cipic/ apparently were generated with API_MO/converters/SOFAconvertCIPIC2SOFA.m before https://github.com/sofacoustics/API_MO/commit/279c2e136eb69e2add7e8426949214238870594d compensated for the reversal in lateral angle direction. It would be great if corrected files could be uploaded there.

isfmiho commented 2 years ago

Dear jpauwels, they should have been fixed already two years ago, and they seem fine to me. When did you download the files??

cipic

jpauwels commented 2 years ago

Hi @isfmiho, I've just downloaded the files and their last modified date is 2020-03-24, so that corresponds to the two years ago timeline, but the change https://github.com/sofacoustics/API_MO/commit/279c2e136eb69e2add7e8426949214238870594d I'm talking about is one year old. It's also not the ReceiverPosition that needs updating, but the SourcePositions. The Python snippet below demonstrates the problem (or my misunderstanding): the impulse from the contralateral source is picked up earlier than from the ipsilateral one.

import pyfar as pf
import matplotlib.pyplot as plt

data_ir, source_coordinates, receiver_coordinates = pf.io.read_sofa('subject_003.sofa')
left_speaker, *_ = source_coordinates.find_nearest_k(90, 0, 1.5, k=1, domain='sph', convention='top_elev', unit='deg')
front_speaker, *_ = source_coordinates.find_nearest_k(0, 0, 1.5, k=1, domain='sph', convention='top_elev', unit='deg')
right_speaker, *_ = source_coordinates.find_nearest_k(270, 0, 1.5, k=1, domain='sph', convention='top_elev', unit='deg')

fig, axes = plt.subplots(3, 1, figsize=(8, 8))
pf.plot.time(data_ir[left_speaker, 0], ax=axes[0])
pf.plot.time(data_ir[front_speaker, 0], ax=axes[1])
pf.plot.time(data_ir[right_speaker, 0], ax=axes[2])

cipic-reversal

isfmiho commented 2 years ago

Hi @jpauwels, thank you for the feedback. The files should be fixed now, can you please check again?

jpauwels commented 2 years ago

Thanks @isfmiho, it's fixed now indeed.