Automating Multipeak Fitting

I am failing at automating MPF2_AutoMPFit, and I am convinced that it is not my fault. I need to manually fit one spectrum (I will eventually use my own fit function that is very wonky and only works with very good guesses) and then run MPF2_AutoMPFit with option "0" for using the results of the manual fit for the rest of the spectra.

If I run the fit manually and relocate the output folder to root as well as rename as "peaksframe_0" for resultDFBase equal to "peaksframe"; as well as rename (currently manually) the files that should be named "PeakCoefs0" and "PeakCoefs0esp" for the PeakCoefWaveFormat equal to "PeakCoefs%d", ans subsequently run MPF2_AutoMPFit with option "0" (uses initial guesses for each spectrum) it does nothing, doesn't even try. I check and the ywaveslist and xwaveslist are populated properly (generate in the GetFromLabview() macro).

If I run MPF2_AutoMPFit with option "5" instead of "0" (no initial guesses) and then delete all peaksframe_i output files except for "peaksframe_0" and rerun MPF2_AutoMPFit with option "0" it works fine. Am I crazy? What am I missing? Thank you for any help.

I will attach the routine that I am using, if sample data helps just let me know and I can supply that as well.

B

PS: if you still have energy help me with this other issue: I used the function KillDataFolder to kill "peaksframe_0" in one of my many failed attempts, and since then "DuplicateDataFolder/O" is not getting compiled any longer, only if I remove the "/O" flag. Is this normal? How can I get that functionality back? Should I reinstall Igorpro? This basically made me change my "storethefit()" function.
fsrsFit1.ipf
Hi bnegru,

the function MPF2_AutoFit returns a numeric return value. Can you post that for the case where it does not work? Have you looked at the documentation via DisplayHelpTopic "MPF2_AutoMPFit()"?

With initialguessOptions=0 it expects coefficient waves in resultDFBase where the names of the waves must match peakCoefWaveFormat.

That is another question I have, how do I get the error when it doesn't work? It simply does nothing. It doesn't think about it, it doesn't return anything. I added a print command after running MPF2 function just to make sure that it was called properly since nothing was happening.
I may have just gotten it to work, the only thing I changed was to also chance "Baseline Coefs" to "BaselineCoefs"
Capture the return value as in variable ret = MPF2_AutoMPFIT(...) and then compare the value with the documentation.
Thank you, the variable ret thing works, this should make it much easier from now on.