<?xml version="1.0" encoding="UTF-8"?>

<rss version="2.0"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
     xmlns:atom="http://www.w3.org/2005/Atom"
     xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:wfw="http://wellformedweb.org/CommentAPI/"
     >
  <channel>
    <atom:link href="http://kitchingroup.cheme.cmu.edu/blog/feed/index.xml" rel="self" type="application/rss+xml" />
    <title>The Kitchin Research Group</title>
    <link>https://kitchingroup.cheme.cmu.edu/blog</link>
    <description>Chemical Engineering at Carnegie Mellon University</description>
    <pubDate>Sat, 01 Nov 2025 13:47:46 GMT</pubDate>
    <generator>Blogofile</generator>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    
    <item>
      <title>Running scientific instruments in Emacs and recording the results</title>
      <link>https://kitchingroup.cheme.cmu.edu/blog/2015/07/25/Running-scientific-instruments-in-Emacs-and-recording-the-results</link>
      <pubDate>Sat, 25 Jul 2015 10:04:01 EDT</pubDate>
      <category><![CDATA[orgmode]]></category>
      <category><![CDATA[notebook]]></category>
      <category><![CDATA[emacs]]></category>
      <guid isPermaLink="false">98w4pu7ihCg5yUl5vU4BtOlRWZs=</guid>
      <description>Running scientific instruments in Emacs and recording the results</description>
      <content:encoded><![CDATA[



&lt;p&gt;
Today we look at running a scientific instrument via http requests from Emacs and org-mode. We will use a Gamry Ref600 potentiostat because Gamry has very nicely provide a COM interface we can access via Python. This will be only a proof of concept to see what it is like. We will not consider any issues of security, etc&amp;#x2026;, only what is it like to do it.
&lt;/p&gt;

&lt;p&gt;
The setup will look like this: we will run a flask web app that uses python to control the instrument via http requests. Why? Because I want to run the instrument from my Mac ;) and so far there are only Windows drivers for the instrument. So, we run the flask app on the Windows machine, and I run it from here on my Mac by sending requests. Flask takes care of converting requests to action using Python. You can see the &lt;a href="#sec-2"&gt;Flask app here&lt;/a&gt;.
&lt;/p&gt;

&lt;p&gt;
Let's see what is online:
&lt;/p&gt;
&lt;div class="org-src-container"&gt;

&lt;pre class="src src-sh"&gt;curl jkitchin-win.cheme.cmu.edu:5000/pstats
&lt;/pre&gt;
&lt;/div&gt;

&lt;pre class="example"&gt;
(u'REF600-13089',)
&lt;/pre&gt;

&lt;p&gt;
We have one potentiostat online with serial number 13089. I have a dummy cell connected to it which has a little resistor on it. So we can run a cyclic voltammogram and it should be a straight line. We have to know a bit about what is returned. We will get a json file back, and it will have the data in it. The data will be a list of lists. The data we want is in columns 1 and 3 (python indexing). Obviously you need some prior knowledge of what data comes back to use this. That would come from reading some documentation.
&lt;/p&gt;

&lt;div class="org-src-container"&gt;

&lt;pre class="src src-python"&gt;&lt;span style="color: #0000FF;"&gt;import&lt;/span&gt; requests
&lt;span style="color: #0000FF;"&gt;import&lt;/span&gt; numpy &lt;span style="color: #0000FF;"&gt;as&lt;/span&gt; np
&lt;span style="color: #0000FF;"&gt;import&lt;/span&gt; matplotlib.pyplot &lt;span style="color: #0000FF;"&gt;as&lt;/span&gt; plt

&lt;span style="color: #BA36A5;"&gt;resp&lt;/span&gt; = requests.get(&lt;span style="color: #008000;"&gt;'http://jkitchin-win.cheme.cmu.edu:5000/cv?endv=0.25&amp;amp;startv=-0.25'&lt;/span&gt;)

&lt;span style="color: #BA36A5;"&gt;dj&lt;/span&gt; = resp.json()
&lt;span style="color: #BA36A5;"&gt;data&lt;/span&gt; = np.array(dj[&lt;span style="color: #008000;"&gt;'data'&lt;/span&gt;])

plt.plot(data[:, 1], data[:, 3])
plt.xlabel(&lt;span style="color: #008000;"&gt;'Voltage (V)'&lt;/span&gt;)
plt.ylabel(&lt;span style="color: #008000;"&gt;'Current (A)'&lt;/span&gt;)
plt.tight_layout()
plt.savefig(&lt;span style="color: #008000;"&gt;'cv-1.png'&lt;/span&gt;)
&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;
&lt;img src="/media/2015-07-25-Running-scientific-instruments-in-Emacs-and-recording-the-results/cv-1.png"&gt; 
Well, there you have it. Possibly the first Gamry Ref600 to ever have been driven from a Mac ;) Let me be more explicit about that; I could &lt;i&gt;also&lt;/i&gt; run this from Linux, an iPad, etc&amp;#x2026; You could do this in a browser, or in an IPython notebook, or in Matlab, among many other possibilities. You could write a script in perl, shell, ruby, emacs-lisp, or any other language that supports http requests.
&lt;/p&gt;

&lt;p&gt;
I am not sure why the graph is not perfectly linear, maybe there is some capacitive charging that starts out. The resistance based on the current at 0.2V is about 2000 ohms, which is in good agreement with what is listed on the board the dummy cell is on.
&lt;/p&gt;

&lt;div id="outline-container-sec-1" class="outline-2"&gt;
&lt;h2 id="sec-1"&gt;&lt;span class="section-number-2"&gt;1&lt;/span&gt; Summary thoughts&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-1"&gt;
&lt;p&gt;
There are a host of interesting issues one eventually has to consider here including security, but also error management and debugging. I hacked something like an http api here by running flask on the windows machine running the instrument. That is a layer of abstraction on an abstraction to start with. I think later instruments are likely to run these webservers themselves on small dedicated computers, e.g. via a Raspberry pi or Arduino chipset. It is not obvious how sophisticated you can make this with respect to triggering different instruments, etc&amp;#x2026;
&lt;/p&gt;

&lt;p&gt;
In running this, my "notebook" was blocked while the experiment ran. It is possible to run things asynchronously, and sometimes that would make sense. In the example here, we have provided a very limited set of functions to "run" the potentiostat. It was only a proof of concept to get a sense for what it is like. In practice a fuller set of functions would be implemented. Another point to consider is how the data comes back from the potentiostat. We used json here because it is convenient, but we could just as well send files, and other sorts of data too.
&lt;/p&gt;

&lt;p&gt;
This lays out the possibility to walk up to an instrument with an electronic notebook, setup and run the experiment, capture the results in the notebook and take it back to the office for analysis. Pretty cool.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-sec-2" class="outline-2"&gt;
&lt;h2 id="sec-2"&gt;&lt;a id="ID-5EB72A19-B9D3-4ABA-975F-61ACE16E0D87" name="ID-5EB72A19-B9D3-4ABA-975F-61ACE16E0D87"&gt;&lt;/a&gt;&lt;span class="section-number-2"&gt;2&lt;/span&gt; Flask app&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-2"&gt;

&lt;p&gt;
So, here is my flask app. We setup a few routes using get requests to do things like get a list of the potentiostats online, and to run a cyclic voltamogram. As a side note, after this post is over, I am turning off the app, so you won't be able to repeat the codes ;) This is not a beautiful, secure or error tolerant code. It works enough for a proof of concept of simple experiments.
&lt;/p&gt;

&lt;div class="org-src-container"&gt;

&lt;pre class="src src-python"&gt;&lt;span style="color: #0000FF;"&gt;from&lt;/span&gt; flask &lt;span style="color: #0000FF;"&gt;import&lt;/span&gt; Flask, request, jsonify
&lt;span style="color: #0000FF;"&gt;import&lt;/span&gt; time

&lt;span style="color: #BA36A5;"&gt;app&lt;/span&gt; = Flask(&lt;span style="color: #006FE0;"&gt;__name__&lt;/span&gt;)

&lt;span style="color: #6434A3;"&gt;@app.route&lt;/span&gt;(&lt;span style="color: #008000;"&gt;'/'&lt;/span&gt;)
&lt;span style="color: #0000FF;"&gt;def&lt;/span&gt; &lt;span style="color: #006699;"&gt;hello_world&lt;/span&gt;():
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #0000FF;"&gt;return&lt;/span&gt; &lt;span style="color: #008000;"&gt;'Hello World!'&lt;/span&gt;

&lt;span style="color: #6434A3;"&gt;@app.route&lt;/span&gt;(&lt;span style="color: #008000;"&gt;'/pstats'&lt;/span&gt;)
&lt;span style="color: #0000FF;"&gt;def&lt;/span&gt; &lt;span style="color: #006699;"&gt;get_pstats&lt;/span&gt;():
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #0000FF;"&gt;import&lt;/span&gt; win32com.client &lt;span style="color: #0000FF;"&gt;as&lt;/span&gt; client
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #BA36A5;"&gt;devices&lt;/span&gt; = client.Dispatch(&lt;span style="color: #008000;"&gt;'GamryCOM.GamryDeviceList'&lt;/span&gt;)
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #BA36A5;"&gt;result&lt;/span&gt; = &lt;span style="color: #006FE0;"&gt;str&lt;/span&gt;(devices.EnumSections())
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #0000FF;"&gt;return&lt;/span&gt; result

&lt;span style="color: #6434A3;"&gt;@app.route&lt;/span&gt;(&lt;span style="color: #008000;"&gt;'/close_pstat'&lt;/span&gt;)
&lt;span style="color: #0000FF;"&gt;def&lt;/span&gt; &lt;span style="color: #006699;"&gt;close&lt;/span&gt;():
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #0000FF;"&gt;import&lt;/span&gt; win32com.client &lt;span style="color: #0000FF;"&gt;as&lt;/span&gt; client
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #BA36A5;"&gt;devicelist&lt;/span&gt; = client.Dispatch(&lt;span style="color: #008000;"&gt;'GamryCOM.GamryDeviceList'&lt;/span&gt;)

&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #BA36A5;"&gt;x&lt;/span&gt; = devicelist.EnumSections()[0]
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #BA36A5;"&gt;pstat&lt;/span&gt; = client.Dispatch(&lt;span style="color: #008000;"&gt;'GamryCOM.GamryPstat'&lt;/span&gt;)
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   pstat.Init(x)

&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   pstat.Close()


&lt;span style="color: #0000FF;"&gt;def&lt;/span&gt; &lt;span style="color: #006699;"&gt;run_ramp&lt;/span&gt;(Sinit,  &lt;span style="color: #8D8D84;"&gt;# &lt;/span&gt;&lt;span style="color: #8D8D84; font-style: italic;"&gt;start value&lt;/span&gt;
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;    Sfinal, &lt;span style="color: #8D8D84;"&gt;# &lt;/span&gt;&lt;span style="color: #8D8D84; font-style: italic;"&gt;end value&lt;/span&gt;
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;    ScanRate=1,
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;    SampleRate=0.01,
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;    CtrlMode=1,  &lt;span style="color: #8D8D84;"&gt;# &lt;/span&gt;&lt;span style="color: #8D8D84; font-style: italic;"&gt;GamryCOM.PstatMode&lt;/span&gt;
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;    fname=&lt;span style="color: #D0372D;"&gt;None&lt;/span&gt;):
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #036A07;"&gt;'''We assume the first device is the one you want.&lt;/span&gt;
&lt;span style="color: #036A07;"&gt;    '''&lt;/span&gt;
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #0000FF;"&gt;import&lt;/span&gt; win32com.client &lt;span style="color: #0000FF;"&gt;as&lt;/span&gt; client
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #0000FF;"&gt;import&lt;/span&gt; numpy &lt;span style="color: #0000FF;"&gt;as&lt;/span&gt; np
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #BA36A5;"&gt;devicelist&lt;/span&gt; = client.Dispatch(&lt;span style="color: #008000;"&gt;'GamryCOM.GamryDeviceList'&lt;/span&gt;)

&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #BA36A5;"&gt;x&lt;/span&gt; = devicelist.EnumSections()[0]

&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #BA36A5;"&gt;pstat&lt;/span&gt; = client.Dispatch(&lt;span style="color: #008000;"&gt;'GamryCOM.GamryPstat'&lt;/span&gt;)
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   pstat.Init(x)

&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   pstat.Open()

&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #BA36A5;"&gt;dtaqcpiv&lt;/span&gt;=client.Dispatch(&lt;span style="color: #008000;"&gt;'GamryCOM.GamryDtaqCpiv'&lt;/span&gt;)
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   dtaqcpiv.Init(pstat)

&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #BA36A5;"&gt;sigramp&lt;/span&gt;=client.Dispatch(&lt;span style="color: #008000;"&gt;'GamryCOM.GamrySignalRamp'&lt;/span&gt;)
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   sigramp.Init(pstat, Sinit, Sfinal, ScanRate, SampleRate, CtrlMode)

&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   pstat.SetSignal(sigramp)
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   pstat.SetCell(1) &lt;span style="color: #8D8D84;"&gt;# &lt;/span&gt;&lt;span style="color: #8D8D84; font-style: italic;"&gt;1 == GamryCOM.CellOn&lt;/span&gt;

&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #0000FF;"&gt;try&lt;/span&gt;:
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   dtaqcpiv.Run(&lt;span style="color: #D0372D;"&gt;True&lt;/span&gt;)
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #0000FF;"&gt;except&lt;/span&gt; &lt;span style="color: #6434A3;"&gt;Exception&lt;/span&gt; &lt;span style="color: #0000FF;"&gt;as&lt;/span&gt; e:
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   pstat.Close()
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #0000FF;"&gt;raise&lt;/span&gt;

&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #8D8D84;"&gt;# &lt;/span&gt;&lt;span style="color: #8D8D84; font-style: italic;"&gt;NOTE:  The comtypes example in this same directory illustrates the use of com&lt;/span&gt;
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #8D8D84;"&gt;# &lt;/span&gt;&lt;span style="color: #8D8D84; font-style: italic;"&gt;notification events.  The comtypes package is recommended as an alternative&lt;/span&gt;
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #8D8D84;"&gt;# &lt;/span&gt;&lt;span style="color: #8D8D84; font-style: italic;"&gt;to win32com.&lt;/span&gt;
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   time.sleep(2) &lt;span style="color: #8D8D84;"&gt;# &lt;/span&gt;&lt;span style="color: #8D8D84; font-style: italic;"&gt;just wait sufficiently long for the acquisition to complete.&lt;/span&gt;

&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #BA36A5;"&gt;acquired_points&lt;/span&gt; = []
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #BA36A5;"&gt;count&lt;/span&gt; = 1
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #0000FF;"&gt;while&lt;/span&gt; count &amp;gt; 0:
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #BA36A5;"&gt;count&lt;/span&gt;, &lt;span style="color: #BA36A5;"&gt;points&lt;/span&gt; = dtaqcpiv.Cook(10)
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #8D8D84;"&gt;# &lt;/span&gt;&lt;span style="color: #8D8D84; font-style: italic;"&gt;The columns exposed by GamryDtaq.Cook vary by dtaq and are&lt;/span&gt;
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #8D8D84;"&gt;# &lt;/span&gt;&lt;span style="color: #8D8D84; font-style: italic;"&gt;documented in the Toolkit Reference Manual.&lt;/span&gt;
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   acquired_points.extend(&lt;span style="color: #006FE0;"&gt;zip&lt;/span&gt;(*points))

&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #BA36A5;"&gt;acquired_points&lt;/span&gt; = np.array(acquired_points)
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #0000FF;"&gt;if&lt;/span&gt; fname &lt;span style="color: #0000FF;"&gt;is&lt;/span&gt; &lt;span style="color: #0000FF;"&gt;not&lt;/span&gt; &lt;span style="color: #D0372D;"&gt;None&lt;/span&gt;:
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   np.savetxt(fname, acquired_points)

&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   pstat.Close()
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #0000FF;"&gt;return&lt;/span&gt; jsonify({&lt;span style="color: #008000;"&gt;'data'&lt;/span&gt;: acquired_points.tolist()})

&lt;span style="color: #6434A3;"&gt;@app.route&lt;/span&gt;(&lt;span style="color: #008000;"&gt;'/cv'&lt;/span&gt;)
&lt;span style="color: #0000FF;"&gt;def&lt;/span&gt; &lt;span style="color: #006699;"&gt;run_cv&lt;/span&gt;():
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #BA36A5;"&gt;result&lt;/span&gt; = &lt;span style="color: #006FE0;"&gt;str&lt;/span&gt;(request.values)
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #BA36A5;"&gt;startv&lt;/span&gt; = &lt;span style="color: #006FE0;"&gt;float&lt;/span&gt;(request.values.get(&lt;span style="color: #008000;"&gt;'startv'&lt;/span&gt;, -0.1))
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #BA36A5;"&gt;endv&lt;/span&gt; = &lt;span style="color: #006FE0;"&gt;float&lt;/span&gt;(request.values.get(&lt;span style="color: #008000;"&gt;'endv'&lt;/span&gt;, 0.1))
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #BA36A5;"&gt;scanrate&lt;/span&gt; = &lt;span style="color: #006FE0;"&gt;float&lt;/span&gt;(request.values.get(&lt;span style="color: #008000;"&gt;'scanrate'&lt;/span&gt;, 1.0))
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #BA36A5;"&gt;samplerate&lt;/span&gt; = &lt;span style="color: #006FE0;"&gt;float&lt;/span&gt;(request.values.get(&lt;span style="color: #008000;"&gt;'samplerate'&lt;/span&gt;, 0.01))

&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #BA36A5;"&gt;data&lt;/span&gt; = run_ramp(startv, endv, scanrate, samplerate)
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   &lt;span style="color: #0000FF;"&gt;return&lt;/span&gt; data


&lt;span style="color: #0000FF;"&gt;if&lt;/span&gt; &lt;span style="color: #006FE0;"&gt;__name__&lt;/span&gt; == &lt;span style="color: #008000;"&gt;'__main__'&lt;/span&gt;:
&lt;span style="color: #9B9B9B; background-color: #EDEDED;"&gt; &lt;/span&gt;   app.run(host=&lt;span style="color: #008000;"&gt;'jkitchin-win.cheme.cmu.edu'&lt;/span&gt;, port=5000, debug=&lt;span style="color: #D0372D;"&gt;True&lt;/span&gt;)
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Copyright (C) 2015 by John Kitchin. See the &lt;a href="/copying.html"&gt;License&lt;/a&gt; for information about copying.&lt;p&gt;&lt;p&gt;&lt;a href="/org/2015/07/25/Running-scientific-instruments-in-Emacs-and-recording-the-results.org"&gt;org-mode source&lt;/a&gt;&lt;p&gt;&lt;p&gt;Org-mode version = 8.2.10&lt;/p&gt;]]></content:encoded>
    </item>
  </channel>
</rss>
