VirtualPhotonics / VTS

Virtual Tissue Simulator
https://virtualphotonics.org
Other
34 stars 9 forks source link

Monte Carlo inverse code fixes #173

Closed hayakawa16 closed 2 months ago

hayakawa16 commented 2 months ago

A bug was found in mc_inverse_Win.m. Correct bug and add more comments to clarify what code is doing.

hayakawa16 commented 2 months ago

All works well on Windows with latest updates to this branch. On Linux, I try to run this line 51: system('./mc infile=infile_pMC_db_gen.txt'); and get: Failed to load /usr/lib/dotnet/host/fxr/8.0.8/libhostfxr.so, error: /usr/local/MATLAB/R2023b/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /usr/lib/dotnet/host/fxr/8.0.8/libhostfxr.so) The library libhostfxr.so was found, but loading it from /usr/lib/dotnet/host/fxr/8.0.8/libhostfxr.so failed

I went to https://go.microsoft.com/fwlink/?linkid=2063370 and made sure all dependencies were indeed installed.

I can run this line outside of MATLAB, just not inside MATLAB.

hayakawa16 commented 2 months ago

I found the answer! I don't know why this link didn't come up this weekend: https://www.mathworks.com/matlabcentral/answers/1907290-how-to-manually-select-the-libstdc-library-to-use-to-resolve-a-version-glibcxx_-not-found I added: export LD_PRELOAD=/lib/x86_64-linux-gnu/libstdc++.so.6 to my .bashrc

hayakawa16 commented 2 months ago

I cleaned up and debugged the mc_inverse_Win.m and mc_inverse.m code. When I first coded this software, I did a comparison between the results that lsqcurvefit provided and fminsearch (back in 2021). Since then the SpectralDictionary.xlsx has been expanded, my MATLAB version is now 2023b (used to be 2021b?) which means lsqcurvefit methods may have been modified. I show the plots of the prior study and the plots of the current study. Errors are comparable. Linux version produces exactly the same results. notes_monte_carlo_inverse.pdf