Open joncox123 opened 4 years ago
Yes - if it can't load a reconstructor, it won't close the loop... so this implies something is wrong.
Does it create a pmx.fits and rmx.fits file?
@agb32 it does eventually create pmx.fits and rmx.fits after about 40 iterations of trying to load rmx.fits and failing. That said, the loop still doesn't seem to be working. Why should it try a bunch of times until it eventually writes rmx.fits? Is it becomes it has to iteratively perturb the DM to solve for the relationship between the actuator and spatial phase correction?
Anyway, the Sterhl is around 0.05 to 0.1, even after it eventually loads rmx.fits:
30146: {'rms': 0, 'strehlPeak': 0.0499666, 'strehlInst': 0.118264, 'inbox0.2': 0.185225, 'd50': 0.509966, 'strehl': 0.0499666, 'FWHM': 0.297483, }
I am using Ubuntu 18.0.4.5 with Python 2.7.17, numpy 1.19.0 and scipy 1.4.1
By the way, I also noticed that the code was trying to import really old versions of scipy.linsolve that were either renamed or contain private methods that don't exist anymore. I fixed this in spmatrix.py and tomoRecon.py.
For tomoRecon.py, the solution is simply to use the new namespace:
try:
from scipy.sparse.linalg import splu
except ImportError:
from scipy.linsolve import splu
But for spmatrix.py you wrote a modified spsolve() that uses private method from spsolve that dissappeared a long time ago. As a workaround, I just import the new spsolve() that is built into scipy if your re-write can't be used. But the question is, does your rewrite fundamentally modify the output of scipy's spsolve (e.g. better numerical stability), or is it just faster or have better error handling?
# This customization of spsolve needs to be updated to support non-ancient versions of scipy
try:
import scipy.linsolve as linsolve
# This is copied from scipy.linsolve. The idea is to make it better for
# this situation, including the ability to factorise the matrix before
# doing the computation...
def spsolve(A, b, permc_spec=2):
"""Taken from scipy.linsolve, and updated to raise an exception if error occurs."""
# ... modified spsolve code here ...
except ImportError:
print "TODO: sort out scipy.linsolve usage in spmatrix.py"
from scipy.sparse.linalg import spsolve
However, fixing these scipy.linsolve issues didn't help. The Sterhl is still poor and scaoSim doesn't appear to be working. I'm not sure if these linsolve routines were being used anyway since it didn't crash before my "fix".
Hmm - the idea is that it does poking for N iterations, writes the poke matrix, the rmx.fits, and then closes the loop.
No, I don't think the linsolve will be being used by scaoSim.
Not sure why the Strehl is so low - but possibly its at 500nm or 650nm, rather than 1650nm - in which case, that is probably about right.
I will have to fire up an old laptop tomorrow to take a look...
When running the default scaoSim generated by daspbuilder.py, I get the error/warning message: >>>0: WARNING:tomoRecon: unable to load reconmx rmx.fits, using 0. instead
What causes this? Should I be worried about it? Could this be the reason scaoSim appears to not properly correct for the wavefront?