예제 #1
0
    def get_state(self):
        """
            Returns an object with the state of the interface
        """
        m = DataSets()
        
        #Peak Selection
        if self._summary.data_peak_discrete_switch.isChecked():
            m.DataPeakSelectionType = 'discrete'
        if self._summary.data_peak_broad_switch.isChecked():
            m.DataPeakSelectionType = 'broad'
        if self._summary.data_peak_narrow_switch.isChecked():
            m.DataPeakSelectionType = 'narrow'

        #Peak from/to pixels
        m.DataPeakPixels[0] = str(self._summary.data_peak_from_pixel.text())
        m.DataPeakPixels[1] = str(self._summary.data_peak_to_pixel.text())    
        
        #Discrete selection string
        m.DataPeakDiscreteSelection = self._summary.data_peak_nbr_selection_value.text()    

        #Background flag
        m.DataBackgroundFlag = self._summary.data_background_switch.isChecked()

        #Background from/to pixels
        roi1_from = str(self._summary.data_background_from_pixel1.text())
        roi1_to = str(self._summary.data_background_to_pixel1.text())
        roi2_from = str(self._summary.data_background_from_pixel2.text())
        roi2_to = str(self._summary.data_background_to_pixel2.text())
        m.DataBackgroundRoi = [roi1_from, roi1_to, roi2_from, roi2_to]

        #from TOF and to TOF
        from_tof = str(self._summary.data_from_tof.text())
        to_tof = str(self._summary.data_to_tof.text())
        m.DataTofRange = [from_tof, to_tof]

        return m
예제 #2
0
        def _new_data_set():
            d = DataSets()
            d.NormFlag = True
            d.DataBackgroundFlag = True
            d.data_x_range_flag = True
            d.norm_x_range_flag = True
            d.DataTofRange = tof_range
            d.NormBackgroundFlag = True
            d.slits_width_flag = True
            d.incident_medium_list = [incident_medium]
            d.incident_medium_index_selected = 0
            d.angle_offset = angle_offset
            d.angle_offset_error = angle_offset_err

            d.q_min = q_min
            d.q_step = q_step
            d.fourth_column_dq0 = dQ_constant
            d.fourth_column_dq_over_q = dQ_slope
            d.scaling_factor_file = sf_file
            return d
예제 #3
0
    def get_editing_state(self):

        m = REFLDataSets()

        #Peak from/to pixels
        m.DataPeakPixels = [
            int(self._summary.data_peak_from_pixel.text()),
            int(self._summary.data_peak_to_pixel.text())
        ]

        #incident medium
        m.incident_medium_list = [
            self._summary.incident_medium_combobox.itemText(i)
            for i in range(self._summary.incident_medium_combobox.count())
        ]
        m.incident_medium_index_selected = self._summary.incident_medium_combobox.currentIndex(
        )

        m.data_x_range = [
            int(self._summary.x_min_edit.text()),
            int(self._summary.x_max_edit.text())
        ]
        m.data_x_range_flag = self._summary.data_low_res_range_switch.isChecked(
        )

        m.norm_x_range = [
            int(self._summary.norm_x_min_edit.text()),
            int(self._summary.norm_x_max_edit.text())
        ]
        m.norm_x_range_flag = self._summary.norm_low_res_range_switch.isChecked(
        )

        #Background flag
        m.DataBackgroundFlag = self._summary.data_background_switch.isChecked()

        #Background from/to pixels
        roi1_from = int(self._summary.data_background_from_pixel1.text())
        roi1_to = int(self._summary.data_background_to_pixel1.text())
        m.DataBackgroundRoi = [roi1_from, roi1_to, 0, 0]

        #data metadata
        m.tthd_value = str(self._summary.tthd_value.text())
        m.ths_value = str(self._summary.ths_value.text())

        #from TOF and to TOF
        from_tof = float(self._summary.data_from_tof.text())
        to_tof = float(self._summary.data_to_tof.text())
        m.DataTofRange = [from_tof, to_tof]
        m.TofRangeFlag = self._summary.tof_range_switch.isChecked()

        datafiles = str(self._summary.data_run_number_edit.text()).split(',')
        m.data_files = [int(i) for i in datafiles]

        # Normalization flag
        m.NormFlag = self._summary.norm_switch.isChecked()

        # Normalization options
        m.norm_file = int(self._summary.norm_run_number_edit.text())
        m.NormPeakPixels = [
            int(self._summary.norm_peak_from_pixel.text()),
            int(self._summary.norm_peak_to_pixel.text())
        ]

        #Background flag
        m.NormBackgroundFlag = self._summary.norm_background_switch.isChecked()

        #Background from/to pixels
        roi1_from = int(self._summary.norm_background_from_pixel1.text())
        roi1_to = int(self._summary.norm_background_to_pixel1.text())
        m.NormBackgroundRoi = [roi1_from, roi1_to]

        #4th column (precision)
        m.fourth_column_flag = self._summary.fourth_column_switch.isChecked()
        m.fourth_column_dq0 = float(self._summary.dq0.text())
        m.fourth_column_dq_over_q = float(self._summary.dq_over_q.text())
        #        self._fourth_column_clicked(m.fourth_column_flag)

        return m
예제 #4
0
    def get_editing_state(self):
        
        m = REFLDataSets()
        
        #Peak from/to pixels
        m.DataPeakPixels = [int(self._summary.data_peak_from_pixel.text()),
                            int(self._summary.data_peak_to_pixel.text())] 
        
        #incident medium
        m.incident_medium_list = [self._summary.incident_medium_combobox.itemText(i) 
                                  for i in range(self._summary.incident_medium_combobox.count())]
        m.incident_medium_index_selected = self._summary.incident_medium_combobox.currentIndex()
        
        
        m.data_x_range = [int(self._summary.x_min_edit.text()),
                     int(self._summary.x_max_edit.text())]
        m.data_x_range_flag = self._summary.data_low_res_range_switch.isChecked()
        
        m.norm_x_range = [int(self._summary.norm_x_min_edit.text()),
                          int(self._summary.norm_x_max_edit.text())]
        m.norm_x_range_flag = self._summary.norm_low_res_range_switch.isChecked()
        
        #Background flag
        m.DataBackgroundFlag = self._summary.data_background_switch.isChecked()

        #Background from/to pixels
        roi1_from = int(self._summary.data_background_from_pixel1.text())
        roi1_to = int(self._summary.data_background_to_pixel1.text())
        m.DataBackgroundRoi = [roi1_from, roi1_to, 0, 0]

        #data metadata
        m.tthd_value = str(self._summary.tthd_value.text())
        m.ths_value = str(self._summary.ths_value.text())

        #from TOF and to TOF
        from_tof = float(self._summary.data_from_tof.text())
        to_tof = float(self._summary.data_to_tof.text())
        m.DataTofRange = [from_tof, to_tof]
        m.TofRangeFlag = self._summary.tof_range_switch.isChecked()
    
        datafiles = str(self._summary.data_run_number_edit.text()).split(',')
        m.data_files = [int(i) for i in datafiles]
    
        # Normalization flag
        m.NormFlag = self._summary.norm_switch.isChecked()

        # Normalization options
        m.norm_file = int(self._summary.norm_run_number_edit.text())
        m.NormPeakPixels = [int(self._summary.norm_peak_from_pixel.text()),
                            int(self._summary.norm_peak_to_pixel.text())]   
        
        #Background flag
        m.NormBackgroundFlag = self._summary.norm_background_switch.isChecked()

        #Background from/to pixels
        roi1_from = int(self._summary.norm_background_from_pixel1.text())
        roi1_to = int(self._summary.norm_background_to_pixel1.text())
        m.NormBackgroundRoi = [roi1_from, roi1_to]
        
        #4th column (precision)
        m.fourth_column_flag = self._summary.fourth_column_switch.isChecked()
        m.fourth_column_dq0 = float(self._summary.dq0.text())
        m.fourth_column_dq_over_q = float(self._summary.dq_over_q.text())
#        self._fourth_column_clicked(m.fourth_column_flag)

        return m
예제 #5
0
 def _new_data_set():
     d = DataSets()
     d.NormFlag = True
     d.DataBackgroundFlag = True
     d.data_x_range_flag = True
     d.norm_x_range_flag = True
     d.DataTofRange = tof_range
     d.NormBackgroundFlag = True
     d.slits_width_flag = True
     d.incident_medium_list = [incident_medium]
     d.incident_medium_index_selected = 0
     d.angle_offset = angle_offset
     d.angle_offset_error = angle_offset_err
     d.clocking_from = primary_min
     d.clocking_to = primary_max
     d.q_min = q_min
     d.q_step = q_step
     d.fourth_column_dq0 = dQ_constant
     d.fourth_column_dq_over_q = dQ_slope
     d.scaling_factor_file = sf_file
     return d