def update_probe_nonmodal(self, i, psi_old, psi_new): d1, d2 = self.positions.data id1, id2 = d1//1, d2//1 object_intensity_max = (abs(self.object)**2.0).data[0].max() self.probe.modes[0] += \ CXData.shift(conj(self.object[id1[i] - self.p2:id1[i] + self.p2, id2[i] - self.p2:id2[i] + self.p2]) * (psi_new-psi_old)[0] / object_intensity_max, d1[i]%1, d2[i]%1) self.probe.normalise()
def update_probe(self, i, psi_old, psi_new): d1, d2 = self.positions.data id1, id2 = d1//1, d2//1 object_intensity_max = (abs(self.object)**2.0).data[0].max() for mode in range(len(self.probe)): self.probe.modes[mode] += \ CXData.shift(conj(self.object[id1[i] - self.p2:id1[i] + self.p2, id2[i] - self.p2:id2[i] + self.p2]) * (psi_new-psi_old)[mode] / object_intensity_max, d1[i]%1, d2[i]%1) self.probe.normalise() self.probe.orthogonalise()
def update_object(self, i, psi_old, psi_new): """ Update the object from a single ptycho position. """ then=time.time() d1, d2 = self.positions.data id1, id2 = d1//1, d2//1 probe_intensity_max = CXModal.modal_sum(abs(self.probe)**2.0).data[0].max() self.object[id1[i] - self.p2:id1[i] + self.p2, id2[i] - self.p2:id2[i] + self.p2] += \ CXData.shift(CXModal.modal_sum(conj(self.probe) * (psi_new-psi_old)) / probe_intensity_max, d1[i]%1, d2[i]%1) if self.total_its==0 and sp.mod(i, len(self.positions.data[0]) / 10) == 0: self.update_figure(i)