added hdf interface
This commit is contained in:
@@ -152,6 +152,7 @@ class AnalysisProcedure(QObject):
|
||||
|
||||
#Step 2 - Perform measurement and return data for processing
|
||||
self.raw_data = self.measure()
|
||||
print("raw data", self.raw_data)
|
||||
|
||||
if self.raw_data is None:
|
||||
self.parent.trigger_progressbar.emit(PROGRESS_BAR_THREAD_ERROR)
|
||||
@@ -165,7 +166,8 @@ class AnalysisProcedure(QObject):
|
||||
|
||||
#Step 5 - Package to all_data dictionary
|
||||
all_data = self.combine_data(ambient_data, proc_data, fig_data)
|
||||
|
||||
print("all data", all_data)
|
||||
|
||||
self.parent.trigger_progressbar.emit(PROGRESS_BAR_THREAD_END)
|
||||
return all_data
|
||||
|
||||
@@ -233,8 +235,11 @@ class AnalysisProcedure(QObject):
|
||||
return None
|
||||
|
||||
#Fill Raw data here
|
||||
raw_data = {}
|
||||
raw_data['test']='testing'
|
||||
raw_data = {
|
||||
'test': 'testing'
|
||||
}
|
||||
|
||||
|
||||
return raw_data
|
||||
|
||||
def process(self, ambient_data, from_hdf5=False):
|
||||
@@ -348,8 +353,9 @@ class AnalysisProcedure(QObject):
|
||||
|
||||
all_data = {'Input data': self.input_data}
|
||||
all_data['Ambient data'] = ambient_data
|
||||
all_data['Raw data'] = self.raw_data
|
||||
all_data['Application Raw data'] = self.raw_data
|
||||
all_data['Processed data'] = proc_data
|
||||
all_data['Figure data'] = fig_data
|
||||
all_data['Raw data'] = {}
|
||||
|
||||
return(all_data)
|
||||
|
||||
48
tina.py
48
tina.py
@@ -12,8 +12,8 @@ from qtpy.QtCore import PYQT_VERSION_STR, Signal, Slot
|
||||
from qtpy.QtWidgets import QApplication, QMessageBox
|
||||
|
||||
from apps4ops.bdbase.base import BaseWindow
|
||||
from apps4ops.bdbase import utils
|
||||
from apps4ops.bdbase.utils import _line
|
||||
from apps4ops.bdbase import h5_storage, utils
|
||||
#from apps4ops.bdbase.utils import _line
|
||||
from apps4ops.bdbase.enumkind import Facility, MsgSeverity, UserMode
|
||||
from apps4ops.bdbase.helpbrowser import HelpBrowser
|
||||
from apps4ops.hipa.sendeloghipa import QSendToELOG
|
||||
@@ -25,7 +25,8 @@ from pyrcc5 import tina_resources
|
||||
|
||||
_pymodule = os.path.basename(__file__)
|
||||
_appname, _appext = _pymodule.split(".")
|
||||
_appversion = "0.0.0"
|
||||
_abspath = os.path.dirname(os.path.abspath(__file__))
|
||||
_appversion = "0.0.1"
|
||||
_title = "No of Turns Measurement"
|
||||
|
||||
_appname = "Tina"
|
||||
@@ -41,6 +42,7 @@ class StartMain(BaseWindow):
|
||||
has_optics=False, has_procedure=True)
|
||||
|
||||
self.appname = _appname
|
||||
self.source_file = _abspath #required for HDF
|
||||
self.elog_enum = ElogHIPA()
|
||||
self.gui = AppGui(self)
|
||||
|
||||
@@ -80,6 +82,37 @@ class StartMain(BaseWindow):
|
||||
def analysis_thread_finished(self):
|
||||
BaseWindow.analysis_thread_finished(self)
|
||||
self.gui_frame.central_tab_widget.setCurrentIndex(1)
|
||||
|
||||
|
||||
@Slot()
|
||||
def save_to_hdf(self, from_dialog=False):
|
||||
if not self.verify_save_to_hdf():
|
||||
return False
|
||||
|
||||
if self.all_data is not None:
|
||||
self.save_hdf_thread = self.HDFSave(self, from_dialog)
|
||||
# self.save_hdf_thread.started.connect(self.save_to_hdf_started)
|
||||
# self.save_hdf_thread.finished.connect(self.save_to_hdf_finished)
|
||||
self.save_hdf_thread.start()
|
||||
self.hdf_save_completed = True
|
||||
time.sleep(0.05) # Wait a tick
|
||||
return True
|
||||
|
||||
|
||||
def add_to_hdf(self, dataH5, proc=True, raw=False):
|
||||
"""User supplied hdf data
|
||||
"""
|
||||
if self.all_data is not None:
|
||||
self.all_data['Raw data']['Input_data'] = self.all_data[
|
||||
'Input data']
|
||||
self.all_data['Raw data']['Ambient_data'] = self.all_data[
|
||||
'Ambient data']
|
||||
self.all_data['Raw data']['Processed_data'] = self.all_data[
|
||||
'Processed data']
|
||||
self.all_data['Raw data']['Raw_data'] = self.all_data[
|
||||
'Application Raw data']
|
||||
h5_storage.saveH5Recursive(
|
||||
self.hdf_filename, self.all_data['Raw data'], dataH5)
|
||||
|
||||
@Slot()
|
||||
def send_to_elog(self):
|
||||
@@ -105,10 +138,7 @@ class StartMain(BaseWindow):
|
||||
message=self.message,
|
||||
attachFile=self.attach_files)
|
||||
|
||||
time.sleep(1.0)
|
||||
|
||||
# if not self.verify_send_to_elog():
|
||||
# return
|
||||
time.sleep(0.5)
|
||||
|
||||
self.prepare_elog_message()
|
||||
|
||||
@@ -147,7 +177,9 @@ class StartMain(BaseWindow):
|
||||
save_fig_thread.start()
|
||||
time.sleep(0.05)
|
||||
|
||||
def save_to_epics(self):
|
||||
def save_to_epics(self):
|
||||
""" Write the number of turns calculated to an EPICS PV
|
||||
"""
|
||||
print(self.all_data)
|
||||
if not BaseWindow.verify_save_to_epics(self):
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user