示例#1
0
 def on_change_beam_size(self):
     """
         Change beam size
     """
     #Change x coordinate
     x_beam_size = self.x_beam_size_tcl.GetValue().lstrip().rstrip()
     if x_beam_size == "" or x_beam_size == str(None):
         x_beam_size = None
     else:
         if check_float(self.x_beam_size_tcl):
             if self._source.beam_size.x != float(x_beam_size) :
                 self._notes += "Change x of beam size from "
                 self._notes += "%s to %s \n" % (self._source.beam_size.x,
                                                  x_beam_size)
                 self._source.beam_size.x = float(x_beam_size)
         else:
             self._notes += "Error: Expected a float for the beam size 's x "
             self._notes += "won't changes x beam size from "
             self._notes += "%s to %s" % (self._source.beam_size.x,
                                         x_beam_size)
     #Change y coordinate
     y_beam_size = self.y_beam_size_tcl.GetValue().lstrip().rstrip()
     if y_beam_size == "" or y_beam_size == str(None):
         y_beam_size = None
         self._source.beam_size.y = y_beam_size
     else:
         if check_float(self.y_beam_size_tcl):
             if self._source.beam_size.y != float(y_beam_size):
                 self._notes += "Change y of beam size from "
                 self._notes += "%s to %s \n" % (self._source.beam_size.y,
                                                  y_beam_size)
                 self._source.beam_size.y = float(y_beam_size)
         else:
             self._notes += "Error: Expected a float for the beam size's y "
             self._notes += "won't changes y beam size from "
             self._notes += "%s to %s" % (self._source.beam_size.y,
                                           y_beam_size)
     #Change z coordinate
     z_beam_size = self.z_beam_size_tcl.GetValue().lstrip().rstrip()
     if z_beam_size == "" or z_beam_size == str(None):
         z_beam_size = None
         self._source.beam_size.z = z_beam_size
     else:
         if check_float(self.z_beam_size_tcl):
             if self._source.beam_size.z != float(z_beam_size):
                 self._notes += "Change z of beam size from "
                 self._notes += "%s to %s \n" % (self._source.beam_size.z,
                                                  z_beam_size)
                 self._source.beam_size.z = float(z_beam_size)
         else:
             self._notes += "Error: Expected a float for the beam size 's z "
             self._notes += "won't changes z beam size from "
             self._notes += "%s to %s" % (self._source.beam_size.z,
                                           z_beam_size)
     #change the beam center unit
     unit = self.beam_size_unit_tcl.GetValue().lstrip().rstrip()
     if self._source.beam_size_unit != unit:
         self._notes += " Change beam size's unit from "
         self._notes += "%s to %s" % (self._source.beam_size_unit, unit)
         self._source.beam_size_unit = unit
示例#2
0
 def on_change_beam_size(self):
     """
         Change beam size
     """
     #Change x coordinate
     x_beam_size = self.x_beam_size_tcl.GetValue().lstrip().rstrip()
     if x_beam_size == "" or x_beam_size == str(None):
         x_beam_size = None
     else:
         if check_float(self.x_beam_size_tcl):
             if self._source.beam_size.x != float(x_beam_size):
                 self._notes += "Change x of beam size from "
                 self._notes += "%s to %s \n" % (self._source.beam_size.x,
                                                 x_beam_size)
                 self._source.beam_size.x = float(x_beam_size)
         else:
             self._notes += "Error: Expected a float for the beam size 's x "
             self._notes += "won't changes x beam size from "
             self._notes += "%s to %s" % (self._source.beam_size.x,
                                          x_beam_size)
     #Change y coordinate
     y_beam_size = self.y_beam_size_tcl.GetValue().lstrip().rstrip()
     if y_beam_size == "" or y_beam_size == str(None):
         y_beam_size = None
         self._source.beam_size.y = y_beam_size
     else:
         if check_float(self.y_beam_size_tcl):
             if self._source.beam_size.y != float(y_beam_size):
                 self._notes += "Change y of beam size from "
                 self._notes += "%s to %s \n" % (self._source.beam_size.y,
                                                 y_beam_size)
                 self._source.beam_size.y = float(y_beam_size)
         else:
             self._notes += "Error: Expected a float for the beam size's y "
             self._notes += "won't changes y beam size from "
             self._notes += "%s to %s" % (self._source.beam_size.y,
                                          y_beam_size)
     #Change z coordinate
     z_beam_size = self.z_beam_size_tcl.GetValue().lstrip().rstrip()
     if z_beam_size == "" or z_beam_size == str(None):
         z_beam_size = None
         self._source.beam_size.z = z_beam_size
     else:
         if check_float(self.z_beam_size_tcl):
             if self._source.beam_size.z != float(z_beam_size):
                 self._notes += "Change z of beam size from "
                 self._notes += "%s to %s \n" % (self._source.beam_size.z,
                                                 z_beam_size)
                 self._source.beam_size.z = float(z_beam_size)
         else:
             self._notes += "Error: Expected a float for the beam size 's z "
             self._notes += "won't changes z beam size from "
             self._notes += "%s to %s" % (self._source.beam_size.z,
                                          z_beam_size)
     #change the beam center unit
     unit = self.beam_size_unit_tcl.GetValue().lstrip().rstrip()
     if self._source.beam_size_unit != unit:
         self._notes += " Change beam size's unit from "
         self._notes += "%s to %s" % (self._source.beam_size_unit, unit)
         self._source.beam_size_unit = unit
示例#3
0
 def on_change_orientation(self):
     """
         Change orientation
     """
     #Change x coordinate
     x_orientation = self.x_orientation_tcl.GetValue().lstrip().rstrip()
     if x_orientation == "" or x_orientation == str(None):
         x_orientation = None
     else:
         if check_float(self.x_orientation_tcl):
             if self._sample.orientation.x != float(x_orientation) :
                 self._notes += "Change x of orientation from "
                 self._notes += "%s to %s \n" % (self._sample.orientation.x,
                                                x_orientation)
                 self._sample.orientation.x = float(x_orientation)
         else:
             self._notes += "Error: Expected a float for orientation 's x "
             self._notes += "won't changes x orientation from "
             self._notes += "%s to %s" % (self._sample.orientation.x,
                                           x_orientation)
     #Change y coordinate
     y_orientation = self.y_orientation_tcl.GetValue().lstrip().rstrip()
     if y_orientation == "" or y_orientation == str(None):
         y_orientation = None
         self._sample.orientation.y = y_orientation
     else:
         if check_float(self.y_orientation_tcl):
             if self._sample.orientation.y != float(y_orientation):
                 self._notes += "Change y of orientation from "
                 self._notes += "%s to %s \n" % (self._sample.orientation.y,
                                                  y_orientation)
                 self._sample.orientation.y = float(y_orientation)
         else:
             self._notes += "Error: Expected a float for orientation's y "
             self._notes += "won't changes y orientation from "
             self._notes += "%s to %s" % (self._sample.orientation.y,
                                         y_orientation)
     #Change z coordinate
     z_orientation = self.z_orientation_tcl.GetValue().lstrip().rstrip()
     if z_orientation == "" or z_orientation == str(None):
         z_orientation = None
         self._sample.orientation.z = z_orientation
     else:
         if check_float(self.z_orientation_tcl):
             if self._sample.orientation.z != float(z_orientation):
                 self._notes += "Change z of orientation from "
                 self._notes += "%s to %s \n" % (self._sample.orientation.z,
                                                  z_orientation)
                 self._sample.orientation.z = float(z_orientation)
         else:
             self._notes += "Error: Expected a float for orientation 's x "
             self._notes += "won't changes z orientation from "
             self._notes += "%s to %s" % (self._sample.orientation.z,
                                           z_orientation)
     #change the beam center unit
     unit = self.orientation_unit_tcl.GetValue().lstrip().rstrip()
     if self._sample.orientation_unit != unit:
         self._notes += " Change orientation's unit from "
         self._notes += "%s to %s" % (self._sample.orientation_unit, unit)
示例#4
0
 def on_change_size(self):
     """
     Change aperture size
     """
     #Change x coordinate
     x_aperture_size = self.x_aperture_size_tcl.GetValue().lstrip().rstrip()
     if x_aperture_size == "" or x_aperture_size == str(None):
         x_aperture_size = None
     else:
         if check_float(self.x_aperture_size_tcl):
             if self._aperture.size.x != float(x_aperture_size):
                 self._notes += "Change x of aperture size from "
                 self._notes += "%s to %s \n" % (self._aperture.size.x, x_aperture_size)
                 self._aperture.aperture_size.x = float(x_aperture_size)
         else:
             self._notes += "Error: Expected a"
             self._notes += " float for the aperture size 's x "
             self._notes += "won't changes x aperture size from "
             self._notes += "%s to %s" % (self._aperture.size.x, x_aperture_size)
     #Change y coordinate
     y_aperture_size = self.y_aperture_size_tcl.GetValue().lstrip().rstrip()
     if y_aperture_size == "" or y_aperture_size == str(None):
         y_aperture_size = None
         self._aperture.size.y = y_aperture_size
     else:
         if check_float(self.y_aperture_size_tcl):
             if self._aperture.size.y != float(y_aperture_size):
                 self._notes += "Change y of aperture size from "
                 self._notes += "%s to %s \n" % (self._aperture.size.y, y_aperture_size)
                 self._aperture.size.y = float(y_aperture_size)
         else:
             self._notes += "Error: Expected a float for the"
             self._notes += " aperture size's y "
             self._notes += "won't changes y aperture size from "
             self._notes += "%s to %s" % (self._aperture.size.y, y_aperture_size)
     #Change z coordinate
     z_aperture_size = self.z_aperture_size_tcl.GetValue().lstrip().rstrip()
     if z_aperture_size == "" or z_aperture_size == str(None):
         z_aperture_size = None
         self._aperture.size.z = z_aperture_size
     else:
         if check_float(self.z_aperture_size_tcl):
             if self._aperture.size.z != float(z_aperture_size):
                 self._notes += "Change z of aperture size from "
                 self._notes += "%s to %s \n" % (self._aperture.size.z, z_aperture_size)
                 self._aperture.size.z = float(z_aperture_size)
         else:
             self._notes += "Error: Expected a float for the offset 's x "
             self._notes += "won't changes z aperture size from "
             self._notes += "%s to %s" % (self._aperture.size.z, z_aperture_size)
     #change the aperture center unit
     unit = self.aperture_size_unit_tcl.GetValue().lstrip().rstrip()
     if self._aperture.size_unit != unit:
         self._notes += " Change aperture size's unit from "
         self._notes += "%s to %s" % (self._aperture.size_unit, unit)
         self._aperture.size_unit = unit
示例#5
0
    def on_change_distance(self):
        """
            Change distance of the sample to the detector
        """
        detector, _, position = self.get_current_detector()
        if detector is None:
            return
        #Change the distance
        distance = self.distance_tcl.GetValue().lstrip().rstrip()
        if distance == "" or distance == str(None):
            distance = None
            detector.distance = distance
        else:
            if check_float(self.distance_tcl):
                if detector.distance != float(distance):
                    self._notes += " Change Distance from"
                    self._notes += " %s to %s \n" % (detector.distance,
                                                     distance)
                    detector.distance = float(distance)
            else:
                self._notes += "Error: Expected a float for "
                self._notes += " the distance won't changes "
                self._notes += "%s to %s" % (detector.distance, distance)
        #change the distance unit
        unit = self.distance_unit_tcl.GetValue().lstrip().rstrip()
        if detector.distance_unit != unit:
            self._notes += " Change distance's unit from "
            self._notes += "%s to %s" % (detector.distance_unit, unit)

        self.detector_cbox.SetString(position, str(detector.name))
        self.detector_cbox.SetClientData(position, detector)
        self.detector_cbox.SetStringSelection(str(detector.name))
示例#6
0
    def on_change_slit_length(self):
        """
            Change slit length of the detector
        """
        detector, _, position = self.get_current_detector()
        if detector is None:
            return
        #Change the distance
        slit_length = self.slit_length_tcl.GetValue().lstrip().rstrip()
        if slit_length == "" or slit_length == str(None):
            slit_length = None
            detector.slit_length = slit_length
        else:
            if check_float(self.slit_length_tcl):
                if detector.slit_length != float(slit_length):
                    self._notes += " Change slit length from"
                    self._notes += " %s to %s \n" % (detector.slit_length,
                                                    slit_length)
                    detector.slit_length = float(slit_length)
            else:
                self._notes += "Error: Expected a float"
                self._notes += " for the slit length won't changes "
                self._notes += "%s to %s" % (detector.slit_length, slit_length)
        #change the distance unit
        unit = self.slit_length_unit_tcl.GetValue().lstrip().rstrip()
        if detector.slit_length_unit != unit:
            self._notes += " Change slit length's unit from "
            self._notes += "%s to %s" % (detector.slit_length_unit_tcl, unit)

        self.detector_cbox.SetString(position, str(detector.name))
        self.detector_cbox.SetClientData(position, detector)
        self.detector_cbox.SetStringSelection(str(detector.name))
示例#7
0
    def check_inputs(self):
        """
        Check validity user inputs
        """
        flag = True
        msg = ""
        if check_float(self.input_ctl):
            self.input = float(self.input_ctl.GetValue())
        else:
            flag = False
            input_type = str(self.input_cb.GetValue())
            msg += "Error for %s value :expect float" % input_type

        self.compound = self.compound_ctl.GetValue().lstrip().rstrip()
        if self.compound != "":
            try:
                Formula(self.compound)
                self.compound_ctl.SetBackgroundColour(wx.WHITE)
                self.compound_ctl.Refresh()
            except:
                self.compound_ctl.SetBackgroundColour("pink")
                self.compound_ctl.Refresh()
                flag = False
                msg += "Enter correct formula"
        else:
            self.compound_ctl.SetBackgroundColour("pink")
            self.compound_ctl.Refresh()
            flag = False
            msg += "Enter Formula"
        return flag, msg
示例#8
0
    def on_change_distance(self):
        """
            Change distance of the sample to the detector
        """
        detector, _, position = self.get_current_detector()
        if detector is None:
            return
        #Change the distance
        distance = self.distance_tcl.GetValue().lstrip().rstrip()
        if distance == "" or distance == str(None):
            distance = None
            detector.distance = distance
        else:
            if check_float(self.distance_tcl):
                if detector.distance != float(distance):
                    self._notes += " Change Distance from"
                    self._notes += " %s to %s \n" % (detector.distance, distance)
                    detector.distance = float(distance)
            else:
                self._notes += "Error: Expected a float for "
                self._notes += " the distance won't changes "
                self._notes += "%s to %s" % (detector.distance, distance)
        #change the distance unit
        unit = self.distance_unit_tcl.GetValue().lstrip().rstrip()
        if detector.distance_unit != unit:
            self._notes += " Change distance's unit from "
            self._notes += "%s to %s" % (detector.distance_unit, unit)

        self.detector_cbox.SetString(position, str(detector.name))
        self.detector_cbox.SetClientData(position, detector)
        self.detector_cbox.SetStringSelection(str(detector.name))
示例#9
0
 def on_change_distance(self):
     """
     Change distance of the aperture
     """
     #Change distance
     distance = self.distance_tcl.GetValue().lstrip().rstrip()
     if distance == "" or distance == str(None):
         distance = None
         self._aperture.distance = distance
     else:
         if check_float(self.distance_tcl):
             if self._aperture.distance != float(distance):
                 self._notes += "Change distance from "
                 self._notes += "%s to %s \n" % (self._aperture.distance,
                                                 distance)
                 self._aperture.distance = float(distance)
         else:
             self._notes += "Error: Expected a float for distance  "
             self._notes += "won't changes distance from "
             self._notes += "%s to %s" % (self._aperture.distance, distance)
     #change the distance unit
     unit = self.distance_unit_tcl.GetValue().lstrip().rstrip()
     if self._aperture.distance_unit != unit:
         self._notes += " Change distance 's unit from "
         self._notes += "%s to %s" % (self._aperture.distance_unit, unit)
示例#10
0
 def on_change_length(self):
     """
     Change the length
     """
     collimation, collimation_name, position = self.get_current_collimation()
     if collimation is None:
         return
     #Change length  
     length = self.length_tcl.GetValue().lstrip().rstrip()
     if length == "" or length == str(None):
         length = None
         collimation.length = length
     else:
         if check_float(self.length_tcl):
             if collimation.length != float(length):
                 self._notes += "Change Collimation length from "
                 self._notes += "%s to %s \n" % (collimation.length, length)
                 collimation.length = float(length)
         else:
             self._notes += "Error: Expected a float for collimation length"
             self._notes += " won't changes length from "
             self._notes += "%s to %s" % (collimation.length, length)
     #change length  unit
     unit = self.length_unit_tcl.GetValue().lstrip().rstrip()
     if collimation.length_unit != unit:
         self._notes += " Change length's unit from "
         self._notes += "%s to %s" % (collimation.length_unit, unit)
         collimation.length_unit = unit
示例#11
0
 def on_change_length(self):
     """
     Change the length
     """
     collimation, collimation_name, position = self.get_current_collimation(
     )
     if collimation is None:
         return
     #Change length
     length = self.length_tcl.GetValue().lstrip().rstrip()
     if length == "" or length == str(None):
         length = None
         collimation.length = length
     else:
         if check_float(self.length_tcl):
             if collimation.length != float(length):
                 self._notes += "Change Collimation length from "
                 self._notes += "%s to %s \n" % (collimation.length, length)
                 collimation.length = float(length)
         else:
             self._notes += "Error: Expected a float for collimation length"
             self._notes += " won't changes length from "
             self._notes += "%s to %s" % (collimation.length, length)
     #change length  unit
     unit = self.length_unit_tcl.GetValue().lstrip().rstrip()
     if collimation.length_unit != unit:
         self._notes += " Change length's unit from "
         self._notes += "%s to %s" % (collimation.length_unit, unit)
         collimation.length_unit = unit
示例#12
0
    def check_inputs(self):
        """
        Check validity user inputs
        """
        flag = True
        msg = ""
        if check_float(self.input_ctl):
            self.input = float(self.input_ctl.GetValue())
        else:
            flag = False
            input_type = str(self.input_cb.GetValue())
            msg += "Error for %s value :expect float" % input_type

        self.compound = self.compound_ctl.GetValue().lstrip().rstrip()
        if self.compound != "":
            try:
                Formula(self.compound)
                self.compound_ctl.SetBackgroundColour(wx.WHITE)
                self.compound_ctl.Refresh()
            except:
                self.compound_ctl.SetBackgroundColour("pink")
                self.compound_ctl.Refresh()
                flag = False
                msg += "Enter correct formula"
        else:
            self.compound_ctl.SetBackgroundColour("pink")
            self.compound_ctl.Refresh()
            flag = False
            msg += "Enter Formula"
        return flag, msg
示例#13
0
    def on_change_slit_length(self):
        """
            Change slit length of the detector
        """
        detector, _, position = self.get_current_detector()
        if detector is None:
            return
        #Change the distance
        slit_length = self.slit_length_tcl.GetValue().lstrip().rstrip()
        if slit_length == "" or slit_length == str(None):
            slit_length = None
            detector.slit_length = slit_length
        else:
            if check_float(self.slit_length_tcl):
                if detector.slit_length != float(slit_length):
                    self._notes += " Change slit length from"
                    self._notes += " %s to %s \n" % (detector.slit_length,
                                                     slit_length)
                    detector.slit_length = float(slit_length)
            else:
                self._notes += "Error: Expected a float"
                self._notes += " for the slit length won't changes "
                self._notes += "%s to %s" % (detector.slit_length, slit_length)
        #change the distance unit
        unit = self.slit_length_unit_tcl.GetValue().lstrip().rstrip()
        if detector.slit_length_unit != unit:
            self._notes += " Change slit length's unit from "
            self._notes += "%s to %s" % (detector.slit_length_unit_tcl, unit)

        self.detector_cbox.SetString(position, str(detector.name))
        self.detector_cbox.SetClientData(position, detector)
        self.detector_cbox.SetStringSelection(str(detector.name))
示例#14
0
    def check_inputs(self):
        """Check validity user inputs"""
        flag = True
        msg = ""
        if check_float(self.density_ctl):
            self.density = float(self.density_ctl.GetValue())
        else:
            flag = False
            msg += "Error for Density value :expect float"

        self.wavelength = self.wavelength_ctl.GetValue()
        if str(self.wavelength).lstrip().rstrip() == "":
            self.wavelength = WAVELENGTH
            self.wavelength_ctl.SetValue(str(WAVELENGTH))
            self.wavelength_ctl.SetBackgroundColour(wx.WHITE)
            self.wavelength_ctl.Refresh()
            msg += "Default value for wavelength is 6.0"
        else:
            if check_float(self.wavelength_ctl):
                self.wavelength = float(self.wavelength)
            else:
                flag = False
                msg += "Error for wavelength value :expect float"

        self.compound = self.compound_ctl.GetValue().lstrip().rstrip()
        if self.compound != "":
            try:
                formula(self.compound)
                self.compound_ctl.SetBackgroundColour(wx.WHITE)
                self.compound_ctl.Refresh()
            except:
                self.compound_ctl.SetBackgroundColour("pink")
                self.compound_ctl.Refresh()
                flag = False
                msg += "Enter correct formula"
        else:
            self.compound_ctl.SetBackgroundColour("pink")
            self.compound_ctl.Refresh()
            flag = False
            msg += "Enter a formula"
        return flag, msg
示例#15
0
    def check_inputs(self):
        """Check validity user inputs"""
        flag = True
        msg = ""
        if check_float(self.density_ctl):
            self.density = float(self.density_ctl.GetValue())
        else:
            flag = False
            msg += "Error for Density value :expect float"

        self.wavelength = self.wavelength_ctl.GetValue()
        if str(self.wavelength).lstrip().rstrip() == "":
            self.wavelength = WAVELENGTH
            self.wavelength_ctl.SetValue(str(WAVELENGTH))
            self.wavelength_ctl.SetBackgroundColour(wx.WHITE)
            self.wavelength_ctl.Refresh()
            msg += "Default value for wavelength is 6.0"
        else:
            if check_float(self.wavelength_ctl):
                self.wavelength = float(self.wavelength)
            else:
                flag = False
                msg += "Error for wavelength value :expect float"

        self.compound = self.compound_ctl.GetValue().lstrip().rstrip()
        if self.compound != "":
            try :
                formula(self.compound)
                self.compound_ctl.SetBackgroundColour(wx.WHITE)
                self.compound_ctl.Refresh()
            except:
                self.compound_ctl.SetBackgroundColour("pink")
                self.compound_ctl.Refresh()
                flag = False
                msg += "Enter correct formula"
        else:
            self.compound_ctl.SetBackgroundColour("pink")
            self.compound_ctl.Refresh()
            flag = False
            msg += "Enter a formula"
        return flag, msg
示例#16
0
 def on_change_distance(self):
     """
     Change distance of the aperture
     """
     #Change distance
     distance = self.distance_tcl.GetValue().lstrip().rstrip()
     if distance == "" or distance == str(None):
         distance = None
         self._aperture.distance = distance
     else:
         if check_float(self.distance_tcl):
             if self._aperture.distance != float(distance):
                 self._notes += "Change distance from "
                 self._notes += "%s to %s \n" % (self._aperture.distance, distance)
                 self._aperture.distance = float(distance)
         else:
             self._notes += "Error: Expected a float for distance  "
             self._notes += "won't changes distance from "
             self._notes += "%s to %s" % (self._aperture.distance, distance)
     #change the distance unit
     unit = self.distance_unit_tcl.GetValue().lstrip().rstrip()
     if self._aperture.distance_unit != unit:
         self._notes += " Change distance 's unit from "
         self._notes += "%s to %s" % (self._aperture.distance_unit, unit)
示例#17
0
    def on_change_beam_center(self):
        """
            Change the detector beam center
        """

        detector, _, position = self.get_current_detector()
        if detector is None:
            return
        #Change x coordinate
        x_beam_center = self.x_beam_center_tcl.GetValue().lstrip().rstrip()
        if x_beam_center == "" or x_beam_center == str(None):
            x_beam_center = None
            detector.beam_center.x = x_beam_center
        else:
            if check_float(self.x_beam_center_tcl):
                if detector.beam_center.x != float(x_beam_center):
                    self._notes += "Change x of offset from "
                    self._notes += "%s to %s \n" % (detector.beam_center.x,
                                                     x_beam_center)
                    detector.beam_center.x = float(x_beam_center)
            else:
                self._notes += "Error: Expected a float for the beam "
                self._notes += "center 's x won't changes x beam center from "
                self._notes += "%s to %s" % (detector.beam_center.x,
                                            x_beam_center)
        #Change y coordinate
        y_beam_center = self.y_beam_center_tcl.GetValue().lstrip().rstrip()
        if y_beam_center == "" or y_beam_center == str(None):
            y_beam_center = None
            detector.beam_center.y = y_beam_center
        else:
            if check_float(self.y_beam_center_tcl):
                if detector.beam_center.y != float(y_beam_center):
                    self._notes += "Change y of beam center from "
                    self._notes += "%s to %s \n" % (detector.beam_center.y,
                                                     y_beam_center)
                    detector.beam_center.y = float(y_beam_center)
            else:
                self._notes += "Error: Expected a float for the beam "
                self._notes += "center 's y won't changes y beam center from "
                self._notes += "%s to %s" % (detector.beam_center.y,
                                              y_beam_center)
        #Change z coordinate
        z_beam_center = self.z_beam_center_tcl.GetValue().lstrip().rstrip()
        if z_beam_center == "" or z_beam_center == str(None):
            z_beam_center = None
            detector.beam_center.z = z_beam_center
        else:
            if check_float(self.z_beam_center_tcl):
                if detector.beam_center.z != float(z_beam_center):
                    self._notes += "Change z of beam center from "
                    self._notes += "%s to %s \n" % (detector.beam_center.z,
                                                     z_beam_center)
                    detector.beam_center.z = float(z_beam_center)
            else:
                self._notes += "Error: Expected a float for the offset 's x "
                self._notes += "won't changes z beam center from "
                self._notes += "%s to %s" % (detector.beam_center.z,
                                            z_beam_center)
        #change the beam center unit
        unit = self.beam_center_unit_tcl.GetValue().lstrip().rstrip()
        if detector.beam_center_unit != unit:
            self._notes += " Change beam center's unit from "
            self._notes += "%s to %s" % (detector.beam_center_unit, unit)

        self.detector_cbox.SetString(position, str(detector.name))
        self.detector_cbox.SetClientData(position, detector)
        self.detector_cbox.SetStringSelection(str(detector.name))
示例#18
0
    def on_change_pixel_size(self):
        """
            Change the detector pixel size
        """
        detector, _, position = self.get_current_detector()
        if detector is None:
            return
        #Change x coordinate
        x_pixel_size = self.x_pixel_size_tcl.GetValue().lstrip().rstrip()
        if x_pixel_size == "" or x_pixel_size == str(None):
            x_pixel_size = None
        else:
            if check_float(self.x_pixel_size_tcl):
                if detector.pixel_size.x != float(x_pixel_size) :
                    self._notes += "Change x of pixel size from "
                    self._notes += "%s to %s \n" % (detector.pixel_size.x,
                                                   x_pixel_size)
                    detector.pixel_size.x = float(x_pixel_size)
            else:
                self._notes += "Error: Expected a float for the pixel"
                self._notes += " size 's x  won't changes x pixel size from "
                self._notes += "%s to %s" % (detector.pixel_size.x,
                                             x_pixel_size)
        #Change y coordinate
        y_pixel_size = self.y_pixel_size_tcl.GetValue().lstrip().rstrip()
        if y_pixel_size == "" or y_pixel_size == str(None):
            y_pixel_size = None
            detector.pixel_size.y = y_pixel_size
        else:
            if check_float(self.y_pixel_size_tcl):
                if detector.pixel_size.y != float(y_pixel_size):
                    self._notes += "Change y of pixel size from "
                    self._notes += "%s to %s \n" % (detector.pixel_size.y,
                                                   y_pixel_size)
                    detector.pixel_size.y = float(y_pixel_size)
            else:
                self._notes += "Error: Expected a float for the pixel "
                self._notes += "size's y  won't changes y pixel size from "
                self._notes += "%s to %s" % (detector.pixel_size.y,
                                              y_pixel_size)
        #Change z coordinate
        z_pixel_size = self.z_pixel_size_tcl.GetValue().lstrip().rstrip()
        if z_pixel_size == "" or z_pixel_size == str(None):
            z_pixel_size = None
            detector.pixel_size.z = z_pixel_size
        else:
            if check_float(self.z_pixel_size_tcl):
                if detector.pixel_size.z != float(z_pixel_size):
                    self._notes += "Change z of pixel size from "
                    self._notes += "%s to %s \n" % (detector.pixel_size.z,
                                                   z_pixel_size)
                    detector.pixel_size.z = float(z_pixel_size)
            else:
                self._notes += "Error: Expected a float for the offset 's x "
                self._notes += "won't changes z pixel size from "
                self._notes += "%s to %s" % (detector.pixel_size.z, z_pixel_size)
        #change the beam center unit
        unit = self.pixel_size_unit_tcl.GetValue().lstrip().rstrip()
        if detector.pixel_size_unit != unit:
            self._notes += " Change pixel size's unit from "
            self._notes += "%s to %s" % (detector.pixel_size_unit, unit)

        self.detector_cbox.SetString(position, str(detector.name))
        self.detector_cbox.SetClientData(position, detector)
        self.detector_cbox.SetStringSelection(str(detector.name))
示例#19
0
 def on_change_size(self):
     """
     Change aperture size
     """
     #Change x coordinate
     x_aperture_size = self.x_aperture_size_tcl.GetValue().lstrip().rstrip()
     if x_aperture_size == "" or x_aperture_size == str(None):
         x_aperture_size = None
     else:
         if check_float(self.x_aperture_size_tcl):
             if self._aperture.size.x != float(x_aperture_size):
                 self._notes += "Change x of aperture size from "
                 self._notes += "%s to %s \n" % (self._aperture.size.x,
                                                 x_aperture_size)
                 self._aperture.aperture_size.x = float(x_aperture_size)
         else:
             self._notes += "Error: Expected a"
             self._notes += " float for the aperture size 's x "
             self._notes += "won't changes x aperture size from "
             self._notes += "%s to %s" % (self._aperture.size.x,
                                          x_aperture_size)
     #Change y coordinate
     y_aperture_size = self.y_aperture_size_tcl.GetValue().lstrip().rstrip()
     if y_aperture_size == "" or y_aperture_size == str(None):
         y_aperture_size = None
         self._aperture.size.y = y_aperture_size
     else:
         if check_float(self.y_aperture_size_tcl):
             if self._aperture.size.y != float(y_aperture_size):
                 self._notes += "Change y of aperture size from "
                 self._notes += "%s to %s \n" % (self._aperture.size.y,
                                                 y_aperture_size)
                 self._aperture.size.y = float(y_aperture_size)
         else:
             self._notes += "Error: Expected a float for the"
             self._notes += " aperture size's y "
             self._notes += "won't changes y aperture size from "
             self._notes += "%s to %s" % (self._aperture.size.y,
                                          y_aperture_size)
     #Change z coordinate
     z_aperture_size = self.z_aperture_size_tcl.GetValue().lstrip().rstrip()
     if z_aperture_size == "" or z_aperture_size == str(None):
         z_aperture_size = None
         self._aperture.size.z = z_aperture_size
     else:
         if check_float(self.z_aperture_size_tcl):
             if self._aperture.size.z != float(z_aperture_size):
                 self._notes += "Change z of aperture size from "
                 self._notes += "%s to %s \n" % (self._aperture.size.z,
                                                 z_aperture_size)
                 self._aperture.size.z = float(z_aperture_size)
         else:
             self._notes += "Error: Expected a float for the offset 's x "
             self._notes += "won't changes z aperture size from "
             self._notes += "%s to %s" % (self._aperture.size.z,
                                          z_aperture_size)
     #change the aperture center unit
     unit = self.aperture_size_unit_tcl.GetValue().lstrip().rstrip()
     if self._aperture.size_unit != unit:
         self._notes += " Change aperture size's unit from "
         self._notes += "%s to %s" % (self._aperture.size_unit, unit)
         self._aperture.size_unit = unit
示例#20
0
    def on_change_orientation(self):
        """
            Change the detector orientation
        """
        detector, _, position = self.get_current_detector()
        if detector is None:
            return
        #Change x coordinate
        x_orientation = self.x_orientation_tcl.GetValue().lstrip().rstrip()
        if x_orientation == "" or x_orientation == str(None):
            x_orientation = None
            detector.orientation.x = x_orientation
        else:
            if check_float(self.x_orientation_tcl):
                if detector.orientation.x != float(x_orientation):
                    self._notes += "Change x of orientation from "
                    self._notes += "%s to %s \n" % (detector.orientation.x,
                                                    x_orientation)
                    detector.orientation.x = float(x_orientation)
            else:
                self._notes += "Error: Expected a float for the orientation "
                self._notes += "'s x  won't changes x orientation from "
                self._notes += "%s to %s" % (detector.orientation.x,
                                             x_orientation)
        #Change y coordinate
        y_orientation = self.y_orientation_tcl.GetValue().lstrip().rstrip()
        if y_orientation == "" or y_orientation == str(None):
            y_orientation = None
            detector.orientation.y = y_orientation
        else:
            if check_float(self.y_orientation_tcl):
                if detector.orientation.y != float(y_orientation):
                    self._notes += "Change y of orientation from "
                    self._notes += "%s to %s \n" % (detector.orientation.y,
                                                    y_orientation)
                    detector.orientation.y = float(y_orientation)
            else:
                self._notes += "Error: Expected a float for the orientation's "
                self._notes += " y won't changes y orientation from "
                self._notes += "%s to %s" % (detector.orientation.y,
                                             y_orientation)
        #Change z coordinate
        z_orientation = self.z_orientation_tcl.GetValue().lstrip().rstrip()
        if z_orientation == "" or z_orientation == str(None):
            z_orientation = None
            detector.orientation.z = z_orientation
        else:
            if check_float(self.z_orientation_tcl):
                if detector.orientation.z != float(z_orientation):
                    self._notes += "Change z of offset from "
                    self._notes += "%s to %s \n" % (detector.orientation.z,
                                                    z_orientation)
                    detector.orientation.z = float(z_orientation)
            else:
                self._notes += "Error: Expected a float for the orientation 's"
                self._notes += " x won't changes z orientation from "
                self._notes += "%s to %s" % (detector.orientation.z,
                                             z_orientation)
        #change the orientation unit
        unit = self.orientation_unit_tcl.GetValue().lstrip().rstrip()
        if detector.orientation_unit != unit:
            self._notes += " Change orientation's unit from "
            self._notes += "%s to %s" % (detector.orientation_unit, unit)

        self.detector_cbox.SetString(position, str(detector.name))
        self.detector_cbox.SetClientData(position, detector)
        self.detector_cbox.SetStringSelection(str(detector.name))
示例#21
0
    def on_change_orientation(self):
        """
            Change the detector orientation
        """
        detector, _, position = self.get_current_detector()
        if detector is None:
            return
        #Change x coordinate
        x_orientation = self.x_orientation_tcl.GetValue().lstrip().rstrip()
        if x_orientation == "" or x_orientation == str(None):
            x_orientation = None
            detector.orientation.x = x_orientation
        else:
            if check_float(self.x_orientation_tcl):
                if detector.orientation.x != float(x_orientation):
                    self._notes += "Change x of orientation from "
                    self._notes += "%s to %s \n" % (detector.orientation.x,
                                                   x_orientation)
                    detector.orientation.x = float(x_orientation)
            else:
                self._notes += "Error: Expected a float for the orientation "
                self._notes += "'s x  won't changes x orientation from "
                self._notes += "%s to %s" % (detector.orientation.x,
                                              x_orientation)
        #Change y coordinate
        y_orientation = self.y_orientation_tcl.GetValue().lstrip().rstrip()
        if y_orientation == "" or y_orientation == str(None):
            y_orientation = None
            detector.orientation.y = y_orientation
        else:
            if check_float(self.y_orientation_tcl):
                if detector.orientation.y != float(y_orientation):
                    self._notes += "Change y of orientation from "
                    self._notes += "%s to %s \n" % (detector.orientation.y,
                                                     y_orientation)
                    detector.orientation.y = float(y_orientation)
            else:
                self._notes += "Error: Expected a float for the orientation's "
                self._notes += " y won't changes y orientation from "
                self._notes += "%s to %s" % (detector.orientation.y,
                                            y_orientation)
        #Change z coordinate
        z_orientation = self.z_orientation_tcl.GetValue().lstrip().rstrip()
        if z_orientation == "" or z_orientation == str(None):
            z_orientation = None
            detector.orientation.z = z_orientation
        else:
            if check_float(self.z_orientation_tcl):
                if detector.orientation.z != float(z_orientation):
                    self._notes += "Change z of offset from "
                    self._notes += "%s to %s \n" % (detector.orientation.z,
                                                   z_orientation)
                    detector.orientation.z = float(z_orientation)
            else:
                self._notes += "Error: Expected a float for the orientation 's"
                self._notes += " x won't changes z orientation from "
                self._notes += "%s to %s" % (detector.orientation.z,
                                              z_orientation)
        #change the orientation unit
        unit = self.orientation_unit_tcl.GetValue().lstrip().rstrip()
        if detector.orientation_unit != unit:
            self._notes += " Change orientation's unit from "
            self._notes += "%s to %s" % (detector.orientation_unit, unit)

        self.detector_cbox.SetString(position, str(detector.name))
        self.detector_cbox.SetClientData(position, detector)
        self.detector_cbox.SetStringSelection(str(detector.name))
示例#22
0
    def on_change_pixel_size(self):
        """
            Change the detector pixel size
        """
        detector, _, position = self.get_current_detector()
        if detector is None:
            return
        #Change x coordinate
        x_pixel_size = self.x_pixel_size_tcl.GetValue().lstrip().rstrip()
        if x_pixel_size == "" or x_pixel_size == str(None):
            x_pixel_size = None
        else:
            if check_float(self.x_pixel_size_tcl):
                if detector.pixel_size.x != float(x_pixel_size):
                    self._notes += "Change x of pixel size from "
                    self._notes += "%s to %s \n" % (detector.pixel_size.x,
                                                    x_pixel_size)
                    detector.pixel_size.x = float(x_pixel_size)
            else:
                self._notes += "Error: Expected a float for the pixel"
                self._notes += " size 's x  won't changes x pixel size from "
                self._notes += "%s to %s" % (detector.pixel_size.x,
                                             x_pixel_size)
        #Change y coordinate
        y_pixel_size = self.y_pixel_size_tcl.GetValue().lstrip().rstrip()
        if y_pixel_size == "" or y_pixel_size == str(None):
            y_pixel_size = None
            detector.pixel_size.y = y_pixel_size
        else:
            if check_float(self.y_pixel_size_tcl):
                if detector.pixel_size.y != float(y_pixel_size):
                    self._notes += "Change y of pixel size from "
                    self._notes += "%s to %s \n" % (detector.pixel_size.y,
                                                    y_pixel_size)
                    detector.pixel_size.y = float(y_pixel_size)
            else:
                self._notes += "Error: Expected a float for the pixel "
                self._notes += "size's y  won't changes y pixel size from "
                self._notes += "%s to %s" % (detector.pixel_size.y,
                                             y_pixel_size)
        #Change z coordinate
        z_pixel_size = self.z_pixel_size_tcl.GetValue().lstrip().rstrip()
        if z_pixel_size == "" or z_pixel_size == str(None):
            z_pixel_size = None
            detector.pixel_size.z = z_pixel_size
        else:
            if check_float(self.z_pixel_size_tcl):
                if detector.pixel_size.z != float(z_pixel_size):
                    self._notes += "Change z of pixel size from "
                    self._notes += "%s to %s \n" % (detector.pixel_size.z,
                                                    z_pixel_size)
                    detector.pixel_size.z = float(z_pixel_size)
            else:
                self._notes += "Error: Expected a float for the offset 's x "
                self._notes += "won't changes z pixel size from "
                self._notes += "%s to %s" % (detector.pixel_size.z,
                                             z_pixel_size)
        #change the beam center unit
        unit = self.pixel_size_unit_tcl.GetValue().lstrip().rstrip()
        if detector.pixel_size_unit != unit:
            self._notes += " Change pixel size's unit from "
            self._notes += "%s to %s" % (detector.pixel_size_unit, unit)

        self.detector_cbox.SetString(position, str(detector.name))
        self.detector_cbox.SetClientData(position, detector)
        self.detector_cbox.SetStringSelection(str(detector.name))
示例#23
0
    def on_change_beam_center(self):
        """
            Change the detector beam center
        """

        detector, _, position = self.get_current_detector()
        if detector is None:
            return
        #Change x coordinate
        x_beam_center = self.x_beam_center_tcl.GetValue().lstrip().rstrip()
        if x_beam_center == "" or x_beam_center == str(None):
            x_beam_center = None
            detector.beam_center.x = x_beam_center
        else:
            if check_float(self.x_beam_center_tcl):
                if detector.beam_center.x != float(x_beam_center):
                    self._notes += "Change x of offset from "
                    self._notes += "%s to %s \n" % (detector.beam_center.x,
                                                    x_beam_center)
                    detector.beam_center.x = float(x_beam_center)
            else:
                self._notes += "Error: Expected a float for the beam "
                self._notes += "center 's x won't changes x beam center from "
                self._notes += "%s to %s" % (detector.beam_center.x,
                                             x_beam_center)
        #Change y coordinate
        y_beam_center = self.y_beam_center_tcl.GetValue().lstrip().rstrip()
        if y_beam_center == "" or y_beam_center == str(None):
            y_beam_center = None
            detector.beam_center.y = y_beam_center
        else:
            if check_float(self.y_beam_center_tcl):
                if detector.beam_center.y != float(y_beam_center):
                    self._notes += "Change y of beam center from "
                    self._notes += "%s to %s \n" % (detector.beam_center.y,
                                                    y_beam_center)
                    detector.beam_center.y = float(y_beam_center)
            else:
                self._notes += "Error: Expected a float for the beam "
                self._notes += "center 's y won't changes y beam center from "
                self._notes += "%s to %s" % (detector.beam_center.y,
                                             y_beam_center)
        #Change z coordinate
        z_beam_center = self.z_beam_center_tcl.GetValue().lstrip().rstrip()
        if z_beam_center == "" or z_beam_center == str(None):
            z_beam_center = None
            detector.beam_center.z = z_beam_center
        else:
            if check_float(self.z_beam_center_tcl):
                if detector.beam_center.z != float(z_beam_center):
                    self._notes += "Change z of beam center from "
                    self._notes += "%s to %s \n" % (detector.beam_center.z,
                                                    z_beam_center)
                    detector.beam_center.z = float(z_beam_center)
            else:
                self._notes += "Error: Expected a float for the offset 's x "
                self._notes += "won't changes z beam center from "
                self._notes += "%s to %s" % (detector.beam_center.z,
                                             z_beam_center)
        #change the beam center unit
        unit = self.beam_center_unit_tcl.GetValue().lstrip().rstrip()
        if detector.beam_center_unit != unit:
            self._notes += " Change beam center's unit from "
            self._notes += "%s to %s" % (detector.beam_center_unit, unit)

        self.detector_cbox.SetString(position, str(detector.name))
        self.detector_cbox.SetClientData(position, detector)
        self.detector_cbox.SetStringSelection(str(detector.name))