def check_fields(self): if self.focal_length_calc == 1: congruence.checkPositiveNumber(self.ghy_focallength, "Focal Length value") if self.distance_to_image_calc == 1: congruence.checkPositiveNumber(self.ghy_distance, "Distance to image value") if self.ghy_diff_plane == 0 or self.ghy_diff_plane == 2: congruence.checkStrictlyPositiveNumber( self.ghy_nbins_x, "Number of bins for I(Sagittal) histogram") if self.ghy_diff_plane == 1 or self.ghy_diff_plane == 2: congruence.checkStrictlyPositiveNumber( self.ghy_nbins_z, "Number of bins for I(Tangential) histogram") if self.ghy_files is None or len( self.ghy_files) == 0 or (len(self.ghy_files) == 1 and self.ghy_files[0] == ""): raise ValueError("Height Error Profiles list is empty") congruence.checkStrictlyPositiveNumber(self.ghy_npeak, "Number of diffraction peaks") congruence.checkStrictlyPositiveNumber(self.ghy_fftnpts, "Number of points for FFT")
def check_fields(self): self.DESCRIPTOR = congruence.checkEmptyString(self.DESCRIPTOR, "formula") if self.MAT_FLAG == 1: self.DENSITY = congruence.checkStrictlyPositiveNumber( self.DENSITY, "density") if self.GRID > 0: self.GRIDSTART = congruence.checkPositiveNumber( self.GRIDSTART, "Starting Energy") if self.GRID == 1: self.GRIDEND = congruence.checkStrictlyPositiveNumber( self.GRIDEND, "Energy to") congruence.checkLessThan(self.GRIDSTART, self.GRIDEND, "Starting Energy", "Energy to") self.GRIDN = congruence.checkStrictlyPositiveNumber( self.GRIDN, "Number of points") if self.CALCULATE >= 7 and self.CALCULATE <= 9: self.ROUGH = congruence.checkPositiveNumber( self.ROUGH, "Roughness") self.THETA1 = congruence.checkPositiveNumber( self.THETA1, "Starting Graz angle") if self.THETAGRID == 1: self.THETA2 = congruence.checkStrictlyPositiveNumber( self.THETA2, "Graz angle to") congruence.checkLessThan(self.THETA1, self.THETA2, "Starting Graz angle", "Graz angle to") self.THETAN = congruence.checkStrictlyPositiveNumber( self.THETAN, "Number of angular points") else: self.THETAGRID = 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()
def check_fields(self): self.ENERGY = congruence.checkStrictlyPositiveNumber( self.ENERGY, "Beam Energy") self.CUR = congruence.checkStrictlyPositiveNumber( self.CUR, "Beam Current") self.PERIOD = congruence.checkStrictlyPositiveNumber( self.PERIOD, "Period") self.N = congruence.checkStrictlyPositiveNumber( self.N, "Number of Periods") self.KX = congruence.checkNumber(self.KX, "Kx") self.KY = congruence.checkNumber(self.KY, "Ky") self.EMIN = congruence.checkPositiveNumber(self.EMIN, "Min Energy") self.EMAX = congruence.checkStrictlyPositiveNumber( self.EMAX, "Max Energy") congruence.checkLessThan(self.EMIN, self.EMAX, "Min Energy", "Max Energy") self.NEE = congruence.checkStrictlyPositiveNumber( self.NEE, "Number of energy steps") self.D = congruence.checkPositiveNumber(self.D, "Distance") self.XPC = congruence.checkNumber(self.XPC, "X-pos") self.YPC = congruence.checkNumber(self.YPC, "Y-pos") self.XPS = congruence.checkNumber(self.XPS, "X slit") self.YPS = congruence.checkNumber(self.YPS, "Y Slit") self.NXP = congruence.checkStrictlyPositiveNumber( self.NXP, "Integration points X") self.NYP = congruence.checkStrictlyPositiveNumber( self.NYP, "Integration points Y")
def checkFields(self): congruence.checkPositiveNumber(self.source_plane_distance, "Distance from Source") congruence.checkPositiveNumber(self.image_plane_distance, "Image Plane Distance") congruence.checkStrictlyPositiveNumber(self.input_diameter, "Input Diameter") congruence.checkStrictlyPositiveAngle(self.angular_acceptance, "Angular Acceptance") congruence.checkStrictlyPositiveNumber(self.output_diameter, "Output Diameter") congruence.checkStrictlyPositiveNumber(self.inner_diameter, "Central Diameter") congruence.checkStrictlyPositiveNumber(self.focal_length, "Focal Length") congruence.checkStrictlyPositiveNumber(self.focus_dimension, "Focus Dimension") congruence.checkStrictlyPositiveNumber(self.lens_length, "Lens Total Length") if self.inner_diameter <= self.input_diameter: raise Exception("Central Diameter should be greater than Input diameter") if self.inner_diameter <= self.output_diameter: raise Exception("Central Diameter should be greater than Output diameter") if self.focal_length < self.output_diameter: raise Exception("Focal Length should be greater than or equal to Output diameter") first_slit_distance = self.get_first_slits_distance() second_slit_distance = self.get_second_slits_distance() slit_distance = first_slit_distance + second_slit_distance if self.lens_length < slit_distance: raise Exception("Lens total Length should be greater than or equal to " + str(slit_distance)) congruence.checkStrictlyPositiveNumber(self.transmittance, "Lens Transmittance")
def get_strain_parameters(self): if self.active == 1: if not self.rho_function == 1: congruence.checkStrictlyPositiveNumber(self.rho, "\u03c1") if not self.Re_function == 1: congruence.checkStrictlyPositiveNumber(self.Re, "Re") if not self.mix_function == 1: congruence.checkPositiveNumber(self.mix, "mix") if not self.b_function == 1: congruence.checkStrictlyPositiveNumber(self.b, "b") return KrivoglazWilkensModel( rho=OWGenericWidget.get_fit_parameter_from_widget( self, "rho", self.get_parameters_prefix()), Re=OWGenericWidget.get_fit_parameter_from_widget( self, "Re", self.get_parameters_prefix()), Ae=OWGenericWidget.get_fit_parameter_from_widget( self, "Ae", self.get_parameters_prefix()), Be=OWGenericWidget.get_fit_parameter_from_widget( self, "Be", self.get_parameters_prefix()), As=OWGenericWidget.get_fit_parameter_from_widget( self, "As", self.get_parameters_prefix()), Bs=OWGenericWidget.get_fit_parameter_from_widget( self, "Bs", self.get_parameters_prefix()), mix=OWGenericWidget.get_fit_parameter_from_widget( self, "mix", self.get_parameters_prefix()), b=OWGenericWidget.get_fit_parameter_from_widget( self, "b", self.get_parameters_prefix()), active=self.active == 1)
def check_fields(self): congruence.checkPositiveNumber(self.qnC, "e-bunch charge") congruence.checkStrictlyPositiveNumber(self.ekev, "energy") congruence.checkStrictlyPositiveNumber(self.pulse_duration, "Pulse Duration") congruence.checkStrictlyPositiveNumber(self.pulseEnergy, "Pulse Energy") congruence.checkStrictlyPositiveNumber(self.coh_time, "Coherence time") congruence.checkPositiveNumber(self.distance, "Distance to next")
def check_fields(self): self.VOLTAGE = congruence.checkStrictlyPositiveNumber( self.VOLTAGE, "Voltage") if self.VOLTAGE < 30 or self.VOLTAGE > 140: raise Exception("Voltage out of range") self.RIPPLE = congruence.checkPositiveNumber(self.RIPPLE, "Voltage ripple") self.AL_FILTER = congruence.checkPositiveNumber( self.AL_FILTER, "Al filter")
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.k = congruence.checkStrictlyPositiveNumber(self.k, "Line Densityg") 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 check_fields(self): self.TEMPERATURE = congruence.checkPositiveNumber( self.TEMPERATURE, "Temperature") self.E_MIN = congruence.checkPositiveNumber(self.E_MIN, "Min Energy") self.E_MAX = congruence.checkStrictlyPositiveNumber( self.E_MAX, "Max Energy") congruence.checkLessThan(self.E_MIN, self.E_MAX, "Min Energy", "Max Energy") self.NPOINTS = congruence.checkStrictlyPositiveNumber( self.NPOINTS, "Number of Points")
def checkLightSourceSpecificFields(self): congruence.checkStrictlyPositiveNumber(self.magnetic_radius, "Magnetic Radius") congruence.checkStrictlyPositiveNumber(self.magnetic_field, "Magnetic Field") congruence.checkStrictlyPositiveNumber(self.length, "Length") congruence.checkPositiveNumber(self.transition_steepness, "Transition Steepness") congruence.checkGreaterThan(self.z_end, self.z_start, "z end", "z start")
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.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.KMIN = congruence.checkPositiveNumber(self.KMIN, "K Min") self.KMAX = congruence.checkStrictlyPositiveNumber(self.KMAX, "K Max") congruence.checkLessThan(self.KMIN, self.KMAX, "K Min", "K Max") self.KPOINTS = congruence.checkStrictlyPositiveNumber( self.KPOINTS, "Number of K Points")
def check_fields_aux(self): if len(self.crl_error_profiles) == 0: raise ValueError("No Thickness error profile specified") if self.crl_material_data == 0: self.crl_material = congruence.checkEmptyString( self.crl_material, "Chemical Formula") else: congruence.checkStrictlyPositiveNumber( self.crl_delta, "Refractive Index (\u03b4)") congruence.checkPositiveNumber(self.crl_scaling_factor, "Thickness Error Scaling Factor")
def checkFields(self): congruence.checkPositiveNumber(self.p, "Distance Source - KB center") congruence.checkPositiveNumber(self.q, "Distance KB center - Image plane") congruence.checkPositiveNumber(self.separation, "Separation between the Mirrors") congruence.checkPositiveAngle(self.mirror_orientation_angle, "Mirror orientation angle") if self.use_different_focal_positions == 1: congruence.checkPositiveNumber(self.focal_positions_p, "Focal Position P") congruence.checkPositiveNumber(self.focal_positions_q, "Focal Position Q") self.v_box.checkFields() self.h_box.checkFields()
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.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 checkFields(self): self.number_of_rays = congruence.checkPositiveNumber(self.number_of_rays, "Number of rays") self.seed = congruence.checkPositiveNumber(self.seed, "Seed") self.energy = congruence.checkPositiveNumber(self.energy, "Energy") self.delta_e = congruence.checkPositiveNumber(self.delta_e, "Delta Energy") self.sigma_x = congruence.checkPositiveNumber(self.sigma_x, "Size RMS H") self.sigma_z = congruence.checkPositiveNumber(self.sigma_z, "Size RMS V") self.sigma_divergence_x = congruence.checkPositiveNumber(self.sigma_divergence_x, "Divergence RMS H") self.sigma_divergence_z = congruence.checkPositiveNumber(self.sigma_divergence_z, "Divergence RMS V") self.undulator_length = congruence.checkPositiveNumber(self.undulator_length, "Undulator Length")
def check_fields(self): self.number_of_points_x = congruence.checkStrictlyPositiveNumber(self.number_of_points_x, "Number of Points X") self.number_of_points_y = congruence.checkStrictlyPositiveNumber(self.number_of_points_y, "Number of Points Y") self.dimension_x = congruence.checkStrictlyPositiveNumber(self.dimension_x, "Dimension X") self.dimension_y = congruence.checkStrictlyPositiveNumber(self.dimension_y, "Dimension Y") self.estimated_slope_error = congruence.checkPositiveNumber(self.estimated_slope_error, "Estimated slope error") self.montecarlo_seed = congruence.checkPositiveNumber(self.montecarlo_seed, "Monte Carlo initial seed") self.harmonic_maximum_index = congruence.checkPositiveNumber(self.harmonic_maximum_index, "Harmonic Maximum Index") congruence.checkDir(self.waviness_file_name)
def checkFields(self): self.source_plane_distance = congruence.checkNumber(self.source_plane_distance, "Source plane distance") self.image_plane_distance = congruence.checkNumber(self.image_plane_distance, "Image plane distance") congruence.checkStrictlyPositiveNumber(self.delta_rn, u"\u03B4" + "rn" ) congruence.checkStrictlyPositiveNumber(self.diameter, "Z.P. Diameter") if (self.source_distance_flag == 1): congruence.checkPositiveNumber(self.source_distance, "Source Distance" ) if self.type_of_zp == PHASE_ZP: congruence.checkEmptyString(self.zone_plate_material, "Zone Plate Material") congruence.checkStrictlyPositiveNumber(self.zone_plate_thickness, "Zone Plate Thickness") congruence.checkEmptyString(self.substrate_material, "Substrate Material") congruence.checkStrictlyPositiveNumber(self.substrate_thickness, "Substrate Thickness")
def check_fields(self): congruence.checkStrictlyPositiveNumber(self.nCRL, "Number of Lenses") congruence.checkPositiveNumber(self.delta, "delta") congruence.checkPositiveNumber(self.attenLen, "Attenuation length") congruence.checkPositiveNumber(self.diamCRL, "CRL diameter") congruence.checkPositiveNumber(self.distance, "Distance to next")
def check_fields(self): if self.kind_of_profile_y < 2: self.dimension_y = congruence.checkStrictlyPositiveNumber(self.dimension_y, "Dimension Y") self.step_y = congruence.checkStrictlyPositiveNumber(self.step_y, "Step Y") if self.kind_of_profile_y == 0: self.power_law_exponent_beta_y = congruence.checkPositiveNumber(self.power_law_exponent_beta_y, "Beta Value Y") if self.kind_of_profile_y == 1: self.correlation_length_y = congruence.checkStrictlyPositiveNumber(self.correlation_length_y, "Correlation Length Y") self.rms_y = congruence.checkPositiveNumber(self.rms_y, "Rms Y") self.montecarlo_seed_y = congruence.checkPositiveNumber(self.montecarlo_seed_y, "Monte Carlo initial seed y") else: congruence.checkFile(self.heigth_profile_1D_file_name_y) self.conversion_factor_y_x = congruence.checkStrictlyPositiveNumber(self.conversion_factor_y_x, "Conversion from file to workspace units(Abscissa)") self.conversion_factor_y_y = congruence.checkStrictlyPositiveNumber(self.conversion_factor_y_y, "Conversion from file to workspace units (Height Profile Values)") if self.renormalize_y == 1: self.rms_y = congruence.checkPositiveNumber(self.rms_y, "Rms Y") if self.kind_of_profile_x < 2: self.dimension_x = congruence.checkStrictlyPositiveNumber(self.dimension_x, "Dimension X") self.step_x = congruence.checkStrictlyPositiveNumber(self.step_x, "Step X") if self.kind_of_profile_x == 0: self.power_law_exponent_beta_x = congruence.checkPositiveNumber(self.power_law_exponent_beta_x, "Beta Value X") if self.kind_of_profile_x == 1: self.correlation_length_x = congruence.checkStrictlyPositiveNumber(self.correlation_length_x, "Correlation Length X") self.rms_x = congruence.checkPositiveNumber(self.rms_x, "Rms X") self.montecarlo_seed_x = congruence.checkPositiveNumber(self.montecarlo_seed_x, "Monte Carlo initial seed X") else: congruence.checkFile(self.heigth_profile_1D_file_name_x) self.conversion_factor_x_x = congruence.checkStrictlyPositiveNumber(self.conversion_factor_x_x, "Conversion from file to workspace units(Abscissa)") self.conversion_factor_x_y = congruence.checkStrictlyPositiveNumber(self.conversion_factor_x_y, "Conversion from file to workspace units (Height Profile Values)") if self.renormalize_x == 1: self.rms_x = congruence.checkPositiveNumber(self.rms_x, "Rms X") congruence.checkDir(self.heigth_profile_file_name)
def check_fields(self): if self.focal_length_calc == 1: congruence.checkPositiveNumber(self.ghy_focallength, "Focal Length value") if self.distance_to_image_calc == 1: congruence.checkPositiveNumber(self.ghy_distance, "Distance to image value") if self.ghy_diff_plane == 0 or self.ghy_diff_plane == 2: congruence.checkStrictlyPositiveNumber(self.ghy_nbins_x, "Number of bins for I(Sagittal) histogram") if self.ghy_diff_plane == 1 or self.ghy_diff_plane == 2: congruence.checkStrictlyPositiveNumber(self.ghy_nbins_z, "Number of bins for I(Tangential) histogram") congruence.checkStrictlyPositiveNumber(self.ghy_npeak, "Number of diffraction peaks") congruence.checkStrictlyPositiveNumber(self.ghy_fftnpts, "Number of points for FFT")
def checkFields(self): congruence.checkPositiveNumber(self.grazing_angles_mrad, "Grazing Angle") if self.has_finite_dimensions == 0: congruence.checkStrictlyPositiveNumber(self.mirror_width, "Mirror Width") congruence.checkStrictlyPositiveNumber(self.mirror_length, "Mirror Length") elif self.has_surface_error != 0: raise Exception("With surface error file, dimensions cannot be infinite") if self.reflectivity_kind != 0: congruence.checkFile(self.reflectivity_files) if self.has_surface_error == 1: congruence.checkFile(self.surface_error_files)
def checkFields(self): congruence.checkPositiveNumber(self.p, "P") congruence.checkPositiveNumber(self.q, "Q") if self.has_finite_diameter == 0: congruence.checkStrictlyPositiveNumber(self.diameter, "Diameter") if self.ri_calculation_mode == 1: congruence.checkFile(self.prerefl_file) else: congruence.checkPositiveNumber(self.refraction_index, "Refraction Index") congruence.checkPositiveNumber(self.attenuation_coefficient, "Attenuation Coefficient") congruence.checkStrictlyPositiveNumber(self.radius, "Radius") congruence.checkPositiveNumber(self.interthickness, "Lens Thickness")
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) congruence.checkPositiveNumber(self.diffraction_order, "Diffraction Order") congruence.checkStrictlyPositiveNumber(self.grooving_density_0, "Groove density")
def check_fields(self): self.NPERIODS = congruence.checkStrictlyPositiveNumber( self.NPERIODS, "Number of Periods") self.ENERGY = congruence.checkStrictlyPositiveNumber( self.ENERGY, "Beam Energy") self.PHOT_ENERGY_MIN = congruence.checkPositiveNumber( self.PHOT_ENERGY_MIN, "Min Photon Energy") self.PHOT_ENERGY_MAX = congruence.checkStrictlyPositiveNumber( self.PHOT_ENERGY_MAX, "Max Photon Energy") congruence.checkLessThan(self.PHOT_ENERGY_MIN, self.PHOT_ENERGY_MAX, "Min Photon Energy", "Max Photon Energy") self.NPOINTS = congruence.checkStrictlyPositiveNumber( self.NPOINTS, "Number of Energy Points") self.CURRENT = congruence.checkStrictlyPositiveNumber( self.CURRENT, "Electron Beam Current") if self.FIELD == 0: self.ULAMBDA = congruence.checkStrictlyPositiveNumber( self.ULAMBDA, "Wiggler period") self.K = congruence.checkStrictlyPositiveNumber(self.K, "K") self.NTRAJPOINTS = congruence.checkStrictlyPositiveNumber( self.NTRAJPOINTS, "Number of traj points per period") elif self.FIELD == 1: self.ULAMBDA = congruence.checkStrictlyPositiveNumber( self.ULAMBDA, "Wiggler period") self.NTRAJPOINTS = congruence.checkStrictlyPositiveNumber( self.NTRAJPOINTS, "Number of traj points per period") congruence.checkFile(self.FILE) elif self.FIELD == 2: congruence.checkFile(self.FILE)
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")
def check_fields(self): self.dimension_y = congruence.checkStrictlyPositiveNumber( self.dimension_y, "Dimension") self.step_y = congruence.checkStrictlyPositiveNumber( self.step_y, "Step") if self.kind_of_profile_y == 0: self.power_law_exponent_beta_y = congruence.checkPositiveNumber( self.power_law_exponent_beta_y, "Beta Value") if self.kind_of_profile_y == 1: self.correlation_length_y = congruence.checkStrictlyPositiveNumber( self.correlation_length_y, "Correlation Length") self.rms_y = congruence.checkPositiveNumber(self.rms_y, "Rms") self.montecarlo_seed_y = congruence.checkPositiveNumber( self.montecarlo_seed_y, "Monte Carlo initial seed") congruence.checkDir(self.heigth_profile_file_name)
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") if self.E_MIN > self.E_MAX: raise Exception("Minimum Energy cannot be bigger than Maximum Energy") congruence.checkDir(self.SHADOW_FILE)
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.checkPositiveNumber(self.grazing_angles_mrad, "Grazing Angle") if self.has_finite_dimensions == 0: congruence.checkStrictlyPositiveNumber(self.mirror_width, "Mirror Width") congruence.checkStrictlyPositiveNumber(self.mirror_length, "Mirror Length") elif self.has_surface_error != 0: raise Exception( "With surface error file, dimensions cannot be infinite") if self.reflectivity_kind != 0: congruence.checkFile(self.reflectivity_files) if self.has_surface_error == 1: congruence.checkFile(self.surface_error_files)
def check_fields(self): self.MILLER_INDEX_H = congruence.checkNumber(self.MILLER_INDEX_H, "Miller index H") self.MILLER_INDEX_K = congruence.checkNumber(self.MILLER_INDEX_K, "Miller index K") self.MILLER_INDEX_L = congruence.checkNumber(self.MILLER_INDEX_L, "Miller index L") self.TEMPER = congruence.checkNumber(self.TEMPER, "Temperature factor") if self.SCAN == 0 or self.SCAN == 3: self.SCANFROM = congruence.checkPositiveNumber( self.SCANFROM, "Min Scan value") self.SCANTO = congruence.checkStrictlyPositiveNumber( self.SCANTO, "Max Scan value") else: self.SCANFROM = congruence.checkNumber(self.SCANFROM, "Min Scan value") self.SCANTO = congruence.checkNumber(self.SCANTO, "Max Scan value") congruence.checkLessThan(self.SCANFROM, self.SCANTO, "Min Scan value", "Max Scan value") self.SCANPOINTS = congruence.checkStrictlyPositiveNumber( self.SCANPOINTS, "Scan points") if self.SCAN < 4: self.ENERGY = congruence.checkStrictlyPositiveNumber( self.ENERGY, "Fix value") else: self.ENERGY = congruence.checkNumber(self.ENERGY, "Fix value") if self.MOSAIC == 0: #perfect self.ASYMMETRY_ANGLE = congruence.checkNumber( self.ASYMMETRY_ANGLE, "Asymmetry angle") self.THICKNESS = congruence.checkStrictlyPositiveNumber( self.THICKNESS, "Crystal thickness") elif self.MOSAIC == 1: #mosaic self.THICKNESS = congruence.checkStrictlyPositiveNumber( self.THICKNESS, "Crystal thickness") self.MOSAIC_FWHM = congruence.checkNumber(self.MOSAIC_FWHM, "Mosaicity") elif self.MOSAIC == 2 or self.MOSAIC == 3: #bent ML/PP self.ASYMMETRY_ANGLE = congruence.checkNumber( self.ASYMMETRY_ANGLE, "Asymmetry angle") self.THICKNESS = congruence.checkStrictlyPositiveNumber( self.THICKNESS, "Crystal thickness") self.RSAG = congruence.checkStrictlyPositiveNumber( self.RSAG, "R Sagittal") self.RMER = congruence.checkStrictlyPositiveNumber( self.RMER, "R meridional") if self.ANISOTROPY == 0: self.POISSON = congruence.checkStrictlyPositiveNumber( self.POISSON, "Poisson Ratio") elif self.ANISOTROPY == 2: congruence.checkEmptyString(self.CUT, "Valong; Vnorm; Vperp") elif self.ANISOTROPY == 3: congruence.checkFile(self.FILECOMPLIANCE)
def check_fields(self): if self.modify_y == 1 or self.modify_y == 2: self.new_length = congruence.checkStrictlyPositiveNumber( self.new_length, "New Length") if self.renormalize_y == 1: self.rms_y = congruence.checkPositiveNumber(self.rms_y, "Rms Y") congruence.checkDir(self.heigth_profile_file_name)
def check_fields(self): self.ENERGY = congruence.checkStrictlyPositiveNumber(self.ENERGY, "Beam Energy") self.CUR = congruence.checkStrictlyPositiveNumber(self.CUR, "Beam Current") self.PERIOD = congruence.checkStrictlyPositiveNumber(self.PERIOD, "Period") self.N = congruence.checkStrictlyPositiveNumber(self.N, "Number of Periods") self.KX = congruence.checkNumber(self.KX, "Kx") self.KY = congruence.checkNumber(self.KY, "Ky") self.EMIN = congruence.checkPositiveNumber(self.EMIN, "Min Energy") self.EMAX = congruence.checkStrictlyPositiveNumber(self.EMAX, "Max Energy") congruence.checkLessThan(self.EMIN, self.EMAX, "Min Energy", "Max Energy") self.NEE = congruence.checkStrictlyPositiveNumber(self.NEE, "Number of energy steps") self.D = congruence.checkPositiveNumber(self.D, "Distance") self.XPC = congruence.checkNumber(self.XPC, "X-pos") self.YPC = congruence.checkNumber(self.YPC, "Y-pos") self.XPS = congruence.checkNumber(self.XPS, "X slit") self.YPS = congruence.checkNumber(self.YPS, "Y Slit") self.NXP = congruence.checkStrictlyPositiveNumber(self.NXP, "Integration points X") self.NYP = congruence.checkStrictlyPositiveNumber(self.NYP, "Integration points Y")
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 check_fields(self): self.DESCRIPTOR = congruence.checkEmptyString(self.DESCRIPTOR, "formula") if self.GRID > 0: self.GRIDSTART = congruence.checkPositiveNumber(self.GRIDSTART, "Starting Energy") if self.GRID == 1: self.GRIDEND = congruence.checkStrictlyPositiveNumber(self.GRIDEND, "Energy to") congruence.checkLessThan(self.GRIDSTART, self.GRIDEND, "Starting Energy", "Energy to") self.GRIDN = congruence.checkStrictlyPositiveNumber(self.GRIDN, "Number of points")
def checkLightSourceSpecificFields(self): if self.magnetic_field_from == 0: congruence.checkPositiveNumber(self.K_horizontal, "Horizontal K") congruence.checkPositiveNumber(self.K_vertical, "Vertical K") else: congruence.checkPositiveNumber(self.B_horizontal, "Horizontal B") congruence.checkPositiveNumber(self.B_vertical, "Vertical B") congruence.checkStrictlyPositiveNumber(self.period_length, "Period Length") congruence.checkStrictlyPositiveNumber(self.number_of_periods, "Number of Periods")
def check_fields(self): self.HMILLER = congruence.checkNumber(self.HMILLER, "h miller index") self.KMILLER = congruence.checkNumber(self.KMILLER, "k miller index") self.LMILLER = congruence.checkNumber(self.LMILLER, "l miller index") self.TEMPER = congruence.checkNumber(self.TEMPER, "Temperature factor") self.ENERGY = congruence.checkPositiveNumber(self.ENERGY, "Energy from") self.ENERGY_END = congruence.checkStrictlyPositiveNumber(self.ENERGY_END, "Energy to") congruence.checkLessThan(self.ENERGY, self.ENERGY_END, "Energy from", "Energy to") self.NPOINTS = congruence.checkStrictlyPositiveNumber(self.NPOINTS, "Number of Points")
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 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.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.KMIN = congruence.checkPositiveNumber(self.KMIN, "K Min") self.KMAX = congruence.checkStrictlyPositiveNumber(self.KMAX, "K Max") congruence.checkLessThan(self.KMIN, self.KMAX, "K Min", "K Max") self.KPOINTS = congruence.checkStrictlyPositiveNumber(self.KPOINTS, "Number of K Points")
def check_fields(self): self.DESCRIPTOR = congruence.checkEmptyString(self.DESCRIPTOR, "formula") if self.MAT_FLAG == 1: self.DENSITY = congruence.checkStrictlyPositiveNumber(self.DENSITY, "density") if self.GRID > 0: self.GRIDSTART = congruence.checkPositiveNumber(self.GRIDSTART, "Starting Energy") if self.GRID == 1: self.GRIDEND = congruence.checkStrictlyPositiveNumber(self.GRIDEND, "Energy to") congruence.checkLessThan(self.GRIDSTART, self.GRIDEND, "Starting Energy", "Energy to") self.GRIDN = congruence.checkStrictlyPositiveNumber(self.GRIDN, "Number of points")
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.PHOTONENERGYMIN = congruence.checkPositiveNumber(self.PHOTONENERGYMIN, "photon Energy Min") self.PHOTONENERGYMAX = congruence.checkStrictlyPositiveNumber(self.PHOTONENERGYMAX, "photon Energy Max") congruence.checkLessThan(self.PHOTONENERGYMIN, self.PHOTONENERGYMAX, "photon Energy Min", "photon Energy Max") self.PHOTONENERGYPOINTS = congruence.checkStrictlyPositiveNumber(self.PHOTONENERGYPOINTS, "photon Energy Points") if sys.platform == 'linux' and self.METHOD == 2: raise Exception("SRW calculation code not supported under Linux")
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.DESCRIPTOR = congruence.checkEmptyString(self.DESCRIPTOR, "formula") if self.MAT_FLAG == 1: self.DENSITY = congruence.checkStrictlyPositiveNumber(self.DENSITY, "density") if self.GRID > 0: self.GRIDSTART = congruence.checkPositiveNumber(self.GRIDSTART, "Starting Energy") if self.GRID == 1: self.GRIDEND = congruence.checkStrictlyPositiveNumber(self.GRIDEND, "Energy to") congruence.checkLessThan(self.GRIDSTART, self.GRIDEND, "Starting Energy", "Energy to") self.GRIDN = congruence.checkStrictlyPositiveNumber(self.GRIDN, "Number of points") if self.CALCULATE >= 7 and self.CALCULATE <= 9: self.ROUGH = congruence.checkPositiveNumber(self.ROUGH, "Roughness") self.THETA1 = congruence.checkPositiveNumber(self.THETA1, "Starting Graz angle") if self.THETAGRID == 1: self.THETA2 = congruence.checkStrictlyPositiveNumber(self.THETA2, "Graz angle to") congruence.checkLessThan(self.THETA1, self.THETA2, "Starting Graz angle", "Graz angle to") self.THETAN = congruence.checkStrictlyPositiveNumber(self.THETAN, "Number of angular points") else: self.THETAGRID = 0
def check_fields(self): if self.RB_CHOICE == 0: self.MACHINE_R_M = congruence.checkStrictlyPositiveNumber(self.MACHINE_R_M, "Magnetic Radius") else: self.BFIELD_T = congruence.checkStrictlyPositiveNumber(self.BFIELD_T, "Magnetic Field") self.BEAM_ENERGY_GEV = congruence.checkStrictlyPositiveNumber(self.BEAM_ENERGY_GEV, "Beam Energy") self.CURRENT_A = congruence.checkStrictlyPositiveNumber(self.CURRENT_A, "Beam Current") self.HOR_DIV_MRAD = congruence.checkPositiveNumber(self.HOR_DIV_MRAD, "Horizontal div Theta") self.PHOT_ENERGY_MIN = congruence.checkPositiveNumber(self.PHOT_ENERGY_MIN, "Min Photon Energy") self.PHOT_ENERGY_MAX = congruence.checkStrictlyPositiveNumber(self.PHOT_ENERGY_MAX, "Max Photon Energy") congruence.checkLessThan(self.PHOT_ENERGY_MIN, self.PHOT_ENERGY_MAX, "Min Photon Energy", "Max Photon Energy") self.NPOINTS = congruence.checkStrictlyPositiveNumber(self.NPOINTS, "Number of Energy Points") self.PSI_MRAD_PLOT = congruence.checkNumber(self.PSI_MRAD_PLOT, "Max Psi for angular plots") if self.VER_DIV == 2: self.PSI_MIN = congruence.checkNumber(self.PSI_MIN, "Min Photon Energy") self.PSI_MAX = congruence.checkNumber(self.PSI_MAX, "Max Photon Max") congruence.checkLessThan(self.PSI_MIN, self.PSI_MAX, "Psi Min", "Psi Max") elif self.VER_DIV == 3: self.PSI_MIN = congruence.checkNumber(self.PSI_MIN, "Min Photon Energy")
def check_fields(self): self.dimension_x = congruence.checkStrictlyPositiveNumber(self.dimension_x, "Dimension X") self.step_x = congruence.checkStrictlyPositiveNumber(self.step_x, "Step X") if self.step_x > self.dimension_x/2: raise Exception("Step Width should be smaller than or equal to Width/2") if self.modify_y == 1: self.scale_factor_y = congruence.checkStrictlyPositiveNumber(self.scale_factor_y, "Scale Factor") elif self.modify_y == 2: self.new_length = congruence.checkStrictlyPositiveNumber(self.new_length, "New Length") if self.renormalize_y == 1: self.rms_y = congruence.checkPositiveNumber(self.rms_y, "Rms Y") congruence.checkDir(self.heigth_profile_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.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") if self.E_MIN > self.E_MAX: raise Exception("From Energy cannot be bigger than To Energy") congruence.checkDir(self.SHADOW_FILE)
def checkFields(self): congruence.checkPositiveNumber(self.p, "Distance Source - KB center") congruence.checkPositiveNumber(self.q, "Distance KB center - Image plane") congruence.checkPositiveNumber(self.separation, "Separation between the Mirrors") congruence.checkStrictlyPositiveNumber(self.photon_energy_ev, "Photon Energy") congruence.checkFile(self.reflectivity_file) self.crystal_1_box.checkFields() self.crystal_2_box.checkFields()
def check_fields(self): self.NPERIODS = congruence.checkStrictlyPositiveNumber(self.NPERIODS, "Number of Periods") self.ENERGY = congruence.checkStrictlyPositiveNumber(self.ENERGY, "Beam Energy") self.PHOT_ENERGY_MIN = congruence.checkPositiveNumber(self.PHOT_ENERGY_MIN, "Min Photon Energy") self.PHOT_ENERGY_MAX = congruence.checkStrictlyPositiveNumber(self.PHOT_ENERGY_MAX, "Max Photon Energy") congruence.checkLessThan(self.PHOT_ENERGY_MIN, self.PHOT_ENERGY_MAX, "Min Photon Energy", "Max Photon Energy") self.NPOINTS = congruence.checkStrictlyPositiveNumber(self.NPOINTS, "Number of Energy Points") self.CURRENT = congruence.checkStrictlyPositiveNumber(self.CURRENT, "Electron Beam Current") if self.FIELD == 0: self.ULAMBDA = congruence.checkStrictlyPositiveNumber(self.ULAMBDA, "Wiggler period") self.K = congruence.checkStrictlyPositiveNumber(self.K, "K") self.NTRAJPOINTS = congruence.checkStrictlyPositiveNumber(self.NTRAJPOINTS, "Number of traj points per period") elif self.FIELD == 1: self.ULAMBDA = congruence.checkStrictlyPositiveNumber(self.ULAMBDA, "Wiggler period") self.NTRAJPOINTS = congruence.checkStrictlyPositiveNumber(self.NTRAJPOINTS, "Number of traj points per period") congruence.checkUrl(self.FILE) elif self.FIELD == 2: congruence.checkUrl(self.FILE)
def check_fields(self): self.MILLER_INDEX_H = congruence.checkNumber(self.MILLER_INDEX_H, "Miller index H") self.MILLER_INDEX_K = congruence.checkNumber(self.MILLER_INDEX_K, "Miller index K") self.MILLER_INDEX_L = congruence.checkNumber(self.MILLER_INDEX_L, "Miller index L") self.TEMPER = congruence.checkNumber(self.TEMPER, "Temperature factor") if self.SCAN == 0 or self.SCAN == 3: self.SCANFROM = congruence.checkPositiveNumber(self.SCANFROM, "Min Scan value") self.SCANTO = congruence.checkStrictlyPositiveNumber(self.SCANTO, "Max Scan value") else: self.SCANFROM = congruence.checkNumber(self.SCANFROM, "Min Scan value") self.SCANTO = congruence.checkNumber(self.SCANTO, "Max Scan value") congruence.checkLessThan(self.SCANFROM, self.SCANTO, "Min Scan value", "Max Scan value") self.SCANPOINTS = congruence.checkStrictlyPositiveNumber(self.SCANPOINTS, "Scan points") if self.SCAN < 4: self.ENERGY = congruence.checkStrictlyPositiveNumber(self.ENERGY , "Fix value") else: self.ENERGY = congruence.checkNumber(self.ENERGY , "Fix value") if self.MOSAIC == 0: #perfect self.ASYMMETRY_ANGLE = congruence.checkNumber(self.ASYMMETRY_ANGLE, "Asymmetry angle") self.THICKNESS = congruence.checkStrictlyPositiveNumber(self.THICKNESS, "Crystal thickness") elif self.MOSAIC == 1: #mosaic self.THICKNESS = congruence.checkStrictlyPositiveNumber(self.THICKNESS, "Crystal thickness") self.MOSAIC_FWHM = congruence.checkNumber(self.MOSAIC_FWHM, "Mosaicity") elif self.MOSAIC == 2 or self.MOSAIC == 3: #bent ML/PP self.ASYMMETRY_ANGLE = congruence.checkNumber(self.ASYMMETRY_ANGLE, "Asymmetry angle") self.THICKNESS = congruence.checkStrictlyPositiveNumber(self.THICKNESS, "Crystal thickness") self.RSAG = congruence.checkStrictlyPositiveNumber(self.RSAG, "R Sagittal") self.RMER = congruence.checkStrictlyPositiveNumber(self.RMER, "R meridional") if self.ANISOTROPY == 0: self.POISSON = congruence.checkStrictlyPositiveNumber(self.POISSON, "Poisson Ratio") elif self.ANISOTROPY == 2: congruence.checkEmptyString(self.CUT, "Valong; Vnorm; Vperp") elif self.ANISOTROPY == 3: congruence.checkFile(self.FILECOMPLIANCE)
def plot_results(self): # self.error(self.error_id) try: plotted = False sys.stdout = EmittingStream(textWritten=self.writeStdOut) if self.trace_shadow: grabber = TTYGrabber() grabber.start() if ShadowCongruence.checkEmptyBeam(self.input_beam): ShadowPlot.set_conversion_active(self.getConversionActive()) self.number_of_bins = congruence.checkPositiveNumber(self.number_of_bins, "Number of Bins") x, auto_title, xum = self.get_titles() self.plot_histo(x, title=self.title, xtitle=auto_title, ytitle="Number of Rays", xum=xum) plotted = True if self.trace_shadow: grabber.stop() for row in grabber.ttyData: self.writeStdOut(row) time.sleep(0.5) # prevents a misterious dead lock in the Orange cycle when refreshing the histogram return plotted except Exception as exception: QtGui.QMessageBox.critical(self, "Error", str(exception), QtGui.QMessageBox.Ok) # self.error_id = self.error_id + 1 # self.error(self.error_id, "Exception occurred: " + str(exception)) return False
def checkFields(self): congruence.checkPositiveNumber(self.source_plane_distance, "Distance from Source") congruence.checkPositiveNumber(self.image_plane_distance, "Image Plane Distance") congruence.checkStrictlyPositiveNumber(self.input_diameter, "Input Diameter") congruence.checkStrictlyPositiveAngle(self.angular_acceptance, "Angular Acceptance") congruence.checkStrictlyPositiveNumber(self.output_diameter, "Output Diameter") congruence.checkPositiveNumber(self.residual_divergence, "Residual Output Divergence") congruence.checkStrictlyPositiveNumber(self.lens_length, "Lens Total Length") if self.output_diameter <= self.input_diameter: raise Exception("Output Diameter should be greater than Input diameter") slit_distance = self.get_slits_distance() if self.lens_length < slit_distance: raise Exception("Lens total Length should be greater than or equal to " + str(slit_distance)) congruence.checkStrictlyPositiveNumber(self.transmittance, "Lens Transmittance")
def check_fields(self): self.ENERGY = congruence.checkStrictlyPositiveNumber(self.ENERGY, "Electron Energy") self.CURRENT = congruence.checkStrictlyPositiveNumber(self.CURRENT, "Current") self.ENERGY_SPREAD = congruence.checkStrictlyPositiveNumber(self.ENERGY_SPREAD, "Energy Spread") self.SIGX = congruence.checkPositiveNumber(self.SIGX , "Sigma X") self.SIGY = congruence.checkPositiveNumber(self.SIGY , "Sigma Y") self.SIGX1 = congruence.checkPositiveNumber(self.SIGX1, "Sigma X'") self.SIGY1 = congruence.checkPositiveNumber(self.SIGY1, "Sigma Y'") self.PERIOD = congruence.checkStrictlyPositiveNumber(self.PERIOD, "Period length") self.NP = congruence.checkStrictlyPositiveNumber(self.NP, "Number of periods") self.EMIN = congruence.checkPositiveNumber(self.EMIN, "E1 minimum energy") self.EMAX = congruence.checkStrictlyPositiveNumber(self.EMAX, "E1 maximum energy") congruence.checkLessThan(self.EMIN, self.EMAX, "E1 minimum energy", "E1 maximum energy") self.N = congruence.checkStrictlyPositiveNumber(self.N, "Number of Energy Points") self.HARMONIC_FROM = congruence.checkStrictlyPositiveNumber(self.HARMONIC_FROM, "Minimum harmonic number") self.HARMONIC_TO = congruence.checkStrictlyPositiveNumber(self.HARMONIC_TO, "Maximum harmonic number") congruence.checkLessThan(self.HARMONIC_FROM, self.HARMONIC_TO, "Minimum harmonic number", "Maximum harmonic number") self.HARMONIC_STEP = congruence.checkStrictlyPositiveNumber(self.HARMONIC_STEP, "Harmonic step size") self.NEKS = congruence.checkPositiveNumber(self.NEKS , "Intrinsic NEKS")
def check_fields(self): self.DESCRIPTOR = congruence.checkEmptyString(self.DESCRIPTOR, "formula") self.GRIDSTART = congruence.checkPositiveNumber(self.GRIDSTART, "Q from") self.GRIDEND = congruence.checkStrictlyPositiveNumber(self.GRIDEND, "Q to") congruence.checkLessThan(self.GRIDSTART, self.GRIDEND, "Q from", "Q to") self.GRIDN = congruence.checkStrictlyPositiveNumber(self.GRIDN, "Number of q Points")
def check_fields(self): self.VOLTAGE = congruence.checkStrictlyPositiveNumber(self.VOLTAGE, "Voltage") if self.VOLTAGE < 30 or self.VOLTAGE > 140: raise Exception("Voltage out of range") self.RIPPLE = congruence.checkPositiveNumber(self.RIPPLE, "Voltage ripple") self.AL_FILTER = congruence.checkPositiveNumber(self.AL_FILTER, "Al filter")
def check_fields(self): if self.SOURCE == 1: self.ENER_MIN = congruence.checkPositiveNumber(self.ENER_MIN, "Energy from") self.ENER_MAX = congruence.checkStrictlyPositiveNumber(self.ENER_MAX, "Energy to") congruence.checkLessThan(self.ENER_MIN, self.ENER_MAX, "Energy from", "Energy to") self.NPOINTS = congruence.checkStrictlyPositiveNumber(self.ENER_N, "Energy Points") elif self.SOURCE == 2: congruence.checkFile(self.SOURCE_FILE) if self.NELEMENTS >= 1: self.EL1_FOR = congruence.checkEmptyString(self.EL1_FOR, "1st oe formula") if self.EL1_FLAG == 0: # filter self.EL1_THI = congruence.checkStrictlyPositiveNumber(self.EL1_THI, "1st oe filter thickness") elif self.EL1_FLAG == 1: # mirror self.EL1_ANG = congruence.checkStrictlyPositiveNumber(self.EL1_ANG, "1st oe mirror angle") self.EL1_ROU = congruence.checkPositiveNumber(self.EL1_ROU, "1st oe mirror roughness") if not self.EL1_DEN.strip() == "?": self.EL1_DEN = str(congruence.checkStrictlyPositiveNumber(float(congruence.checkNumber(self.EL1_DEN, "1st oe density")), "1st oe density")) if self.NELEMENTS >= 2: self.EL2_FOR = congruence.checkEmptyString(self.EL2_FOR, "2nd oe formula") if self.EL2_FLAG == 0: # filter self.EL2_THI = congruence.checkStrictlyPositiveNumber(self.EL2_THI, "2nd oe filter thickness") elif self.EL2_FLAG == 1: # mirror self.EL2_ANG = congruence.checkStrictlyPositiveNumber(self.EL2_ANG, "2nd oe mirror angle") self.EL2_ROU = congruence.checkPositiveNumber(self.EL2_ROU, "2nd oe mirror roughness") if not self.EL2_DEN.strip() == "?": self.EL2_DEN = str(congruence.checkStrictlyPositiveNumber(float(congruence.checkNumber(self.EL2_DEN, "2nd oe density")), "2nd oe density")) if self.NELEMENTS >= 3: self.EL3_FOR = congruence.checkEmptyString(self.EL3_FOR, "3rd oe formula") if self.EL3_FLAG == 0: # filter self.EL3_THI = congruence.checkStrictlyPositiveNumber(self.EL3_THI, "3rd oe filter thickness") elif self.EL3_FLAG == 1: # mirror self.EL3_ANG = congruence.checkStrictlyPositiveNumber(self.EL3_ANG, "3rd oe mirror angle") self.EL3_ROU = congruence.checkPositiveNumber(self.EL3_ROU, "3rd oe mirror roughness") if not self.EL3_DEN.strip() == "?": self.EL3_DEN = str(congruence.checkStrictlyPositiveNumber(float(congruence.checkNumber(self.EL3_DEN, "3rd oe density")), "3rd oe density")) if self.NELEMENTS >= 4: self.EL4_FOR = congruence.checkEmptyString(self.EL4_FOR, "4th oe formula") if self.EL4_FLAG == 0: # filter self.EL4_THI = congruence.checkStrictlyPositiveNumber(self.EL4_THI, "4th oe filter thickness") elif self.EL4_FLAG == 1: # mirror self.EL4_ANG = congruence.checkStrictlyPositiveNumber(self.EL4_ANG, "4th oe mirror angle") self.EL4_ROU = congruence.checkPositiveNumber(self.EL4_ROU, "4th oe mirror roughness") if not self.EL4_DEN.strip() == "?": self.EL4_DEN = str(congruence.checkStrictlyPositiveNumber(float(congruence.checkNumber(self.EL4_DEN, "4th oe density")), "4th oe density")) if self.NELEMENTS >= 5: self.EL5_FOR = congruence.checkEmptyString(self.EL5_FOR, "5th oe formula") if self.EL5_FLAG == 0: # filter self.EL5_THI = congruence.checkStrictlyPositiveNumber(self.EL5_THI, "5th oe filter thickness") elif self.EL5_FLAG == 1: # mirror self.EL5_ANG = congruence.checkStrictlyPositiveNumber(self.EL5_ANG, "5th oe mirror angle") self.EL5_ROU = congruence.checkPositiveNumber(self.EL5_ROU, "5th oe mirror roughness") if not self.EL5_DEN.strip() == "?": self.EL5_DEN = str(congruence.checkStrictlyPositiveNumber(float(congruence.checkNumber(self.EL5_DEN, "5th oe density")), "5th oe density"))
def checkFields(self): self.number_of_rays = congruence.checkPositiveNumber(self.number_of_rays, "Number of rays") self.seed = congruence.checkPositiveNumber(self.seed, "Seed") self.e_min = congruence.checkPositiveNumber(self.e_min, "Minimum energy") self.e_max = congruence.checkPositiveNumber(self.e_max, "Maximum energy") congruence.checkLessThan(self.e_min, self.e_max, "Minimum energy", "Maximum energy") self.sigma_x = congruence.checkPositiveNumber(self.sigma_x, "Sigma x") self.sigma_z = congruence.checkPositiveNumber(self.sigma_z, "Sigma z") self.emittance_x = congruence.checkPositiveNumber(self.emittance_x, "Emittance x") self.emittance_z = congruence.checkPositiveNumber(self.emittance_z, "Emittance z") self.distance_from_waist_x = congruence.checkPositiveNumber(self.distance_from_waist_x, "Distance from waist x") self.distance_from_waist_z = congruence.checkPositiveNumber(self.distance_from_waist_z, "Distance from waist z") self.energy = congruence.checkPositiveNumber(self.energy, "Energy") self.magnetic_radius = congruence.checkPositiveNumber(self.magnetic_radius, "Magnetic radius") self.horizontal_half_divergence_from = congruence.checkPositiveNumber(self.horizontal_half_divergence_from, "Horizontal half-divergence from [+]") self.horizontal_half_divergence_to = congruence.checkPositiveNumber(self.horizontal_half_divergence_to, "Horizontal half-divergence to [-]") self.max_vertical_half_divergence_from = congruence.checkPositiveNumber(self.max_vertical_half_divergence_from, "Max vertical half-divergence from [+]") self.max_vertical_half_divergence_to = congruence.checkPositiveNumber(self.max_vertical_half_divergence_to, "Max vertical half-divergence to [-]") if self.optimize_source > 0: self.max_number_of_rejected_rays = congruence.checkPositiveNumber(self.max_number_of_rejected_rays, "Max number of rejected rays") congruence.checkFile(self.optimize_file_name)