def new_sphere(self, q, R, Rsig, rho, eirho, adensity, dist='Gaussian', Np=10): q = np.array(q) dr, rdist, totalR = self.calc_Rdist(R, Rsig, dist, Np) form = np.zeros_like(q) eiform = np.zeros_like(q) aform = np.zeros_like(q) cform = np.zeros_like(q) pfac = (4 * np.pi * 2.818e-5 * 1.0e-8)**2 for i in range(len(dr)): r = np.array(R) * (1 + (dr[i] - totalR) / totalR) ff, mff = ff_sphere_ml(q, r, rho) form = form + rdist[i] * ff eiff, meiff = ff_sphere_ml(q, r, eirho) eiform = eiform + rdist[i] * eiff aff, maff = ff_sphere_ml(q, r, adensity) aform = aform + rdist[i] * aff cform = cform + rdist[i] * (meiff * maff.conjugate() + meiff.conjugate() * maff) return pfac * form, pfac * eiform, pfac * aform, np.abs( pfac * cform) / 2 # in cm^2
def y(self): self.update_parameters() if self.Rsig < 0.001: ff, aff = ff_sphere_ml(self.x, self.__R__, self.__rho__) return ff # return self.norm*self.csphere(R,rho)+self.bkg else: dr, rdist, totalR = self.calc_Rdist(tuple(self.__R__), self.Rsig, self.dist, self.N) res = np.zeros_like(self.x) for i in range(len(dr)): r = np.array(self.__R__) * (1 + (dr[i] - totalR) / totalR) ff, aff = ff_sphere_ml(self.x, r, self.__rho__) res = res + rdist[i] * ff return self.norm * res + self.bkg
def y(self): R = [ self.params['__R__%03d' % i].value for i in range(len(self.__mpar__['R'])) ] rho = [ self.params['__rho__%03d' % i].value for i in range(len(self.__mpar__['rho'])) ] if self.Rsig < 0.001: ff, aff = ff_sphere_ml(self.x, R, rho) return ff # return self.norm*self.csphere(R,rho)+self.bkg else: dr, rdist, totalR = self.calc_Rdist(tuple(R), self.Rsig, self.dist, self.N) res = np.zeros_like(self.x) for i in range(len(dr)): r = np.array(R) * (1 + (dr[i] - totalR) / totalR) ff, aff = ff_sphere_ml(self.x, r, rho) res = res + rdist[i] * ff return self.norm * res + self.bkg