Error using lsqncommon
Objective function is returning undefined values at initial point. lsqnonlin cannot continue.
Turns out this is due to one of my data files (Philips MEGA-PRESS in nii.gz format) containing some spectra that are all zeros. I wonder whether it is possible to set Osprey to exclude empty spectra to avoid this issue?
Edit: actually, this is not specific to RbustSpecReg. Another datafile with zeroed spectra gave this error instead:
Index exceeds the number of array elements. Index must not exceed 0.
Error in osp_XReferencing (line 89)
HWHM=abs(tempx(gtHalfMax(1)) - tempx(gtHalfMax(end)))/2 * 0.8;
I found that in both cases I could work around this by manually editing the nifti-file to remove empty spectra pairwise. The reason we have this at all is probably because scanning was interrupted due to tolerability issues (other software like Gannet never cared about this).
I’m glad to hear you were able to resolve your issue!
I don’t believe Osprey has an option/flag to ignore empty spectra, but—In case you aren’t already aware—there are some FID-A-derived functions built in to Osprey to edit your data: io_loadspec_niimrs & io_writeniimrs for reading and writing, respectively, and you can use op_takeaverages for including only the non-zero elements.
I’d also be keen to know the exact shape of the data, and if it’s not a spec2nii-specifc issue, would you be willing to share your partial data file? I’m happy to dig into this a little, as the partial-acquisition concern has also cropped up in another project.
Yes, I’m unsure why there should be different treatment. Would you mind sending me both, please? I’d like to understand why this is the case. My email is firstname.lastname@example.org. Thanks again for raising this, @JonasP.