Loading sas_temper/output.py +20 −5 Original line number Diff line number Diff line Loading @@ -43,11 +43,17 @@ def outputSingleRes(conf, d, m, mnum, res): for i, p in enumerate(lres.params): if p.polydispersity is None: if p.kind not in ["fixed"]: if p.kind in ["integer"]: buff = "# "+str(p.name)+ " = %6d +/- %6.6f\n" %(p.val, p.unc) else: buff = "# "+str(p.name)+ " = %6.6f +/- %6.6f\n" %(p.val, p.unc) else: buff = "# "+str(p.name)+ " = %6.6f; fixed\n" %(p.val) else: if p.kind not in ["fixed"]: if p.kind in ["integer"]: buff = "# "+str(p.name)+ " = %6d +/- %6.6f, polydispersity %s = %6.6f +/- %6.6f\n" %(p.val, p.unc, str(p.polydispersity.kind), p.polydispersity.val, p.polydispersity.unc) else: buff = "# "+str(p.name)+ " = %6.6f +/- %6.6f, polydispersity %s = %6.6f +/- %6.6f\n" %(p.val, p.unc, str(p.polydispersity.kind), p.polydispersity.val, p.polydispersity.unc) else: # the polydispersity parameter cannot be "fixed" at present Loading @@ -66,11 +72,17 @@ def outputSingleRes(conf, d, m, mnum, res): for i, sqp in enumerate(lres.sq.params): if sqp.polydispersity is None: if sqp.kind not in ["fixed"]: if sqp.kind in ["integer"]: buff = "# " + str(sqp.name) + " = %6d +/- %6.6f \n" %(sqp.val, sqp.unc) else: buff = "# " + str(sqp.name) + " = %6.6f +/- %6.6f \n" %(sqp.val, sqp.unc) else: buff = "# " + str(sqp.name) + " = %6.6f; fixed \n" %(sqp.val) else: if sqp.kind not in ["fixed"]: if sqp.kind in ["integer"]: buff = "# " + str(sqp.name) + " = %6d +/- %6.6f, polydispersity %s = %6.6f +/- %6.6f\n" %(sqp.val, sqp.unc, str(sqp.polydispersity.kind), sqp.polydispersity.val, sqp.polydispersity.unc) else: buff = "# " + str(sqp.name) + " = %6.6f +/- %6.6f, polydispersity %s = %6.6f +/- %6.6f\n" %(sqp.val, sqp.unc, str(sqp.polydispersity.kind), sqp.polydispersity.val, sqp.polydispersity.unc) else: # the polydispersity parameter cannot be "fixed" at present Loading Loading @@ -198,6 +210,9 @@ def outputSetRes(conf, res): buff = "" buff += "%6.6f\t" %(chisq[i]) for j in range(0,parms): if varkinds[j] in ["integer"]: buff += "%6d\t" %(vals[j][i]) else: buff += "%6.6f\t" %(vals[j][i]) buff += "\n" f.write(buff) Loading sas_temper/param.py +10 −4 Original line number Diff line number Diff line Loading @@ -35,6 +35,12 @@ class Param(object): err_message = "The parameter type " + str(kind) + " specified for parameter " + str(name) + " is not valid" raise Exception(err_message) if kind in ["integer"]: self.min = min self.max = max self.val = int(0.5*self.min+self.max) self.unc = 0.0 else: self.min = np.float64(min) # the minimum value self.max = np.float64(max) # the maximum value self.val = 0.5*(self.min + self.max) Loading sas_temper/sas_temper_engine.py +12 −6 Original line number Diff line number Diff line Loading @@ -155,7 +155,7 @@ def define_model(schedule, modconf, temperature, rval, current): if schedule is 1: for i, p in enumerate(modconf.params): if p.kind=="integer": if p.kind in ["integer"]: local.params[i].val = int(frand(p.min,p.max+1.0)) else: local.params[i].val = frand(p.min,p.max) Loading @@ -166,7 +166,7 @@ def define_model(schedule, modconf, temperature, rval, current): if local.sq is not None: for i, sqp in enumerate(modconf.sq.params): if sqp.kind=="integer": if sqp.kind in ["integer"]: local.sq.params[i].val = int(frand(sqp.min,sqp.max+1.0)) else: local.sq.params[i].val = frand(sqp.min,sqp.max) Loading @@ -178,6 +178,9 @@ def define_model(schedule, modconf, temperature, rval, current): # pick a value from within the constrained range for i, p in enumerate(current.params): move = frand(-0.1*rval*p.val,0.1*rval*p.val) if p.kind in ["integer"]: local.params[i].val = int(p.val + move) else: local.params[i].val = p.val + move if local.params[i].val>modconf.params[i].max: Loading @@ -188,7 +191,7 @@ def define_model(schedule, modconf, temperature, rval, current): if p.polydispersity is not None: move = frand(-0.1*rval*p.polydispersity.val,0.1*rval*p.polydispersity.val) #catch the integer types if p.kind=="integer": if p.kind in ["integer"]: local.params[i].polydispersity.val = int(p.polydispersity.val + move) else: local.params[i].polydispersity.val = p.polydispersity.val + move Loading @@ -201,6 +204,9 @@ def define_model(schedule, modconf, temperature, rval, current): if local.sq is not None: for i, sqp in enumerate(current.sq.params): move = frand(-0.1*rval*sqp.val,0.1*rval*sqp.val) if sqp.kind in ["integer"]: local.sq.params[i].val = int(sqp.val + move) else: local.sq.params[i].val = sqp.val + move if local.sq.params[i].val>modconf.sq.params[i].max: Loading @@ -210,7 +216,7 @@ def define_model(schedule, modconf, temperature, rval, current): if sqp.polydispersity is not None: move = frand(-0.1*rval*sqp.polydispersity.val,0.1*rval*sqp.polydispersity.val) if sqp.kind=="integer": if sqp.kind in ["integer"]: local.sq.params[i].polydispersity.val = int(sqp.polydispersity.val + move) else: local.sq.params[i].polydispersity.val = sqp.polydispersity.val + move Loading Loading
sas_temper/output.py +20 −5 Original line number Diff line number Diff line Loading @@ -43,11 +43,17 @@ def outputSingleRes(conf, d, m, mnum, res): for i, p in enumerate(lres.params): if p.polydispersity is None: if p.kind not in ["fixed"]: if p.kind in ["integer"]: buff = "# "+str(p.name)+ " = %6d +/- %6.6f\n" %(p.val, p.unc) else: buff = "# "+str(p.name)+ " = %6.6f +/- %6.6f\n" %(p.val, p.unc) else: buff = "# "+str(p.name)+ " = %6.6f; fixed\n" %(p.val) else: if p.kind not in ["fixed"]: if p.kind in ["integer"]: buff = "# "+str(p.name)+ " = %6d +/- %6.6f, polydispersity %s = %6.6f +/- %6.6f\n" %(p.val, p.unc, str(p.polydispersity.kind), p.polydispersity.val, p.polydispersity.unc) else: buff = "# "+str(p.name)+ " = %6.6f +/- %6.6f, polydispersity %s = %6.6f +/- %6.6f\n" %(p.val, p.unc, str(p.polydispersity.kind), p.polydispersity.val, p.polydispersity.unc) else: # the polydispersity parameter cannot be "fixed" at present Loading @@ -66,11 +72,17 @@ def outputSingleRes(conf, d, m, mnum, res): for i, sqp in enumerate(lres.sq.params): if sqp.polydispersity is None: if sqp.kind not in ["fixed"]: if sqp.kind in ["integer"]: buff = "# " + str(sqp.name) + " = %6d +/- %6.6f \n" %(sqp.val, sqp.unc) else: buff = "# " + str(sqp.name) + " = %6.6f +/- %6.6f \n" %(sqp.val, sqp.unc) else: buff = "# " + str(sqp.name) + " = %6.6f; fixed \n" %(sqp.val) else: if sqp.kind not in ["fixed"]: if sqp.kind in ["integer"]: buff = "# " + str(sqp.name) + " = %6d +/- %6.6f, polydispersity %s = %6.6f +/- %6.6f\n" %(sqp.val, sqp.unc, str(sqp.polydispersity.kind), sqp.polydispersity.val, sqp.polydispersity.unc) else: buff = "# " + str(sqp.name) + " = %6.6f +/- %6.6f, polydispersity %s = %6.6f +/- %6.6f\n" %(sqp.val, sqp.unc, str(sqp.polydispersity.kind), sqp.polydispersity.val, sqp.polydispersity.unc) else: # the polydispersity parameter cannot be "fixed" at present Loading Loading @@ -198,6 +210,9 @@ def outputSetRes(conf, res): buff = "" buff += "%6.6f\t" %(chisq[i]) for j in range(0,parms): if varkinds[j] in ["integer"]: buff += "%6d\t" %(vals[j][i]) else: buff += "%6.6f\t" %(vals[j][i]) buff += "\n" f.write(buff) Loading
sas_temper/param.py +10 −4 Original line number Diff line number Diff line Loading @@ -35,6 +35,12 @@ class Param(object): err_message = "The parameter type " + str(kind) + " specified for parameter " + str(name) + " is not valid" raise Exception(err_message) if kind in ["integer"]: self.min = min self.max = max self.val = int(0.5*self.min+self.max) self.unc = 0.0 else: self.min = np.float64(min) # the minimum value self.max = np.float64(max) # the maximum value self.val = 0.5*(self.min + self.max) Loading
sas_temper/sas_temper_engine.py +12 −6 Original line number Diff line number Diff line Loading @@ -155,7 +155,7 @@ def define_model(schedule, modconf, temperature, rval, current): if schedule is 1: for i, p in enumerate(modconf.params): if p.kind=="integer": if p.kind in ["integer"]: local.params[i].val = int(frand(p.min,p.max+1.0)) else: local.params[i].val = frand(p.min,p.max) Loading @@ -166,7 +166,7 @@ def define_model(schedule, modconf, temperature, rval, current): if local.sq is not None: for i, sqp in enumerate(modconf.sq.params): if sqp.kind=="integer": if sqp.kind in ["integer"]: local.sq.params[i].val = int(frand(sqp.min,sqp.max+1.0)) else: local.sq.params[i].val = frand(sqp.min,sqp.max) Loading @@ -178,6 +178,9 @@ def define_model(schedule, modconf, temperature, rval, current): # pick a value from within the constrained range for i, p in enumerate(current.params): move = frand(-0.1*rval*p.val,0.1*rval*p.val) if p.kind in ["integer"]: local.params[i].val = int(p.val + move) else: local.params[i].val = p.val + move if local.params[i].val>modconf.params[i].max: Loading @@ -188,7 +191,7 @@ def define_model(schedule, modconf, temperature, rval, current): if p.polydispersity is not None: move = frand(-0.1*rval*p.polydispersity.val,0.1*rval*p.polydispersity.val) #catch the integer types if p.kind=="integer": if p.kind in ["integer"]: local.params[i].polydispersity.val = int(p.polydispersity.val + move) else: local.params[i].polydispersity.val = p.polydispersity.val + move Loading @@ -201,6 +204,9 @@ def define_model(schedule, modconf, temperature, rval, current): if local.sq is not None: for i, sqp in enumerate(current.sq.params): move = frand(-0.1*rval*sqp.val,0.1*rval*sqp.val) if sqp.kind in ["integer"]: local.sq.params[i].val = int(sqp.val + move) else: local.sq.params[i].val = sqp.val + move if local.sq.params[i].val>modconf.sq.params[i].max: Loading @@ -210,7 +216,7 @@ def define_model(schedule, modconf, temperature, rval, current): if sqp.polydispersity is not None: move = frand(-0.1*rval*sqp.polydispersity.val,0.1*rval*sqp.polydispersity.val) if sqp.kind=="integer": if sqp.kind in ["integer"]: local.sq.params[i].polydispersity.val = int(sqp.polydispersity.val + move) else: local.sq.params[i].polydispersity.val = sqp.polydispersity.val + move Loading