adjusted daq and scan logic

This commit is contained in:
2019-12-04 15:16:15 +00:00
parent 438e307ba7
commit ec261e020a
4 changed files with 22 additions and 12 deletions
+8 -1
View File
@@ -1,4 +1,5 @@
from epics import PV
from time import sleep
def within(val, vmin, vmax):
@@ -17,8 +18,14 @@ class PVChecker:
self.wait_time = wait_time
def check(self):
val = self.pv.get()
val = self.current()
return within(val, self.vmin, self.vmax)
def current(self):
return self.pv.get()
def sleep(self):
sleep(self.wait_time)
+3 -3
View File
@@ -63,9 +63,9 @@ class BS:
def h5(self,fina=None,channel_list=None,N_pulses=None,default_path=True,queue_size=100):
if default_path:
fina = self._default_file_path%fina
# if default_path:
# fina = self._default_file_path%fina
#
if os.path.isfile(fina):
print('!!! File %s already exists, would you like to delete it?'%fina)
if input('(y/n)')=='y':
+7 -4
View File
@@ -1,5 +1,8 @@
import os
import datetime
from time import sleep
from detector_integration_api import DetectorIntegrationClient
from .utilities import Acquisition
class DIA:
@@ -8,7 +11,7 @@ class DIA:
self.client = DetectorIntegrationClient(api_address)
print("\nDetector Integration API on %s" % api_address)
# No pgroup by default
self.pgroup = 0
self.pgroup = pgroup
self.n_frames = 100
self.jf_name = jf_name
self.jf_Ids = []
@@ -25,7 +28,7 @@ class DIA:
def update_config(self, ):
self.writer_config = {
"output_file": "/sf/%s/data/p%d/raw/test_data.h5" % (self.instrument, self.pgroup),
"output_file": "/sf/%s/data/%s/raw/test_data.h5" % (self.instrument, self.pgroup),
"user_id": self.pgroup,
"n_frames": self.n_frames,
"general/user": str(self.pgroup),
@@ -77,7 +80,7 @@ class DIA:
# '/sf/alvra/config/com/channel_lists/default_channel_list')
self.bsread_config = {
'output_file': '/sf/%s/data/p%d/raw/test_bsread.h5' % (self.instrument, self.pgroup),
'output_file': '/sf/%s/data/%s/raw/test_bsread.h5' % (self.instrument, self.pgroup),
'user_id': self.pgroup,
"general/user": str(self.pgroup),
"general/process": __name__,
@@ -180,7 +183,7 @@ class DIA:
JF_factor?
bsread_padding?
"""
file_rootdir = '/sf/%s/data/p%d/raw/' % (self.instrument, self.pgroup)
file_rootdir = '/sf/%s/data/%s/raw/' % (self.instrument, self.pgroup)
if file_name is None:
# FIXME /dev/null crashes the data taking (h5py can't close /dev/null and crashes)
+4 -4
View File
@@ -4,7 +4,7 @@ import numpy as np
from time import sleep
import traceback
class ScannerSimple:
class ScanSimple:
def __init__(self,adjustables,values,counterCallers,fina,Npulses=100,basepath='',scan_info_dir='',checker=None,scan_directories=False):
self.Nsteps = len(values)
self.pulses_per_step = Npulses
@@ -47,9 +47,9 @@ class ScannerSimple:
def doNextStep(self,step_info=None,verbose=True):
if self.checker:
while not self.checker['checker_call'](*self.checker['args'],**self.checker['kwargs']):
while not self.checker.check():
print('Condition checker is not happy, waiting for OK conditions.')
sleep(self.checker['wait_time'])
self.checker.sleep()
if not len(self.values_todo)>0:
return False
@@ -78,7 +78,7 @@ class ScannerSimple:
if verbose:
print('Done with acquisition')
if self.checker:
if not self.checker['checker_call'](*self.checker['args'],**self.checker['kwargs']):
if not self.checker.check():
return True
if callable(step_info):
tstepinfo = step_info()