Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.02 KB | None | 0 0
  1. # Status Object Storage
  2. We need to create a system for saving `Status` objects to a disk so that all of motor positions along the beamline are stored and available to our awesome plots. I think the easiest thing for us to start with will be an SQLite database. This shouldn't be too hard to setup on your own computer and will still scale nicely for our first deployment. There are a ton of resources online, and based on how quickly you picked up `plot.ly` you shouldn't have too much of an issue. I wrote a little simulation below of a fake motor. This should generate you semi-realistic `Status` objects by calling `axis.set(..)`, and you can see what it will look like in context by using the `RunEngine` as described in the comments of the file.
  3.  
  4. ## Components
  5.  
  6. 1. We should have a function that setups a new database for us to start storing `Status` objects for. Take the time to think about how we want to structure this database. Now is the time to experiment a little. Once we deploy and start collecting data it can be a pain to switch the structure of the database.
  7. 2. We should have a function that takes a single completed `Status` object and places it in the database
  8. 3. We need a function that we can add on to that `RunEngine.waiting_hook`. This sees **all** the `Status` objects created in the scan, not just our `MoveStatus` objects. We will need to have some filtering here to only store the status we care about. Also note, the `waiting_hook` will pass you incomplete `Status` objects. You will need to use the `Status.add_callback` to only place the object in the database once we know the outcome of the move.
  9. 4. Currently your plots connect to the `JSON` blob we created. The plots will have to be smart enough to grab data from the database instead.
  10.  
  11. #### P.S
  12. If I didn't show you already, you can install `bluesky` and `ophyd` already you can do this by: `conda install bluesky ophyd -c conda-forge`. You also should be able to load these files into an `IPython` session by typing `%run engine.py` this will give you a place to mess around.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement