def check_fields(self):
        self.ELECTRONENERGY = congruence.checkStrictlyPositiveNumber(self.ELECTRONENERGY, "Electron Energy")
        if not self.METHOD == 1: self.ELECTRONENERGYSPREAD = congruence.checkPositiveNumber(self.ELECTRONENERGYSPREAD, "Electron Energy Spread")
        self.ELECTRONCURRENT = congruence.checkStrictlyPositiveNumber(self.ELECTRONCURRENT, "Electron Current")
        self.ELECTRONBEAMSIZEH = congruence.checkPositiveNumber(self.ELECTRONBEAMSIZEH, "Electron Beam Size H")
        self.ELECTRONBEAMSIZEV = congruence.checkPositiveNumber(self.ELECTRONBEAMSIZEV, "Electron Beam Size V")
        self.ELECTRONBEAMDIVERGENCEH = congruence.checkNumber(self.ELECTRONBEAMDIVERGENCEH, "Electron Beam Divergence H")
        self.ELECTRONBEAMDIVERGENCEV = congruence.checkNumber(self.ELECTRONBEAMDIVERGENCEV, "Electron Beam Divergence V")

        self.PERIODID = congruence.checkStrictlyPositiveNumber(self.PERIODID, "Period ID")
        self.NPERIODS = congruence.checkStrictlyPositiveNumber(self.NPERIODS, "Number of Periods")
        self.KV = congruence.checkPositiveNumber(self.KV, "Kv")
        self.DISTANCE = congruence.checkStrictlyPositiveNumber(self.DISTANCE, "Distance to slit")

        if self.SETRESONANCE == 0:
            self.GAPH = congruence.checkPositiveNumber(self.GAPH, "Slit gap H")
            self.GAPV = congruence.checkPositiveNumber(self.GAPV, "Slit gap V")
            self.PHOTONENERGYMIN = congruence.checkNumber(self.PHOTONENERGYMIN, "Photon Energy Min")
            self.PHOTONENERGYMAX = congruence.checkNumber(self.PHOTONENERGYMAX, "Photon Energy Max")
            congruence.checkGreaterOrEqualThan(self.PHOTONENERGYPOINTS, 2, "Number of Photon Energy Points", " 2")
        else:
            self.HARMONICNUMBER = congruence.checkStrictlyPositiveNumber(self.HARMONICNUMBER, "Harmonic number")

        self.HSLITPOINTS = congruence.checkStrictlyPositiveNumber(self.HSLITPOINTS, "Number of slit mesh points in H")
        self.VSLITPOINTS = congruence.checkStrictlyPositiveNumber(self.VSLITPOINTS, "Number of slit mesh points in V")

        if  self.METHOD == 1: # URGENT
            congruence.checkLessOrEqualThan(self.HSLITPOINTS, 51, "Number of slit mesh points for URGENT "," 51")
            congruence.checkLessOrEqualThan(self.VSLITPOINTS, 51, "Number of slit mesh points for URGENT "," 51")
Exemple #2
0
    def checkFields(self):

        # FLUX
        congruence.checkStrictlyPositiveNumber(self.spe_photon_energy_min,
                                               "Photon Energy Min")
        congruence.checkStrictlyPositiveNumber(self.spe_photon_energy_max,
                                               "Photon Energy Max")
        congruence.checkGreaterOrEqualThan(self.spe_photon_energy_max,
                                           self.spe_photon_energy_min,
                                           "Photon Energy Max",
                                           "Photon Energy Min")
        congruence.checkStrictlyPositiveNumber(self.spe_photon_energy_points,
                                               "Photon Energy Points")

        congruence.checkStrictlyPositiveNumber(self.spe_h_slit_gap,
                                               "H Slit Gap")
        congruence.checkStrictlyPositiveNumber(self.spe_v_slit_gap,
                                               "V Slit Gap")
        congruence.checkGreaterOrEqualThan(
            self.spe_distance, self.get_minimum_propagation_distance(),
            "Distance", "Minimum Distance out of the Source: " +
            str(self.get_minimum_propagation_distance()))

        congruence.checkStrictlyPositiveNumber(self.spe_relative_precision,
                                               "Relative Precision")
        congruence.checkStrictlyPositiveNumber(
            self.spe_number_of_points_for_trajectory_calculation,
            "Number of points for trajectory calculation")
        congruence.checkPositiveNumber(
            self.spe_sampling_factor_for_adjusting_nx_ny,
            "Sampling Factor for adjusting nx/ny")

        self.checkFluxSpecificFields()
Exemple #3
0
    def check_fields(self):
        self.ELECTRONENERGY = congruence.checkStrictlyPositiveNumber(
            self.ELECTRONENERGY, "Electron Energy")
        self.ELECTRONCURRENT = congruence.checkStrictlyPositiveNumber(
            self.ELECTRONCURRENT, "Electron Current")

        self.PERIODID = congruence.checkStrictlyPositiveNumber(
            self.PERIODID, "Period ID")
        self.NPERIODS = congruence.checkStrictlyPositiveNumber(
            self.NPERIODS, "Number of Periods")
        self.KV = congruence.checkPositiveNumber(self.KV, "Kv")
        self.DISTANCE = congruence.checkStrictlyPositiveNumber(
            self.DISTANCE, "Distance to slit")

        self.PHOTONENERGYMIN = congruence.checkNumber(self.PHOTONENERGYMIN,
                                                      "Photon Energy Min")
        self.PHOTONENERGYMAX = congruence.checkNumber(self.PHOTONENERGYMAX,
                                                      "Photon Energy Max")
        congruence.checkGreaterOrEqualThan(self.PHOTONENERGYPOINTS, 2,
                                           "Number of Photon Energy Points",
                                           " 2")

        self.HSLITPOINTS = congruence.checkStrictlyPositiveNumber(
            self.HSLITPOINTS, "Number of slit mesh points in H")
        self.VSLITPOINTS = congruence.checkStrictlyPositiveNumber(
            self.VSLITPOINTS, "Number of slit mesh points in V")

        self.NTRAJPOINTS = congruence.checkStrictlyPositiveNumber(
            self.NTRAJPOINTS, "Number Trajectory points")

        self.PASSEPARTOUT = congruence.checkStrictlyPositiveNumber(
            self.PASSEPARTOUT, "Passepartout in units of sigma' at Emin")
Exemple #4
0
    def check_fields(self):
        self.ELECTRONENERGY = congruence.checkStrictlyPositiveNumber(
            self.ELECTRONENERGY, "Electron Energy")
        if not self.METHOD == 1:
            self.ELECTRONENERGYSPREAD = congruence.checkPositiveNumber(
                self.ELECTRONENERGYSPREAD, "Electron Energy Spread")
        self.ELECTRONCURRENT = congruence.checkStrictlyPositiveNumber(
            self.ELECTRONCURRENT, "Electron Current")
        self.ELECTRONBEAMSIZEH = congruence.checkPositiveNumber(
            self.ELECTRONBEAMSIZEH, "Electron Beam Size H")
        self.ELECTRONBEAMSIZEV = congruence.checkPositiveNumber(
            self.ELECTRONBEAMSIZEV, "Electron Beam Size V")
        self.ELECTRONBEAMDIVERGENCEH = congruence.checkNumber(
            self.ELECTRONBEAMDIVERGENCEH, "Electron Beam Divergence H")
        self.ELECTRONBEAMDIVERGENCEV = congruence.checkNumber(
            self.ELECTRONBEAMDIVERGENCEV, "Electron Beam Divergence V")

        self.PERIODID = congruence.checkStrictlyPositiveNumber(
            self.PERIODID, "Period ID")
        self.NPERIODS = congruence.checkStrictlyPositiveNumber(
            self.NPERIODS, "Number of Periods")
        self.KV = congruence.checkPositiveNumber(self.KV, "Kv")
        self.KH = congruence.checkPositiveNumber(self.KH, "Kh")
        self.KPHASE = congruence.checkNumber(self.KPHASE, "KPHASE")
        self.DISTANCE = congruence.checkStrictlyPositiveNumber(
            self.DISTANCE, "Distance to slit")

        if self.SETRESONANCE == 0:
            self.GAPH = congruence.checkPositiveNumber(self.GAPH, "Slit gap H")
            self.GAPV = congruence.checkPositiveNumber(self.GAPV, "Slit gap V")
            self.PHOTONENERGYMIN = congruence.checkNumber(
                self.PHOTONENERGYMIN, "Photon Energy Min")
            self.PHOTONENERGYMAX = congruence.checkNumber(
                self.PHOTONENERGYMAX, "Photon Energy Max")
            congruence.checkGreaterOrEqualThan(
                self.PHOTONENERGYPOINTS, 2, "Number of Photon Energy Points",
                " 2")
        else:
            self.HARMONICNUMBER = congruence.checkStrictlyPositiveNumber(
                self.HARMONICNUMBER, "Harmonic number")

        self.HSLITPOINTS = congruence.checkStrictlyPositiveNumber(
            self.HSLITPOINTS, "Number of slit mesh points in H")
        self.VSLITPOINTS = congruence.checkStrictlyPositiveNumber(
            self.VSLITPOINTS, "Number of slit mesh points in V")

        if self.METHOD == 1:  # URGENT
            congruence.checkLessOrEqualThan(
                self.HSLITPOINTS, 51, "Number of slit mesh points for URGENT ",
                " 51")
            congruence.checkLessOrEqualThan(
                self.VSLITPOINTS, 51, "Number of slit mesh points for URGENT ",
                " 51")
Exemple #5
0
 def checkFluxSpecificFields(self):
     if isinstance(self.received_light_source, SRWUndulatorLightSource):
         congruence.checkStrictlyPositiveNumber(
             self.spe_initial_UR_harmonic, "Flux Initial Harmonic")
         congruence.checkStrictlyPositiveNumber(self.spe_final_UR_harmonic,
                                                "Flux Final Harmonic")
         congruence.checkGreaterOrEqualThan(self.spe_final_UR_harmonic,
                                            self.spe_initial_UR_harmonic,
                                            "Flux Final Harmonic",
                                            "Flux Initial Harmonic")
         congruence.checkStrictlyPositiveNumber(
             self.spe_longitudinal_integration_precision_parameter,
             "Flux Longitudinal integration precision parameter")
         congruence.checkStrictlyPositiveNumber(
             self.spe_azimuthal_integration_precision_parameter,
             "Flux Azimuthal integration precision parameter")
Exemple #6
0
    def checkFields(self):
        congruence.checkStrictlyPositiveNumber(self.electron_energy_in_GeV, "Energy")
        congruence.checkPositiveNumber(self.electron_energy_spread, "Energy Spread")
        congruence.checkStrictlyPositiveNumber(self.ring_current, "Ring Current")

        if self.type_of_properties == 0:
            congruence.checkPositiveNumber(self.moment_xx   , "Moment xx")
            congruence.checkPositiveNumber(self.moment_xpxp , "Moment xpxp")
            congruence.checkPositiveNumber(self.moment_yy   , "Moment yy")
            congruence.checkPositiveNumber(self.moment_ypyp , "Moment ypyp")
        elif self.type_of_properties == 1:
            congruence.checkPositiveNumber(self.electron_beam_size_h       , "Horizontal Beam Size")
            congruence.checkPositiveNumber(self.electron_beam_divergence_h , "Vertical Beam Size")
            congruence.checkPositiveNumber(self.electron_beam_size_v       , "Horizontal Beam Divergence")
            congruence.checkPositiveNumber(self.electron_beam_divergence_v , "Vertical Beam Divergence")
        elif self.type_of_properties == 2:
            congruence.checkPositiveNumber(self.horizontal_emittance       , "Horizontal Emittance")
            congruence.checkPositiveNumber(self.vertical_emittance         , "Vertical Emittance")

        self.checkLightSourceSpecificFields()

        if self.type_of_initialization == 2:
            congruence.checkNumber(self.moment_x   , "x0")
            congruence.checkNumber(self.moment_xp , "xp0")
            congruence.checkNumber(self.moment_y   , "y0")
            congruence.checkNumber(self.moment_yp , "yp0")
            congruence.checkNumber(self.moment_z , "z0")


        # WAVEFRONT

        self.checkWavefrontPhotonEnergy()

        congruence.checkStrictlyPositiveNumber(self.wf_h_slit_gap, "Wavefront Propagation H Slit Gap")
        congruence.checkStrictlyPositiveNumber(self.wf_v_slit_gap, "Wavefront Propagation V Slit Gap")
        congruence.checkStrictlyPositiveNumber(self.wf_h_slit_points, "Wavefront Propagation H Slit Points")
        congruence.checkStrictlyPositiveNumber(self.wf_v_slit_points, "Wavefront Propagation V Slit Points")
        congruence.checkGreaterOrEqualThan(self.wf_distance, self.get_minimum_propagation_distance(),
                                           "Wavefront Propagation Distance", "Minimum Distance out of the Source: " + str(self.get_minimum_propagation_distance()))

        congruence.checkStrictlyPositiveNumber(self.wf_relative_precision, "Wavefront Propagation Relative Precision")
        congruence.checkStrictlyPositiveNumber(self.wf_number_of_points_for_trajectory_calculation, "Wavefront Propagation Number of points for trajectory calculation")
        congruence.checkPositiveNumber(self.wf_sampling_factor_for_adjusting_nx_ny, "Wavefront Propagation Sampling Factor for adjusting nx/ny")
Exemple #7
0
    def check_data(self):
        super().check_data()

        congruence.checkStrictlyPositiveNumber(self.tangential_size, "Tangential Size")
        congruence.checkStrictlyPositiveNumber(self.sagittal_size, "Sagittal Size")
        
        if self.has_height_profile:
            congruence.checkFile(self.height_profile_data_file)

        if self.has_reflectivity == 1:
            congruence.checkStrictlyPositiveNumber(self.reflectivity_value, "Reflectivity Value")
        elif self.has_reflectivity == 2:
            congruence.checkFile(self.reflectivity_data_file)

            congruence.checkStrictlyPositiveNumber(self.reflectivity_energies_number, "Number of Energy Values")
            congruence.checkStrictlyPositiveNumber(self.reflectivity_energy_start, "Initial Energy Value")
            congruence.checkStrictlyPositiveNumber(self.reflectivity_energy_end, "Final Energy Value")
            congruence.checkGreaterOrEqualThan(self.reflectivity_energy_end, self.reflectivity_energy_start, "Final Energy Value", "Initial Energy Value")

            congruence.checkStrictlyPositiveNumber(self.reflectivity_angles_number, "Number of Grazing Angle Values")
            congruence.checkStrictlyPositiveNumber(self.reflectivity_angle_start, "Initial Grazing Angle Value")
            congruence.checkStrictlyPositiveNumber(self.reflectivity_angle_end, "Final Grazing Angle Value")
            congruence.checkGreaterOrEqualThan(self.reflectivity_angle_end, self.reflectivity_angle_start, "Final Grazing Angle Value", "Initial Grazing Angle Value")
Exemple #8
0
    def checkFields(self):

        # INTENSITY/POWER

        congruence.checkStrictlyPositiveNumber(self.int_h_slit_gap,
                                               "H Slit Gap")
        congruence.checkStrictlyPositiveNumber(self.int_v_slit_gap,
                                               "V Slit Gap")
        congruence.checkStrictlyPositiveNumber(self.int_h_slit_points,
                                               "H Slit Points")
        congruence.checkStrictlyPositiveNumber(self.int_v_slit_points,
                                               "V Slit Points")
        congruence.checkGreaterOrEqualThan(
            self.int_distance, self.get_minimum_propagation_distance(),
            "Distance", "Minimum Distance out of the Source: " +
            str(self.get_minimum_propagation_distance()))

        congruence.checkStrictlyPositiveNumber(
            self.pow_precision_factor,
            "Intensity/Power Density Power - Precision Factor")
        congruence.checkStrictlyPositiveNumber(
            self.pow_number_of_points_for_trajectory_calculation,
            "Intensity/Power Density Power - Number of points for trajectory calculation"
        )
Exemple #9
0
    def __init__(self, min_value=PARAM_HWMIN, max_value=PARAM_HWMAX):
        congruence.checkGreaterOrEqualThan(max_value, min_value, "Max Value",
                                           "Min Value")

        self.min_value = min_value
        self.max_value = max_value