sofacoustics / API_Cpp

36 stars 14 forks source link

MultiSpeakerBRIR::GetDataIR returning zeros #8

Open andresperezlopez opened 7 years ago

andresperezlopez commented 7 years ago

Hi, I'm just testing the new MultiSpeakerBRIR class, by using BRIR files provided by the TuBuRo database (http://sofacoustics.org/data/database/tuburo/).

I'm having an issue by getting the filter data. When using the MultiSpeakerBRIR::GetDataIR(std::vector< double > &values) const method, the numbers seem to make sense. However, when using the bool MultiSpeakerBRIR::GetDataIR(double *values, const unsigned long dim1, const unsigned long dim2, const unsigned long dim3, const unsigned long dim4) const method, it looks like all retrieved numbers are zero.

Looking inside the implementation, this latter method is based on NetCDFFile::GetValues, in opposition to all other similar methods for retrieving data (which are based on sofa::File methods). But I don't know if that would be related to the issue.

tcarpent commented 7 years ago

Hi, Is the issue related to a specific file ? I just tried with "BRIR_AllAbsorbers_OffCentre_Emitters1to64.sofa" (from the same database), and both methods provide the exact same results. Are you sure you passed the proper values for dim1, dim2, dim3, dim4 ? (this should be : dim1 = file.GetNumMeasurements(); dim2 = file.GetNumReceivers(); dim3 = file.GetNumEmitters(); dim4 = file.GetNumDataSamples(); )

andresperezlopez commented 7 years ago

Hi Thibaut, you are right, I just checked and both methods are retrieving the same values as expected. It was my confusion, since I was for some reason wrongly assuming that the method taking dimensions as arguments allowed for specific values to be retrieved (for instance, measurement X from emitter Y, etc). I just would like to ask you if such feature is planned, since IMHO it would be convenient when working with long IRs (as it is the case for BRIRs). Thanks!

tcarpent commented 7 years ago

Hi, There is no plan to add such feature, but it's not impossible. At first, the API was intended to be rather "low level", leaving this kind of "higher level" operations to the developer side. However, things can evolve... I'll think about it.