# -*-Python-*-
# Created by bgrierson at 20 Feb 2017 15:18
# Show the mtanh_polyexp for a range of parameters
x = linspace(0, 1.2, 121)
params = lmfit.Parameters()
params.add('pow_c', value=2)
params.add('core0', value=5.0)
params.add('core1', value=-1.0)
params.add('xsym', value=0.9)
params.add('blend_width', value=0.1)
params.add('edge_width', value=0.2)
params.add('offset', value=0.1)
params.add('A', value=1.0)
y = mtanh_polyexp(x, params)
fig, ax = plt.subplots(nrows=2, ncols=3)
# Vary parameters
axf = ax.flatten()
vars = ['core1', 'xsym', 'blend_width', 'edge_width', 'offset', 'A']
values = [[-2.0, -0.5], [0.8, 1.0], [0.05, 0.2], [0.1, 0.4], [0.0, 0.5], [0.0, 4.0]]
for i, var in enumerate(vars):
axf[i].plot(x, y, color='black', label='def')
vals = values[i]
for val in vals:
params_mod = copy.deepcopy(params)
params_mod[var].value = val
ymod = mtanh_polyexp(x, params_mod)
axf[i].plot(x, ymod, label='{}={}'.format(var, val))
for axi in axf:
axi.legend(loc='best')