Rearranged state dictionary

This commit is contained in:
Joel Collins 2018-12-04 15:10:41 +00:00
parent 904703b581
commit 20e49ad65c
2 changed files with 23 additions and 12 deletions

View file

@ -90,17 +90,28 @@ class Microscope(object):
Return:
dict: Dictionary containing position data, and :py:attr:`openflexure_microscope.camera.base.BaseCamera.state`
"""
state = {}
state = {
'camera': {},
'stage': {},
'plugin': {}
}
# Add stage position
position = self.stage.position
state['position'] = {
state['stage']['position'] = {
'x': position[0],
'y': position[1],
'z': position[2],
}
backlash = self.stage.backlash.tolist()
state['stage']['backlash'] = {
'x': backlash[0],
'y': backlash[1],
'z': backlash[2],
}
# Add camera state
state.update(self.camera.state)
state['camera'] = self.camera.state
return state