Skip to content

Commit

Permalink
fixed a typo and normalised slopes in ANN reconstructor
Browse files Browse the repository at this point in the history
  • Loading branch information
ojdf committed Feb 9, 2016
1 parent d57a1da commit 1ad2550
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions soapy/RECON.py
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ def calcCMat(self, callback=None, progressCallback=None):
if dmIMat.shape[0]==dmIMat.shape[1]:
dmCMat = numpy.inv(dmIMat)
else:
dmCMat = numpy.linalg.pinv(dmIMat, self.dmCond[dm])
dmCMat = numpy.linalg.pinv(dmIMat, self.dmConds[dm])

self.controlMatrix[:,acts:acts+self.dms[dm].acts] = dmCMat
acts += self.dms[dm].acts
Expand All @@ -849,14 +849,17 @@ def reconstruct(self, slopes):
"""
Determine DM commands using previously made
reconstructor from slopes. Uses Artificial Neural Network.
Slopes are normalised before being run through the network.
Args:
slopes (ndarray): array of slopes to reconstruct from
Returns:
ndarray: array to comands to be sent to DM
"""
t=time.time()
offSlopes = slopes[self.wfss[0].activeSubaps*2:]
onSlopes = self.net.run(offSlopes)
offSlopes = slopes[self.wfss[0].activeSubaps*2:]/7 # normalise
onSlopes = self.net.run(offSlopes)*7 # un-normalise
dmCommands = self.controlMatrix.T.dot(onSlopes)

self.Trecon += time.time()-t
Expand Down

0 comments on commit 1ad2550

Please sign in to comment.