def setUp(self): self.coefs = np.zeros((12)) self.coefs[0] = 1. self.coefs[1] = 1. self.coefs[4] = 2.07 self.coefs[7] = 3 self.coefs[8] = 100 self.coefs[9] = 3.47 self.coefs[11] = 2 self.layer_format = reflect.convert_coefs_to_layer_format(self.coefs) theoretical = np.loadtxt(os.path.join(CURDIR, 'theoretical.txt')) qvals, rvals = np.hsplit(theoretical, 2) self.qvals = qvals.flatten() self.rvals = rvals.flatten()
def setUp(self): self.coefs = np.zeros(12) self.coefs[0] = 1. self.coefs[1] = 1. self.coefs[4] = 2.07 self.coefs[7] = 3 self.coefs[8] = 100 self.coefs[9] = 3.47 self.coefs[11] = 2 self.layer_format = reflect.convert_coefs_to_layer_format(self.coefs) theoretical = np.loadtxt(os.path.join(path, 'theoretical.txt')) qvals, rvals = np.hsplit(theoretical, 2) self.qvals = qvals.flatten() self.rvals = rvals.flatten() # e361 is an older dataset, but well characterised self.coefs361 = np.zeros(16) self.coefs361[0] = 2 self.coefs361[1] = 1. self.coefs361[2] = 2.07 self.coefs361[4] = 6.36 self.coefs361[6] = 2e-5 self.coefs361[7] = 3 self.coefs361[8] = 10 self.coefs361[9] = 3.47 self.coefs361[11] = 4 self.coefs361[12] = 200 self.coefs361[13] = 1 self.coefs361[15] = 3 lowlim = np.zeros(16) lowlim[4] = 6.2 hilim = 2 * self.coefs361 bounds = list(zip(lowlim, hilim)) e361 = np.loadtxt(os.path.join(path, 'e361r.txt')) self.qvals361, self.rvals361, self.evals361 = np.hsplit(e361, 3) np.seterr(invalid='raise') self.params361 = curvefitter.to_parameters(self.coefs361, bounds=bounds, varies=[False] * 16) fit = [1, 4, 6, 8, 12, 13] for p in fit: self.params361['p%d' % p].vary = True