title: IPython notebook interactive function: how to save the updated function parameters
body: <p>I wrote the code below in Ipython notebook to generate a sigmoid function controlled by parameters a which defines the position of the sigmoid center, and b which defines its width:</p>
  
  <pre><code>%matplotlib inline
      import numpy as np
      import matplotlib.pyplot as plt
  
  def sigmoid(x,a,b):
      #sigmoid function with parameters a = center; b = width
      s= 1/(1+np.exp(-(x-a)/b))
      return 100.0*(s-min(s))/(max(s)-min(s)) # normalize sigmoid to 0-100
  
  x = np.linspace(0,10,256)
  sigm = sigmoid(x, a=5, b=1)
  fig = plt.figure(figsize=(24,6))
  ax1 = fig.add_subplot(2, 1, 1)
  ax1.set_xticks([])
  ax1.set_xticks([])
  plt.plot(x,sigm,lw=2,color='black')
  plt.xlim(x.min(), x.max())
  </code></pre>
  
  <p>I wanted to add interactivity for parameters a and b so I re-wrote the function as below:</p>
  
  <pre><code>%matplotlib inline
  import numpy as np
  import matplotlib.pyplot as plt
  from IPython.html.widgets import interactive
  from IPython.display import display
  
  def sigmoid_demo(a=5,b=1):
      x = np.linspace(0,10,256)
      s = 1/(1+np.exp(-(x-a)/(b+0.1))) # +0.1 to avoid dividing by 0
      sn = 100.0*(s-min(s))/(max(s)-min(s)) # normalize sigmoid to 0-100
      fig = plt.figure(figsize=(24,6))
      ax1 = fig.add_subplot(2, 1, 1)
      ax1.set_xticks([])
      ax1.set_yticks([])
      plt.plot(x,sn,lw=2,color='black')
      plt.xlim(x.min(), x.max())
  
  w=widgets.interactive(sigmoid_demo,a=5,b=1)
  display(w)
  </code></pre>
  
  <p>Is it possible to save the modified sigmoid function parameters a and b to variables dynamically as they are modified by the sliders, so they can be used in another subplot or separate plot, and do further calculations.?</p>
  
  <p>I've gone through all examples of interactive widgets I could find but have not see anything pointing in that direction (these widgets are fairly new, so documentation for them does not seem as extensive as for other features). Any suggestions in the right direction is appreciated.</p>