def _init_models(self): """ Descript. : """ self._char = queue_model_objects.Characterisation() self._char_params = self._char.characterisation_parameters self._processing_parameters = queue_model_objects.ProcessingParameters( ) self._set_space_group(self._processing_parameters.space_group) if self._beamline_setup_hwobj is not None: self._acquisition_parameters = self._beamline_setup_hwobj.\ get_default_char_acq_parameters() self._char_params = self._beamline_setup_hwobj.\ get_default_characterisation_parameters() else: self._acquisition_parameters = queue_model_objects.AcquisitionParameters( ) self._path_template.reference_image_prefix = 'ref' # The num images drop down default value is 1 # we would like it to be 2 self._acquisition_parameters.num_images = 2 self._char.characterisation_software =\ queue_model_enumerables.COLLECTION_ORIGIN.EDNA self._path_template.num_files = 2 self._path_template.compression = False self._acquisition_parameters.shutterless = False
def __init__(self, parent = None, name = None, fl = 0, acq_params = None, path_template = None, layout = None): """ Descript. : """ QtGui.QWidget.__init__(self, parent, QtCore.Qt.WindowFlags(fl)) if name is not None: self.setObjectName(name) # Hardware objects ---------------------------------------------------- self._beamline_setup_hwobj = None # Internal variables -------------------------------------------------- # Properties ---------------------------------------------------------- # Signals ------------------------------------------------------------- # Slots --------------------------------------------------------------- # Graphic elements ---------------------------------------------------- if acq_params is None: self._acquisition_parameters = queue_model_objects.AcquisitionParameters() else: self._acquisition_parameters = acq_params if path_template is None: self._path_template = queue_model_objects.PathTemplate() else: self._path_template = path_template self._acquisition_mib = DataModelInputBinder(self._acquisition_parameters) self.acq_widget = uic.loadUi(os.path.join(os.path.dirname(__file__), "ui_files/Qt4_acquisition_widget_vertical_simple_layout.ui")) # Layout -------------------------------------------------------------- main_layout = QtGui.QVBoxLayout(self) main_layout.addWidget(self.acq_widget) main_layout.setSpacing(0) main_layout.setContentsMargins(0, 0, 0, 0) self.setLayout(main_layout) # SizePolicies -------------------------------------------------------- # Qt signal/slot connections ------------------------------------------ self.acq_widget.num_images_cbox.activated.connect(self.update_num_images) self.acq_widget.detector_mode_combo.activated.connect(self.detector_mode_changed) self.acq_widget.osc_start_cbox.toggled.connect(self.osc_start_cbox_click) # Other --------------------------------------------------------------- self.energy_validator = QtGui.QDoubleValidator(0, 25, 5, self) self.resolution_validator = QtGui.QDoubleValidator(0, 15, 3, self) self.transmission_validator = QtGui.QDoubleValidator(0, 100, 3, self) self.exp_time_validator = QtGui.QDoubleValidator(0, 10000, 5, self) self.acq_widget.osc_start_ledit.setEnabled(False) self.acq_widget.kappa_ledit.setEnabled(False) self.acq_widget.kappa_phi_ledit.setEnabled(False) self.acq_widget.num_images_cbox.setCurrentIndex(1)
def init_acq_model(self): bl_setup = self._beamline_setup_hwobj if bl_setup is not None: if self._acq_widget: self._acq_widget.set_beamline_setup(bl_setup) self._acquisition_parameters = bl_setup.get_default_acquisition_parameters() else: self._acquisition_parameters = queue_model_objects.AcquisitionParameters()
def _init_models(self): """ Descript. : """ self._advanced = queue_model_objects.Advanced() self._processing_parameters = queue_model_objects.ProcessingParameters( ) if self._beamline_setup_hwobj is not None: has_shutter_less = self._beamline_setup_hwobj.\ detector_has_shutterless() self._acquisition_parameters.shutterless = has_shutter_less self._acquisition_parameters = self._beamline_setup_hwobj.\ get_default_acquisition_parameters("default_advanced_values") if not self._advanced_methods: self._advanced_methods = self._beamline_setup_hwobj.get_advanced_methods( ) if self._advanced_methods: for method in self._advanced_methods: self._advanced_methods_widget.method_combo.addItem( method) else: self.setEnabled(False) try: transmission = self._beamline_setup_hwobj.transmission_hwobj.getAttFactor( ) transmission = round(float(transmission), 1) except AttributeError: transmission = 0 try: resolution = self._beamline_setup_hwobj.resolution_hwobj.getPosition( ) resolution = round(float(resolution), 3) except AttributeError: resolution = 0 try: energy = self._beamline_setup_hwobj.energy_hwobj.getCurrentEnergy( ) energy = round(float(energy), 4) except AttributeError: energy = 0 self._acquisition_parameters.resolution = resolution self._acquisition_parameters.energy = energy self._acquisition_parameters.transmission = transmission self.grid_treewidget_item_selection_changed() else: self._acquisition_parameters = queue_model_objects.AcquisitionParameters( )
def _init_models(self): """ Descript. : """ self._char = queue_model_objects.Characterisation() self._char_params = self._char.characterisation_parameters self._processing_parameters = queue_model_objects.ProcessingParameters( ) if self._beamline_setup_hwobj is not None: self._acquisition_parameters = self._beamline_setup_hwobj.\ get_default_char_acq_parameters() self._char_params = self._beamline_setup_hwobj.\ get_default_characterisation_parameters() try: transmission = self._beamline_setup_hwobj.transmission_hwobj.getAttFactor( ) transmission = round(float(transmission), 1) except AttributeError: transmission = 0 try: resolution = self._beamline_setup_hwobj.resolution_hwobj.getPosition( ) resolution = round(float(resolution), 3) except AttributeError: resolution = 0 try: energy = self._beamline_setup_hwobj.energy_hwobj.getCurrentEnergy( ) energy = round(float(energy), 4) except AttributeError: energy = 0 self._acquisition_parameters.resolution = resolution self._acquisition_parameters.energy = energy self._acquisition_parameters.transmission = transmission else: self._acquisition_parameters = queue_model_objects.AcquisitionParameters( ) return self._path_template.reference_image_prefix = 'ref' # The num images drop down default value is 1 # we would like it to be 2 self._acquisition_parameters.num_images = 2 self._char.characterisation_software =\ queue_model_enumerables.COLLECTION_ORIGIN.EDNA self._path_template.num_files = 2 self._acquisition_parameters.shutterless = False
def get_default_acquisition_parameters(self, parent_key=None): """ :returns: A AcquisitionParameters object with all default parameters. """ default_key = "default_acquisition_values" if parent_key is None: parent_key = default_key acq_parameters = queue_model_objects.AcquisitionParameters() try: self[parent_key] except IndexError: logging.warning("No key %s in beamline setup, using %s", parent_key, default_key) parent_key = default_key img_start_num = self[parent_key].getProperty('start_image_number') num_images = self[parent_key].getProperty('number_of_images') osc_range = round(float(self[parent_key].getProperty('range')), 2) overlap = round(float(self[parent_key].getProperty('overlap')), 2) exp_time = round(float(self[parent_key].getProperty('exposure_time')), 4) num_passes = int(self[parent_key].getProperty('number_of_passes')) shutterless = self.detector_has_shutterless() try: detector_mode = self.detector_hwobj.default_mode() except AttributeError: detector_mode = None acq_parameters.first_image = img_start_num acq_parameters.num_images = num_images acq_parameters.osc_start = self._get_omega_axis_position() acq_parameters.osc_range = osc_range acq_parameters.kappa = self._get_kappa_axis_position() acq_parameters.kappa_phi = self._get_kappa_phi_axis_position() acq_parameters.overlap = overlap acq_parameters.exp_time = exp_time acq_parameters.num_passes = num_passes acq_parameters.resolution = self._get_resolution() acq_parameters.energy = self._get_energy() acq_parameters.transmission = self._get_transmission() acq_parameters.shutterless = self._has_shutterless() acq_parameters.detector_mode = self._get_roi_modes() acq_parameters.inverse_beam = False acq_parameters.take_dark_current = True acq_parameters.skip_existing_images = False acq_parameters.take_snapshots = True return acq_parameters
def __init__(self, parent=None, name=None, fl=0, acq_params=None, path_template=None, layout=None): qt.QWidget.__init__(self, parent, name, fl) # # Attributes # if acq_params is None: self._acquisition_parameters = queue_model_objects.AcquisitionParameters( ) else: self._acquisition_parameters = acq_params if path_template is None: self._path_template = queue_model_objects.PathTemplate() else: self._path_template = path_template self._acquisition_mib = DataModelInputBinder( self._acquisition_parameters) # # Layout # h_layout = qt.QHBoxLayout(self) current_dir = os.path.dirname(__file__) ui_file = 'ui_files/acquisition_widget_vertical_simple_layout.ui' widget = qtui.QWidgetFactory.create(os.path.join(current_dir, ui_file)) widget.reparent(self, qt.QPoint(0, 0)) h_layout.addWidget(widget) self.acq_widget_layout = widget # # Logic # self.acq_widget_layout.child('kappa_ledit').setEnabled(False) self.acq_widget_layout.child('kappa_phi_ledit').setEnabled(False) self.acq_widget_layout.child('osc_start_ledit').setEnabled(False) # Default to 2-images self.acq_widget_layout.child('num_images_cbox').setCurrentItem(1) qt.QObject.connect(self.acq_widget_layout.child('num_images_cbox'), qt.SIGNAL("activated(int)"), self.update_num_images)
def init_models(self): CreateTaskBase.init_models(self) self._energy_scan_result = qmo.EnergyScanResult() self._processing_parameters = qmo.ProcessingParameters() if self._beamline_setup_hwobj is not None: has_shutter_less = self._beamline_setup_hwobj.\ detector_has_shutterless() self._acquisition_parameters.shutterless = has_shutter_less self._acquisition_parameters = self._beamline_setup_hwobj.\ get_default_acquisition_parameters("default_helical_values") else: self._acquisition_parameters = qmo.AcquisitionParameters() self._path_template = qmo.PathTemplate()
def init_acq_model(self): bl_setup = self._beamline_setup_hwobj if bl_setup is not None: if self._acq_widget: self._acq_widget.set_beamline_setup(bl_setup) self._acquisition_parameters = bl_setup.get_default_acquisition_parameters( ) self._acq_widget.init_detector_roi_modes() if bl_setup.diffractometer_hwobj.in_plate_mode(): self._acq_widget.set_osc_start_limits(\ bl_setup.diffractometer_hwobj.get_osc_dynamic_limits()) self._acq_widget.use_kappa(False) else: self._acquisition_parameters = queue_model_objects.AcquisitionParameters( )
def get_default_char_acq_parameters(self): """ :returns: A AcquisitionParameters object with all default parameters. """ acq_parameters = queue_model_objects.AcquisitionParameters() parent_key = "default_characterisation_values" img_start_num = self[parent_key].getProperty('start_image_number') num_images = self[parent_key].getProperty('number_of_images') num_wedges = self[parent_key].getProperty('number_of_wedges') osc_range = round(float(self[parent_key].getProperty('range')), 2) overlap = round(float(self[parent_key].getProperty('overlap')), 2) exp_time = round(float(self[parent_key].getProperty('exposure_time')), 4) num_passes = int(self[parent_key].getProperty('number_of_passes')) wedge_size = int(self[parent_key].getProperty('wedge_size')) shutterless = self.detector_has_shutterless() try: detector_mode = self.detector_hwobj.default_mode() except AttributeError: detector_mode = None acq_parameters.first_image = int(img_start_num) acq_parameters.num_images = int(num_images) acq_parameters.osc_start = self._get_omega_axis_position() acq_parameters.osc_range = osc_range acq_parameters.num_wedges = num_wedges acq_parameters.wedge_size = wedge_size acq_parameters.kappa = self._get_kappa_axis_position() acq_parameters.kappa_phi = self._get_kappa_phi_axis_position() acq_parameters.overlap = overlap acq_parameters.exp_time = exp_time acq_parameters.num_passes = num_passes acq_parameters.resolution = self._get_resolution() acq_parameters.energy = self._get_energy() acq_parameters.transmission = self._get_transmission() acq_parameters.shutterless = self._has_shutterless() acq_parameters.detector_mode = self._get_roi_modes() acq_parameters.inverse_beam = False acq_parameters.take_dark_current = True acq_parameters.skip_existing_images = False acq_parameters.take_snapshots = True return acq_parameters
def init_acq_model(self): bl_setup = self._beamline_setup_hwobj if bl_setup is not None: if self._acq_widget: self._acq_widget.set_beamline_setup(bl_setup) def_acq_parameters = bl_setup.get_default_acquisition_parameters() self._acquisition_parameters.set_from_dict(def_acq_parameters.as_dict()) if self._in_plate_mode: self._acq_widget.use_kappa(False) self._acq_widget.use_max_osc_range(True) else: self._acq_widget.use_kappa(True) self._acq_widget.use_max_osc_range(False) else: self._acquisition_parameters = queue_model_objects.AcquisitionParameters()
def init_models(self): """ Descript. : """ CreateTaskBase.init_models(self) self._processing_parameters = queue_model_objects.ProcessingParameters( ) if self._beamline_setup_hwobj is not None: has_shutter_less = self._beamline_setup_hwobj.\ detector_has_shutterless() self._acquisition_parameters.shutterless = has_shutter_less self._acquisition_parameters = self._beamline_setup_hwobj.\ get_default_acquisition_parameters("default_advanced_values") self.__mini_diff_hwobj = self._beamline_setup_hwobj.\ diffractometer_hwobj else: self._acquisition_parameters = queue_model_objects.AcquisitionParameters( ) self._path_template = queue_model_objects.PathTemplate()
def get_default_acquisition_parameters(self): """ :returns: A AcquisitionParameters object with all default parameters. """ acq_parameters = queue_model_objects.AcquisitionParameters() parent_key = "default_acquisition_values" img_start_num = self[parent_key].getProperty('start_image_number') num_images = self[parent_key].getProperty('number_of_images') osc_range = round(float(self[parent_key].getProperty('range')), 2) overlap = round(float(self[parent_key].getProperty('overlap')), 2) exp_time = round(float(self[parent_key].getProperty('exposure_time')), 4) num_passes = int(self[parent_key].getProperty('number_of_passes')) shutterless = bool(self['detector'].getProperty('has_shutterless')) detector_mode = int(self[parent_key].getProperty('detector_mode')) acq_parameters.first_image = img_start_num acq_parameters.num_images = num_images acq_parameters.osc_start = self._get_omega_axis_position() acq_parameters.osc_range = osc_range acq_parameters.overlap = overlap acq_parameters.exp_time = exp_time acq_parameters.num_passes = num_passes acq_parameters.resolution = self._get_resolution() acq_parameters.energy = self._get_energy() acq_parameters.transmission = self._get_transmission() acq_parameters.inverse_beam = False acq_parameters.shutterless = shutterless acq_parameters.take_dark_current = True acq_parameters.skip_existing_images = False acq_parameters.take_snapshots = True acq_parameters.detector_mode = detector_mode return acq_parameters
def __init__(self, parent=None, name=None, fl=0, acq_params=None, path_template=None, layout=None): qt.QWidget.__init__(self, parent, name, fl) # # Attributes # if acq_params is None: self._acquisition_parameters = queue_model_objects.AcquisitionParameters( ) else: self._acquisition_parameters = acq_params if path_template is None: self._path_template = queue_model_objects.PathTemplate() else: self._path_template = path_template self._acquisition_mib = DataModelInputBinder( self._acquisition_parameters) # # Layout # h_layout = qt.QHBoxLayout(self) current_dir = os.path.dirname(__file__) ui_file = 'ui_files/acquisition_widget_vertical_simple_layout.ui' widget = qtui.QWidgetFactory.create(os.path.join(current_dir, ui_file)) widget.reparent(self, qt.QPoint(0, 0)) h_layout.addWidget(widget) self.acq_widget_layout = widget # # Logic # self._acquisition_mib.\ bind_value_update('exp_time', self.acq_widget_layout.child('exp_time_ledit'), float, qt.QDoubleValidator(0.001, 6000, 3, self)) self._acquisition_mib.\ bind_value_update('osc_range', self.acq_widget_layout.child('osc_range_ledit'), float, qt.QDoubleValidator(0.001, 1000, 2, self)) self._acquisition_mib.\ bind_value_update('osc_start', self.acq_widget_layout.child('osc_start_ledit'), float, qt.QDoubleValidator(-1000, 1000, 2, self)) self._acquisition_mib.\ bind_value_update('energy', self.acq_widget_layout.child('energy_ledit'), float, qt.QDoubleValidator(0, 1000, 4, self)) self._acquisition_mib.\ bind_value_update('transmission', self.acq_widget_layout.child('transmission_ledit'), float, qt.QDoubleValidator(0, 1000, 2, self)) self._acquisition_mib.\ bind_value_update('resolution', self.acq_widget_layout.child('resolution_ledit'), float, qt.QDoubleValidator(0, 1000, 3, self)) qt.QObject.connect(self.acq_widget_layout.child('osc_start_cbox'), qt.SIGNAL("toggled(bool)"), self.osc_start_cbox_click) self.acq_widget_layout.child('osc_start_ledit').setEnabled(False) # Default to 2-images self.acq_widget_layout.child('num_images_cbox').setCurrentItem(1) qt.QObject.connect(self.acq_widget_layout.child('num_images_cbox'), qt.SIGNAL("activated(int)"), self.update_num_images)