Commit 3375f8c1 authored by Advanced Instrumentation's avatar Advanced Instrumentation
Browse files

changed data stored in measurement (config for all devices)

parent 4a56f411
...@@ -110,14 +110,18 @@ def get_config(devices): ...@@ -110,14 +110,18 @@ def get_config(devices):
config[device_name] = device.get_config() config[device_name] = device.get_config()
return config return config
def measure(devices): def measure(devices, devices2measure = 'all'):
time = str(datetime.datetime.now()).replace(':','-').replace(' ','_') time = str(datetime.datetime.now()).replace(':','-').replace(' ','_')
data = {'time': time} data = {'time': time}
data['config'] = get_config(devices) data['config'] = get_config(devices)
data['measure'] = {} data['measure'] = {}
for device in devices:
if devices2measure == 'all':
devices2measure = devices
for device in devices2measure:
device_name = type(device).__name__ device_name = type(device).__name__
if hasattr(device, 'measure'): if hasattr(device, 'measure'):
data['measure'][device_name] = device.measure() data['measure'][device_name] = device.measure()
......
...@@ -333,7 +333,10 @@ def main(devices, io, parallel = False): ...@@ -333,7 +333,10 @@ def main(devices, io, parallel = False):
import time import time
t = time.time() t = time.time()
measurement = dm.measure(devices2measure) #getting data from devices
measurement = dm.measure(devices, devices2measure = devices2measure)
#save data
if save_check.value: if save_check.value:
if name == None: if name == None:
io.save(measurement, io.save(measurement,
...@@ -343,10 +346,12 @@ def main(devices, io, parallel = False): ...@@ -343,10 +346,12 @@ def main(devices, io, parallel = False):
kind = 'measure', comment = comment, name = name+'_'+str(i)) kind = 'measure', comment = comment, name = name+'_'+str(i))
if parallel: if parallel:
connec.send(measurement) connec.send(measurement)
elif output_check.value: elif output_check.value:
dm.plot_measure(measurement, devices2measure,plot_config, 0.01) dm.plot_measure(measurement, devices2measure,plot_config, 0.01)
plt.pause(0.001) plt.pause(0.001)
plt.draw_all(force = True) plt.draw_all(force = True)
print ('maximal possible rate: ',np.round(1/(time.time() -t),1)) print ('maximal possible rate: ',np.round(1/(time.time() -t),1))
if (1/rate_text.value - (time.time() -t) < 0): if (1/rate_text.value - (time.time() -t) < 0):
print ('set rate cannot be reached.') print ('set rate cannot be reached.')
......
...@@ -746,7 +746,9 @@ ...@@ -746,7 +746,9 @@
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"metadata": { "metadata": {
"collapsed": true "collapsed": true,
"deletable": true,
"editable": true
}, },
"outputs": [], "outputs": [],
"source": [] "source": []
...@@ -952,7 +954,7 @@ ...@@ -952,7 +954,7 @@
"metadata": { "metadata": {
"anaconda-cloud": {}, "anaconda-cloud": {},
"kernelspec": { "kernelspec": {
"display_name": "Python [default]", "display_name": "Python 3",
"language": "python", "language": "python",
"name": "python3" "name": "python3"
}, },
...@@ -966,7 +968,7 @@ ...@@ -966,7 +968,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.5.3" "version": "3.6.0"
}, },
"widgets": { "widgets": {
"state": { "state": {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment