BUNPC / pysnirf2

Python package for reading, writing and validating Shared Near Infrared Spectroscopy Format (SNIRF) files
GNU General Public License v3.0
15 stars 11 forks source link

Error if 3D positions are actually 2D #28

Closed rob-luke closed 2 years ago

rob-luke commented 2 years ago

I have been given some files that have detectorPos3D positions where the third column is all zeros. This indicates to me that the positions are actually 2D, not 3D. I think its fair to assume that no real montage would have a perfectly flat plane.

At least one of detectorPos2D or detectorPos3D is required.

Should the validator throw an error if someone provides 3D positions that are actually 2D?

Thoughts @sstucker ?

rob-luke commented 2 years ago

For reference, these files also had detectorPos2D (that was exactly the same as the first two columns of detectorPos3D). So it would have been perfectly valid for the detectorPos3D to not even exist.

sstucker commented 2 years ago

Currently, the only validation check is to see whether one of the two (2D/3D) is present.

I don't see how the case you point out requires additional logic to validate.

Are you saying to add a WARNING in the all-zero-column case?

rob-luke commented 2 years ago

Are you saying to add a WARNING in the all-zero-column case?

Yes, this is what I meant. Something like "The values for the {1/2/3} / {x/y/z} dimension of the SourcePos3D are all identical. This commonly indicates that 2D positions were erroneously stored in the 3D structure instead of the 2D structure. Please manually confirm that these values are stored correctly." Or something less verbose 😉