def _update_boundary(self, x, y): N = self.waveguide_params.get("N") eta = self.waveguide_params.get("eta") print "N:", N print "eta: ", eta k0, k1 = [ np.sqrt(N**2 - n**2)*np.pi for n in 0, 1 ] L = abs(2*np.pi/(k0 - k1 + y)) if neumann: WG = Neumann(L=L, loop_type='Constant', x_R0=x, y_R0=y, **self.waveguide_params) else: WG = Dirichlet(L=L, loop_type='Constant', x_R0=x, y_R0=y, **self.waveguide_params) self.WG = WG xi_lower, xi_upper = WG.get_boundary(eps=x, delta=y) np.savetxt("lower.profile", zip(WG.t, xi_lower)) np.savetxt("upper.profile", zip(WG.t, xi_upper)) N_file = len(WG.t) replacements = {'LENGTH': str(L), 'WIDTH': str(W), 'MODES': str(N), 'PPHW': str(self.pphw), 'GAMMA0': str(eta), 'NEUMANN': '0', 'N_FILE_BOUNDARY': str(N_file), 'BOUNDARY_UPPER': 'upper.boundary', 'BOUNDARY_LOWER': 'lower.boundary'} replace_in_file(self.template, self.xml, **replacements)