Closedown
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
class Detector(DeviceBase):
|
||||
def __init__(self, name):
|
||||
DeviceBase.__init__(self, name)
|
||||
self.setSimulated()
|
||||
DeviceBase.__init__(self, name, simulated=False)
|
||||
if simulated:
|
||||
self.setSimulated()
|
||||
self.simulated_pars = {}
|
||||
|
||||
def doInitialize(self):
|
||||
|
||||
@@ -1,31 +1,46 @@
|
||||
class StdDaq(DeviceBase):
|
||||
def __init__(self, name):
|
||||
def __init__(self, name, url, simulated=False):
|
||||
DeviceBase.__init__(self, name)
|
||||
self.setSimulated()
|
||||
self.simulated_config = {
|
||||
"detector_name": "eg",
|
||||
"detector_type": "eiger",
|
||||
"n_modules": 2,
|
||||
"bit_depth": 32,
|
||||
"image_pixel_height": 514,
|
||||
"image_pixel_width": 1030,
|
||||
"start_udp_port": 50000
|
||||
}
|
||||
self.url=url
|
||||
self.req_id = None
|
||||
if simulated:
|
||||
self.setSimulated()
|
||||
self.simulated_id=1
|
||||
self.simulated_config = {
|
||||
"detector_name": "eg",
|
||||
"detector_type": "eiger",
|
||||
"n_modules": 2,
|
||||
"bit_depth": 32,
|
||||
"image_pixel_height": 514,
|
||||
"image_pixel_width": 1030,
|
||||
"start_udp_port": 50000
|
||||
}
|
||||
|
||||
|
||||
def doInitialize(self):
|
||||
pass
|
||||
|
||||
def start(self):
|
||||
def start(n_images, output_file):
|
||||
self.state.assertIs(State.Ready)
|
||||
if not self.simulated:
|
||||
pass
|
||||
data = {"sources":"eiger", "n_images":10, "output_file":"/tmp/test.h5"}
|
||||
headers = {'Content-type': 'application/json'}
|
||||
r = requests.post(url = self.url + "/write_async", json=data, headers=headers)
|
||||
self.req_id = str(r.json()["request_id"])
|
||||
|
||||
else:
|
||||
self.req_id = self.simulated_id
|
||||
self.simulated_id=self.simulated_id+1
|
||||
self.setCache(self.req_id, None)
|
||||
self.setState(State.Busy)
|
||||
|
||||
def stop(self):
|
||||
self.state.assertIs(State.Busy)
|
||||
if not self.simulated:
|
||||
pass
|
||||
data = {"request_id":self.req_id}
|
||||
headers = {'Content-type': 'application/json'}
|
||||
r = requests.post(url = self.url + "/write_kill", json=data, headers=headers)
|
||||
self.setCache(None, None)
|
||||
self.setState(State.Ready)
|
||||
|
||||
def get_config(self):
|
||||
|
||||
Reference in New Issue
Block a user