def checkFields(self): super().checkFields() if self.is_cylinder != 1: raise ValueError("Bender Ellipse must be a cylinder") if self.cylinder_orientation != 0: raise ValueError("Cylinder orientation must be 0") if self.is_infinite == 0: raise ValueError("This OE can't have infinite dimensions") if self.which_length == 1: congruence.checkStrictlyPositiveNumber(self.optimized_length, "Optimized Length") congruence.checkLessOrEqualThan(self.optimized_length, self.dim_y_plus + self.dim_y_minus, "Optimized Length", "Total Length") if self.modified_surface > 0: if not (self.modified_surface == 1 and self.ms_type_of_defect == 2): raise ValueError( "Only Preprocessor generated error profiles are admitted") congruence.checkStrictlyPositiveNumber(self.bender_bin_x, "Bins X") congruence.checkStrictlyPositiveNumber(self.bender_bin_y, "Bins Y") self.output_file_name_full = congruence.checkFileName( self.output_file_name)
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")
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.PHOTONENERGYMIN = congruence.checkNumber(self.PHOTONENERGYMIN, "Photon Energy Min") self.PHOTONENERGYMAX = congruence.checkNumber(self.PHOTONENERGYMAX, "Photon Energy Max") self.PHOTONENERGYPOINTS = congruence.checkStrictlyPositiveNumber(self.PHOTONENERGYPOINTS, "Number of Photon Energy Points") 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.HARMONICNUMBER = congruence.checkStrictlyPositiveNumber(self.HARMONICNUMBER, "Harminic number") self.GAPH = congruence.checkPositiveNumber(self.GAPH, "Slit gap H") self.GAPV = congruence.checkPositiveNumber(self.GAPV, "Slit gap V") 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")
def checkFields(self): self.SYMBOL = ShadowPhysics.checkCompoundName(self.SYMBOL) self.DENSITY = congruence.checkStrictlyPositiveNumber(self.DENSITY, "Density") self.E_MIN = congruence.checkPositiveNumber(self.E_MIN , "Minimum Energy") self.E_MAX = congruence.checkStrictlyPositiveNumber(self.E_MAX , "Maximum Energy") self.E_STEP = congruence.checkStrictlyPositiveNumber(self.E_STEP, "Energy step") congruence.checkLessOrEqualThan(self.E_MIN, self.E_MAX, "Minimum Energy", "Maximum Energy") congruence.checkDir(self.SHADOW_FILE)
def checkFields(self): congruence.checkDir(self.FILE) self.E_MIN = congruence.checkPositiveNumber(self.E_MIN, "Min Energy") self.E_MAX = congruence.checkStrictlyPositiveNumber( self.E_MAX, "Max Energy") congruence.checkLessOrEqualThan(self.E_MIN, self.E_MAX, "Minimum Energy", "Maximum Energy") self.S_MATERIAL = ShadowPhysics.checkCompoundName(self.S_MATERIAL) self.S_DENSITY = congruence.checkStrictlyPositiveNumber( float(self.S_DENSITY), "Density (substrate)") self.E_MATERIAL = ShadowPhysics.checkCompoundName(self.E_MATERIAL) self.E_DENSITY = congruence.checkStrictlyPositiveNumber( float(self.E_DENSITY), "Density (even sublayer)") self.O_MATERIAL = ShadowPhysics.checkCompoundName(self.O_MATERIAL) self.O_DENSITY = congruence.checkStrictlyPositiveNumber( float(self.O_DENSITY), "Density (odd sublayer)") if self.GRADE_DEPTH == 0: self.N_PAIRS = congruence.checkStrictlyPositiveNumber( int(self.N_PAIRS), "Number of bilayers") self.THICKNESS = congruence.checkStrictlyPositiveNumber( float(self.THICKNESS), "bilayer thickness t") self.GAMMA = congruence.checkStrictlyPositiveNumber( float(self.GAMMA), "gamma ratio") self.ROUGHNESS_EVEN = congruence.checkPositiveNumber( float(self.ROUGHNESS_EVEN), "Roughness even layer") self.ROUGHNESS_ODD = congruence.checkPositiveNumber( float(self.ROUGHNESS_ODD), "Roughness odd layer") else: congruence.checkDir(self.FILE_DEPTH) if self.GRADE_SURFACE == 1: congruence.checkDir(self.FILE_SHADOW) congruence.checkDir(self.FILE_THICKNESS) congruence.checkDir(self.FILE_GAMMA) elif self.GRADE_SURFACE == 2: self.AA0 = congruence.checkNumber(float(self.AA0), "zero-order coefficient") self.AA1 = congruence.checkNumber(float(self.AA1), "linear coefficient") self.AA2 = congruence.checkNumber(float(self.AA2), "2nd degree coefficient") self.AA3 = congruence.checkNumber(float(self.AA3), "3rd degree coefficient")
def checkFields(self): self.r_a = congruence.checkPositiveNumber(self.r_a, "Distance Source-Grating") self.r_b = congruence.checkPositiveNumber( self.r_b, "Distance Grating-Exit Slits") self.last_element_distance = congruence.checkPositiveNumber( self.last_element_distance, "Distance Source-Last Image Plane before Mirror") congruence.checkLessOrEqualThan( self.last_element_distance, self.r_a, "Distance Source-Last Image Plane before Mirror", "Distance Source-Grating") self.k = congruence.checkStrictlyPositiveNumber(self.k, "Line Density") if self.units_in_use == 0: self.photon_energy = congruence.checkPositiveNumber( self.photon_energy, "Photon Energy") elif self.units_in_use == 1: self.photon_wavelength = congruence.checkPositiveNumber( self.photon_wavelength, "Photon Wavelength")
def get_lorentz_polarization(self): if self.use_polarization_factor == 1: congruence.checkPositiveNumber(self.degree_of_polarization, "Deg. Pol.") congruence.checkLessOrEqualThan(self.degree_of_polarization, 1.0, "Deg. Pol.", "1.0") if self.use_polarization_factor == 1 and self.use_twotheta_mono == 1: congruence.checkStrictlyPositiveAngle(self.twotheta_mono, "2\u03B8 Monochromator") return PolarizationParameters( use_lorentz_factor=self.use_lorentz_factor == 1, lorentz_formula=self.lorentz_formula, use_polarization_factor=self.use_polarization_factor, twotheta_mono=None if (self.use_polarization_factor == 0 or self.use_twotheta_mono == 0) else self.twotheta_mono, beampath=self.beampath, degree_of_polarization=self.degree_of_polarization)
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.checkPositiveNumber(self.ELECTRONBEAMDIVERGENCEH, "Electron Beam Divergence H") self.ELECTRONBEAMDIVERGENCEV = congruence.checkPositiveNumber(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.checkPositiveNumber(self.DISTANCE, "Distance to slit") self.GAPH = congruence.checkPositiveNumber(self.GAPH, "Slit gap H") self.GAPV = congruence.checkPositiveNumber(self.GAPV, "Slit gap V") 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")
def checkFields(self): if type(self.DESCRIPTOR) == str: # back compatibility with old version try: self.DESCRIPTOR = self.crystals.index(self.DESCRIPTOR) except: self.DESCRIPTOR = 0 self.H_MILLER_INDEX = congruence.checkNumber(self.H_MILLER_INDEX, "H miller index") self.K_MILLER_INDEX = congruence.checkNumber(self.K_MILLER_INDEX, "K miller index") self.L_MILLER_INDEX = congruence.checkNumber(self.L_MILLER_INDEX, "L miller index") self.TEMPERATURE_FACTOR = congruence.checkNumber( self.TEMPERATURE_FACTOR, "Temperature factor") self.E_MIN = congruence.checkPositiveNumber(self.E_MIN, "Minimum energy") self.E_MAX = congruence.checkStrictlyPositiveNumber( self.E_MAX, "Maximum Energy") self.E_STEP = congruence.checkStrictlyPositiveNumber( self.E_STEP, "Energy step") congruence.checkLessOrEqualThan(self.E_MIN, self.E_MAX, "From Energy", "To Energy") congruence.checkDir(self.SHADOW_FILE)