PYME.Acquire.Utils.failsafe module

class PYME.Acquire.Utils.failsafe.Failsafe(microscope, email_info=None)

Bases: object

Parameters
microscopePYME.Acquire.microscope.Microscope
email_infodict
senderstr

email address to send from

passwordstr

password for sender

receiverstr

destination email address

kill(message='')

kill the lasers

Parameters
messagestr

something about why you needed to kill using the interlock

TODOs:
- require authentication for this endpoint
- make more generic
  • wrap the try-except stuff into a common function,

  • find a way of passing list of “actions” / supplementary actions in constructor

  • move non-standard stuff which is not guaranteed to be present (piFoc, focus_lock, etc into this list)

- find a way of doing email/notification which is a) multi-user aware and b) does not require plaintext passwords
class PYME.Acquire.Utils.failsafe.FailsafeClient(host='127.0.0.1', port=9119, name='interlock')

Bases: object

For systems running two PYMEAcquire instances, e.g. one for drift tracking, this allows you to define a scope.interlock in both systems to kill the lasers in the main PYMEAcquire.

TODO: Do we really need an explicit python client?? Just giving the focus lock code the HTTP endpoint coded as a string and having it do a requests.get() on the endpoint (if defined) might be sufficient and result in less spaghetti. Clients are needed for the remote piezos as we are substituting them for a python object with a previously defined interface, but it might be better to just call the REST interface the official one in cases like this.

kill(message='')
class PYME.Acquire.Utils.failsafe.FailsafeServer(microscope, email_info=None, port=9119, bind_address='')

Bases: APIHTTPServer, Failsafe

NOTE - this will likely not be around long, as it would be preferable to add the interlock endpoints to PYME.acquire_server.AcquireHTTPServer and run a single server process on the microscope computer.

Parameters
microscope: PYME.Acquire.microscope.Microscope
email_infodict
senderstr

email address to send from

passwordstr

password for sender

receiverstr

destination email address

portint

port to listen on

bind_addressstr, optional

specifies ip address to listen on, by default ‘’ will bind to local host.