Week 12. Interface and application programming: FabScanner interface

For the FabScanner, the application does several jobs

  1. Coordinate data acqusition from the synchronous detector with the motion system
  2. Estimate the surface based on the scattering amplitudes at each voxel
  3. Display the surface
  4. Compare the FabScanner measurement to measurements from other scanners

I used Python and the Gestalt libraries to coordinate data acqusition with motion, used Python to estimate the surface based on scattering amplitudes, and used JavaScript, D3, and Plotly.js to display the surface.


Nadya noted that when the machine finishes execution, its origin is reset compared to its previous value. In other words, when the program begins execution, its initial position is the origin. So I should Raster at specific XY positions, generate a grid.

Matplotlib and Tkinter

I first tried to plot values from Python scripts using Matplotlib. Though I have Matplotlib installed, nothing happened when I used it, a documented issue. Following guidelines, I tried to install Matplotlib again using pip, then again using brew, and I also modified the configuration file to try different backends, but I have not yet solved the issue.

Next I looked for Tkinter examples. I displayed some simple scatter plots, but my feeling is the functionality is much lower level than other options, especially when comes time to display surfaces.


Thus I decided to display the data using JavaScript. I should have done this from the start. Examples such as Plotly.js have lots of functionality, seems straightforward to include my own data, and might even have the advantage of being integrated as a JavaScript module into mods in future.

To pass data from Python to the JavaScript, seems I can use a JSON file. Perhaps ask Amanda this afternoon. I may need to run a local webserver to make this work.

First, I plotted a static surface using the Plotly.js environment. I cloned the Plotly.js library usinggit clone https://github.com/plotly/plotly.js

then http://stackoverflow.com/questions/19206332/gaussian-fit-for-python Learn more about d3 here. Followed tutorial here. https://jquery.com/download/ d3 probably runs atop jQuery, a ubiquitous and powerful library https://bost.ocks.org/mike/circles/ http://stackoverflow.com/questions/16000314/replacing-d3-js-diagram-instead-of-creating-a-new-one-every-time Need to run a local webserver for asynchronous calls to the JSON file. Check out https://square.github.io/intro-to-d3/web-standards/