Commit d825ea60 authored by Nick Sauerwein's avatar Nick Sauerwein
Browse files

device_pool, measurement_manager, io functional

parent 6a07bd76
......@@ -30,8 +30,9 @@
"metadata": {},
"outputs": [],
"source": [
"import Scripts.DevicePool as DP\n",
"from Scripts.GUI import DevicePoolInterface, IoInterface\n",
"from Scripts.DevicePool as DevicePool\n",
"from Scripts.MeasurementManager import MeasurementManager\n",
"from Scripts.GUI import DevicePoolInterface, IoInterface, MeasurementManagerInterface\n",
"from Scripts.DataManager import IO"
]
},
......@@ -43,7 +44,9 @@
},
"outputs": [],
"source": [
"device_pool = DP.DevicePool()"
"device_pool = DevicePool()\n",
"io = IO('Data/test/')\n",
"measurement_manager = MeasurementManager(device_pool, io)"
]
},
{
......@@ -53,10 +56,17 @@
"scrolled": false
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Widget Javascript not detected. It may not be installed or enabled properly.\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "80a8015957734c7c8fe8347687e673ac"
"model_id": "2c5d127f5eb14fe8b2ba9a951309ab63"
}
},
"metadata": {},
......@@ -70,81 +80,57 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 11,
"metadata": {
"scrolled": false
},
"outputs": [],
"source": [
"io = IO('Data/test/')\n",
"\n",
"#Ionterface(io, device_pool, device_pool_interface).show()"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
"from Scripts.MeasurementManager import MeasurementManager"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "b9941677dffd4fb5a3fb4a16eafde98c"
}
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"measurement_manager = MeasurementManager(device_pool, io)"
"IoInterface(io, device_pool, device_pool_interface).show()"
]
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 26,
"metadata": {
"scrolled": false
"scrolled": true
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Process DeviceMeasurer-1:\n",
" File \"PyPylon/cython/factory.pyx\", line 231, in grab_images (cython/factory.cpp:5250)\n",
"Traceback (most recent call last):\n",
" File \"/home/data/anaconda3/lib/python3.5/multiprocessing/process.py\", line 249, in _bootstrap\n",
" self.run()\n",
" File \"/home/data/lwfaserver/Scripts/MeasurementManager.py\", line 100, in run\n",
" self.measure()\n",
" File \"/home/data/lwfaserver/Scripts/MeasurementManager.py\", line 104, in measure\n",
" device_measurement = self.device.measure()\n",
" File \"/home/data/lwfaserver/Scripts/DevicePool.py\", line 71, in measure\n",
" return self.obj.measure()\n",
" File \"/home/data/lwfaserver/Devices/PlasmaCamHorizontal.py\", line 91, in measure\n",
" for img in self.cam.grab_images(1):\n",
"RuntimeError: Unknown exception\n"
]
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "e9b902c1c44c4839b5598c2ee6ea254f"
}
},
"metadata": {},
"output_type": "display_data"
},
{
"ename": "KeyboardInterrupt",
"evalue": "",
"ename": "AttributeError",
"evalue": "'ParameterChooser' object has no attribute 'parameter'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-15-b8be0dcff571>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mmeasurement_manager\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmeasure\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;32m/home/data/lwfaserver/Scripts/MeasurementManager.py\u001b[0m in \u001b[0;36mmeasure\u001b[0;34m(self, save, comment, plot_config)\u001b[0m\n\u001b[1;32m 44\u001b[0m \u001b[0;32mwhile\u001b[0m \u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmeasurement\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'measure'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m<\u001b[0m \u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdevices_to_measure\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 45\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mdevice_name\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mdevice_names\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 46\u001b[0;31m \u001b[0;32mif\u001b[0m \u001b[0mmeasure_pipes\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mdevice_name\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpoll\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 47\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 48\u001b[0m \u001b[0mmeasurement\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'measure'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mdevice_name\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mmeasure_pipes\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mdevice_name\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrecv\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/home/data/anaconda3/lib/python3.5/multiprocessing/connection.py\u001b[0m in \u001b[0;36mpoll\u001b[0;34m(self, timeout)\u001b[0m\n\u001b[1;32m 255\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_check_closed\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 256\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_check_readable\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 257\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_poll\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtimeout\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 258\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 259\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__enter__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/home/data/anaconda3/lib/python3.5/multiprocessing/connection.py\u001b[0m in \u001b[0;36m_poll\u001b[0;34m(self, timeout)\u001b[0m\n\u001b[1;32m 412\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 413\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_poll\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtimeout\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 414\u001b[0;31m \u001b[0mr\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mwait\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtimeout\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 415\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mbool\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mr\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 416\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/home/data/anaconda3/lib/python3.5/multiprocessing/connection.py\u001b[0m in \u001b[0;36mwait\u001b[0;34m(object_list, timeout)\u001b[0m\n\u001b[1;32m 909\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 910\u001b[0m \u001b[0;32mwhile\u001b[0m \u001b[0;32mTrue\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 911\u001b[0;31m \u001b[0mready\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mselector\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mselect\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtimeout\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 912\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mready\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 913\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfileobj\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mevents\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mready\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/home/data/anaconda3/lib/python3.5/selectors.py\u001b[0m in \u001b[0;36mselect\u001b[0;34m(self, timeout)\u001b[0m\n\u001b[1;32m 374\u001b[0m \u001b[0mready\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 375\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 376\u001b[0;31m \u001b[0mfd_event_list\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_poll\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpoll\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtimeout\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 377\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mInterruptedError\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 378\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mready\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mKeyboardInterrupt\u001b[0m: "
"\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m/home/data/lwfaserver/Scripts/GUI.py\u001b[0m in \u001b[0;36mscan\u001b[0;34m(self, bt)\u001b[0m\n\u001b[1;32m 424\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 425\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mscan\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbt\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 426\u001b[0;31m self.measurement_manager.scan(self.scan_configurator.parameters,\n\u001b[0m\u001b[1;32m 427\u001b[0m \u001b[0mn_loop\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mn_loop_int\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mvalue\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 428\u001b[0m \u001b[0mrate\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrate_float\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mvalue\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/home/data/lwfaserver/Scripts/GUI.py\u001b[0m in \u001b[0;36mparameters\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 540\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mparameters\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 541\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 542\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0mpc\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mparameter\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mpc\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mparameter_choosers\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 543\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 544\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/home/data/lwfaserver/Scripts/GUI.py\u001b[0m in \u001b[0;36m<listcomp>\u001b[0;34m(.0)\u001b[0m\n\u001b[1;32m 540\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mparameters\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 541\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 542\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0mpc\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mparameter\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mpc\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mparameter_choosers\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 543\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 544\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mAttributeError\u001b[0m: 'ParameterChooser' object has no attribute 'parameter'"
]
}
],
"source": [
"measurement_manager.measure()"
"MeasurementManagerInterface(measurement_manager).show()"
]
},
{
......@@ -3059,6 +3045,28 @@
"device_pool['PlasmaCamHorizontal'].measure()"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a = {'b': 1}\n",
"\n",
"'a' in a"
]
},
{
"cell_type": "code",
"execution_count": null,
......
......@@ -107,6 +107,15 @@ class DevicePool:
return [device for name, device in self.devices.items() if device.connected & device.make_measurement & device.make_plot]
@property
def plotable_devices(self):
return [device for name, device in self.devices.items() if device.measureable]
@property
def measureable_devices(self):
return [device for name, device in self.devices.items() if device.plotable]
def import_devices(self):
device_scripts = glob.glob(os.getcwd()+'/Devices/*.py')
......
This diff is collapsed.
from multiprocessing import Process, Pipe
from threading import Thread
from multiprocessing import Pipe
import time
import datetime
import os
import numpy as np
from Scripts.PlottingServers import Plot1DServer
#this class deals with measurements
class MeasurementManager:
......@@ -8,10 +14,11 @@ class MeasurementManager:
def __init__(self, device_pool, io):
self.device_pool = device_pool
self.io = io
self.plot_hist = {}
self.plot_servers = {}
def measure(self, save = False, comment = '', plot_config = {}):
def measure(self, save = False, comment = '', plot_config = {}, name = None):
print ('')
print ('Measurement: '+comment)
......@@ -34,7 +41,7 @@ class MeasurementManager:
measurement = {'comment': comment}
measurement = {'comment': comment, 'time': str(datetime.datetime.now()).replace(':','-').replace(' ','_')}
measurement['config'] = self.device_pool.config
measurement['measure'] = {}
......@@ -48,20 +55,58 @@ class MeasurementManager:
measurement['measure'][device_name] = measure_pipes[device_name][1].recv()
if self.device_pool[device_name].make_plot:
self.device_pool[device_name].plot_measure(measurement['measure'][device_name])
# here the way to plot is defined
self._plot_measure(measurement['measure'][device_name],
self.device_pool[device_name],
plot_config)
print (device_name+' measurement time: '+str(time.time() - t0))
#stop measurement
for device_name in device_names:
device_measurers[device_name].join()
if save:
self.io.save(measurement,
kind = 'measure', comment = comment, name = name)
return measurement
def _plot_measure(self, device_measurement, device, plot_config):
if device.name in plot_config:
if not device.name in self.plot_hist:
self.plot_hist[device.name] = {}
if not device.name in self.plot_servers:
self.plot_servers[device.name] = {}
parameters = plot_config[device.name]
for para, to_plot in parameters.items():
if para == 'plot_measure':
device.plot_measure(device_measurement)
continue
if to_plot:
if para not in self.plot_servers[device.name]:
self.plot_servers[device.name][para] = Plot1DServer({'xlabel' : 'last measurements',
'ylabel' : 'value',
'title': 'history: '+device.name+' '+para})
if para not in self.plot_hist[device.name]:
self.plot_hist[device.name][para] = []
self.plot_hist[device.name][para] += [device_measurement[para]]
self.plot_servers[device.name][para].update(range(-len(self.plot_hist[device.name][para])+1,1),
self.plot_hist[device.name][para])
else:
device.plot_measure(device_measurement)
def loop(self, n_loops, rate, comment = ''):
def loop(self, n_loops, rate,save = False, comment = '', plot_config = {}, name = None):
measurements = []
......@@ -69,7 +114,15 @@ class MeasurementManager:
for i in range(n_loops):
t0 = time.time()
measurements += [self.measure(comment = comment +' '+str(i))]
if name == None:
measurements += [self.measure(comment = comment+' '+str(i), plot_config = plot_config,
save = save)]
else:
measurements += [self.measure(comment = comment+' '+str(i), plot_config = plot_config,
name = name+'_'+str(i), save = save)]
t1 = time.time() - t0
if 1/t1 > rate:
......@@ -85,16 +138,55 @@ class MeasurementManager:
def scan(self, scan_parameter):
def scan(self, scan_parameter, n_loop = 1, rate = 1, save = False, plot_config = {}):
#scan_parameter = [[device, parameter, from, to, n_steps], ...]
pass
scan_parameter = np.array(scan_parameter, dtype = object)
ndim = len(scan_parameter)
devices_to_change = scan_parameter[:,0]
parameters_to_change = scan_parameter[:,1]
change_from = scan_parameter[:,2]
change_to = scan_parameter[:,3]
n_steps = scan_parameter[:,4]
linspaces = [np.linspace(change_from[i], change_to[i], n_steps[i]) for i in range(ndim)]
grid = np.meshgrid(*linspaces, indexing = 'ij')
grid = [par.flatten() for par in grid]
info = ''.join([devices_to_change[i]+'-'+parameters_to_change[i]+'_'+str(change_from[i])+'-'+str(change_to[i])+'_'+str(n_steps[i])+'+' for i in range(ndim)])
comment = 'scan of '+info
config_ini = self.device_pool.config
folder_name = 'scan_'+str(datetime.datetime.now()).replace(':','-').replace(' ','_') +'_'+ info
if save:
os.mkdir(self.io.path+ folder_name)
self.io.save(config_ini, name = folder_name+'/config_at_start',comment = 'before '+comment)
for parameter in np.transpose(grid):
for device, par_name, scan_value in zip(devices_to_change, parameters_to_change, parameter):
config_ini[device][par_name] = scan_value
self.device_pool.config = config_ini
self.loop(n_loop, rate, comment = comment+', current values: '+str(parameter),
name = folder_name+'/'+str(parameters_to_change).replace("'","")+'='+str(parameter),
save = save, plot_config = plot_config)
class DeviceMeasurer(Process):
class DeviceMeasurer(Thread):
def __init__(self, connec, device, *args, **kwargs):
self.connec = connec
self.device = device
Process.__init__(self, *args, **kwargs)
Thread.__init__(self, *args, **kwargs)
def run(self):
self.measure()
......
This diff is collapsed.
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