Commit 513c9cd5 by jansen31

### incoherent fields: sparsity applied to total intensity

parent 5a8b7d50
 ... ... @@ -155,3 +155,10 @@ class DegenerateOrbital(PlanarMolecule): if show: plt.show() return fig def interpolate_and_zoom(self, u, interpolation=2, zoom=0.5): """ interpolate a field and zoom in to the center """ return u
 from numpy import sum from numpy import sum, where from numpy.core._multiarray_umath import sqrt, array from proxtoolbox.proxoperators import P_M, P_Sparsity_real ... ... @@ -27,9 +27,16 @@ class P_M_incoherent(P_M): class P_Sparsity_real_incoherent(P_Sparsity_real): """ Apply a sparsity constraint to the combined intensity of a set of incoherent iterates """ def __init__(self, experiment): super(P_Sparsity_real_incoherent, self).__init__(experiment) def eval(self, u, prox_idx=None): out = array([super(P_Sparsity_real_incoherent, self).eval(u_i) for u_i in u]) u_real = u.real density = sum(abs(u_real)**2, axis=0) sparse = super(P_Sparsity_real_incoherent, self).eval(density) out = array([where(sparse != 0, u_i, 0) for u_i in u_real]) # out = array([super(P_Sparsity_real_incoherent, self).eval(u_i) for u_i in u]) return out
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!