def get_simulation(): """ Return a GISAXS simulation with defined beam """ simulation = ba.GISASSimulation() simulation.setBeamParameters(10 * angstrom, 0.2 * deg, 0.0 * deg) return simulation
def getSimulation(): simulation = ba.GISASSimulation() simulation.setDetectorParameters(200, -1.0 * deg, 1.0 * deg, 200, 0.0 * deg, 2.0 * deg) simulation.setBeamParameters(0.154 * nm, 0.2 * deg, 0.0 * deg) simulation.setBeamIntensity(1.0e+08) return simulation
def runSimulation(): # defining materials mAmbience = ba.HomogeneousMaterial("Air", 0.0, 0.0) mSubstrate = ba.HomogeneousMaterial("Substrate", 6e-6, 2e-8) magnetic_field = ba.kvector_t(0, 0, 0) magParticle = ba.HomogeneousMaterial("magParticle", 6e-4, 2e-8, magnetic_field ) # collection of particles cylinder_ff = ba.FormFactorCylinder(5*nanometer, 5*nanometer) cylinder = ba.Particle(magParticle, cylinder_ff) particle_layout = ba.ParticleLayout() particle_layout.addParticle(cylinder, 1.0) interference = ba.InterferenceFunctionNone() particle_layout.setInterferenceFunction(interference) # air layer with particles and substrate form multi layer air_layer = ba.Layer(mAmbience) air_layer.addLayout(particle_layout) substrate_layer = ba.Layer(mSubstrate, 0) multi_layer = ba.MultiLayer() multi_layer.addLayer(air_layer) multi_layer.addLayer(substrate_layer) # build and run experiment simulation = ba.GISASSimulation() simulation.setDetectorParameters(100, 0*degree, 2.0*degree, 100, 0.0*degree, 2.0*degree) simulation.setBeamParameters(1.0*angstrom, 0.2*degree, 0.0*degree) simulation.setSample(multi_layer) simulation.setBeamIntensity(1e2) simulation.runSimulation() ## intensity data return simulation.result()
def get_simulation_BasicGISAS(sample=None): simulation = ba.GISASSimulation() simulation.setDetectorParameters(100, 0.0 * deg, 2.0 * deg, 100, 0.0 * deg, 2.0 * deg) simulation.setBeamParameters(1.0 * angstrom, 0.2 * deg, 0.0 * deg) if sample: simulation.setSample(sample) return simulation
def test_access_simulation_intensity(self): simulation = ba.GISASSimulation() simulation.setDetectorParameters(10, -1.0, 1.0, 100, 0.0, 2.0) data = simulation.result().histogram2d() self.assertEqual(1000, data.getTotalNumberOfBins()) self.assertEqual(2, data.getRank()) self.assertEqual(0, data.integral()) self.assertEqual(10, data.getXaxis().size())
def create_simulation(): """ Creates and returns GISAS simulation with beam and detector defined """ simulation = ba.GISASSimulation() simulation.setBeamParameters(wavelength, alpha_i, 0.0) simulation.setDetector(create_detector()) return simulation
def get_simulation(): """ Returns a GISAXS simulation with beam defined """ simulation = ba.GISASSimulation() simulation.setBeamParameters(1.0 * angstrom, 0.2 * deg, 0.0 * deg) simulation.setDetector(get_rectangular_detector()) return simulation
def get_simulation(): """ Creates and returns GISAS simulation with beam and detector defined """ simulation = ba.GISASSimulation() simulation.setBeamParameters(wavelength, alpha_i, 0.0) simulation.setDetector(create_detector()) simulation.setRegionOfInterest(xmin, ymin, xmax, ymax) return simulation
def get_simulation(): """ Create and return GISAXS simulation with beam and detector defined """ simulation = ba.GISASSimulation() simulation.setDetectorParameters(200, 0.0 * deg, 2.0 * deg, 200, 0.0 * deg, 2.0 * deg) simulation.setBeamParameters(1.0 * angstrom, 0.2 * deg, 0.0 * deg) return simulation
def get_simulation(): """ Returns a GISAXS simulation. """ simulation = ba.GISASSimulation() simulation.setSample(get_sample()) simulation.setDetectorParameters(200, -1*deg, +1*deg, 200, 0*deg, +2*deg) simulation.setBeamParameters(1.5*angstrom, 0.15*deg, 0.0*deg) return simulation
def get_simulation(): simulation = ba.GISASSimulation() simulation.setDetectorParameters(400, -2.0 * deg, 2.0 * deg, 400, 0.0 * deg, 3.0 * deg) simulation.setBeamParameters(0.1 * nm, 0.2 * deg, 0.0 * deg) simulation.setBeamIntensity(1.0e+08) # simulation.getOptions().setMonteCarloIntegration(True, 20) # if height is large return simulation
def get_simulation(): """ Returns GISAXS simulation with standard beam and detector. """ simulation = ba.GISASSimulation() simulation.setDetectorParameters(100, phi_min * deg, phi_max * deg, 100, alpha_min * deg, alpha_max * deg) simulation.setBeamParameters(1.0 * angstrom, 0.2 * deg, 0.0 * deg) return simulation
def get_simulation(): simulation = ba.GISASSimulation() simulation.setDetectorParameters(200, -3.0 * deg, 3.0 * deg, 200, 0.0 * deg, 6.0 * deg) simulation.setBeamParameters(0.134 * nm, 0.2 * deg, 0.0 * deg) simulation.setBeamIntensity(1.0e+08) simulation.setTerminalProgressMonitor() return simulation
def get_simulation(): """ Returns a GISAXS simulation with beam and detector defined. """ simulation = ba.GISASSimulation() simulation.setDetectorParameters(100, -1.0 * deg, 1.0 * deg, 100, 0.0 * deg, 2.0 * deg) simulation.setBeamParameters(1.0 * angstrom, 0.2 * deg, 0.0 * deg) return simulation
def get_simulation(): """ characterizing the input beam and output detector """ simulation = ba.GISASSimulation() simulation.setDetectorParameters(100, -1.5 * deg, 1.5 * deg, 100, 0.0 * deg, 2.5 * deg) simulation.setBeamParameters(1.6 * angstrom, 0.3 * deg, 0.0 * deg) return simulation
def get_simulation(incident_alpha=0.2): """ Returns a GISAXS simulation with beam and detector defined. """ simulation = ba.GISASSimulation() simulation.setDetectorParameters(50, -1.5*deg, 1.5*deg, 50, 0.0*deg, 2.0*deg) simulation.setBeamParameters(1.0*angstrom, incident_alpha, 0.0*deg) return simulation
def get_simulation(): simulation = ba.GISASSimulation() simulation.setDetectorParameters(400, -2.0 * deg, 2.0 * deg, 400, 0.0 * deg, 3.0 * deg) simulation.setBeamParameters(0.1 * nm, 0.2 * deg, 0.0 * deg) simulation.setBeamIntensity(1.0e+06) # simulation.getOptions().setMonteCarloIntegration(True, 20) # uncomment for large mesocrystals simulation.setTerminalProgressMonitor() return simulation
def get_simulation(): """ Returns a GISAXS simulation with beam and detector defined """ simulation = ba.GISASSimulation() simulation.setDetectorParameters(100, -2.0 * deg, 2.0 * deg, 100, 0.0 * deg, 2.0 * deg) simulation.setBeamParameters(1.0 * angstrom, 0.2 * deg, 0.0 * deg) simulation.getOptions().setUseAvgMaterials(True) return simulation
def get_simulation(wl=5.0, alpha_i=ai): """ Returns a GISAS simulation with beam and detector defined """ simulation = ba.GISASSimulation() simulation.setBeamParameters(wl * ba.angstrom, alpha_i * ba.deg, 0.0 * ba.deg) simulation.setDetector(create_detector()) simulation.setBeamIntensity(beam_intensity) return simulation
def get_simulation(): """ Characterizing the input beam and output detector """ simulation = ba.GISASSimulation() simulation.setDetectorParameters(200, -0.5*deg, 0.5*deg, 200, 0.0*deg, 1.0*deg) simulation.setBeamParameters(1.0*angstrom, 0.2*deg, 0.0*deg) simulation.setBeamIntensity(5e11) return simulation
def get_simulation(): """ Returns a GISAXS simulation with beam and detector defined. """ simulation = ba.GISASSimulation() # coarse grid because this simulation takes rather long simulation.setDetectorParameters(200, -2.0 * deg, 2.0 * deg, 200, 0.0 * deg, 2.0 * deg) simulation.setBeamParameters(1.0 * angstrom, 0.2 * deg, 0.0 * deg) return simulation
def get_simulation(): """ Create and return GISAXS simulation with beam and detector defined """ simulation = ba.GISASSimulation() simulation.setDetectorParameters(200, -1.0*deg, 1.0*deg, 200, 0.0*deg, 2.0*deg) simulation.setBeamParameters(1.0*angstrom, 0.2*deg, 0.0*deg) simulation.getOptions().setMonteCarloIntegration(True, 100) return simulation
def get_simulation(): """ Returns a GISAXS simulation with beam and detector defined. """ simulation = ba.GISASSimulation() simulation.setDetectorParameters(201, -2.0*deg, 2.0*deg, 201, 0.0*deg, 2.0*deg) simulation.setBeamParameters(1.0*angstrom, 0.2*deg, 0.0*deg) simulation.setBeamIntensity(1e+05) return simulation
def get_simulation(l, ai, phi): """ Returns a GISAXS simulation with beam and detector defined. """ simulation = ba.GISASSimulation() simulation.setDetectorParameters(100, 85.0 * deg, 95.0 * deg, 50, 0.0 * deg, 1.0 * deg) simulation.setBeamParameters(l * angstrom, ai * deg, phi * deg) simulation.getOptions().setIncludeSpecular(True) return simulation
def get_simulation(): """ Returns a GISAXS simulation with detector resolution function defined. """ simulation = ba.GISASSimulation() simulation.setDetectorParameters(100, 0.0*deg, 2.0*deg, 100, 0.0*deg, 2.0*deg) simulation.setBeamParameters(1.0*angstrom, 0.2*deg, 0.0*deg) simulation.setDetectorResolutionFunction( ba.ResolutionFunction2DGaussian(0.02*deg, 0.02*deg)) return simulation
def get_simulation(params): """ Returns a GISAXS simulation with beam and detector defined """ simulation = ba.GISASSimulation() simulation.setDetectorParameters(100, -1.0 * deg, 1.0 * deg, 100, 0.0 * deg, 2.0 * deg) simulation.setBeamParameters(1.0 * angstrom, 0.2 * deg, 0.0 * deg) simulation.setBeamIntensity(1e+08) simulation.setSample(get_sample(params)) return simulation
def get_simulation(params): # function which defines the GISAXS simulation simulation = ba.GISASSimulation() detector = ba.RectangularDetector(981, 168.732, 1043, 179.396) # creates the Pilatus detector detector.setPerpendicularToDirectBeam( 2385.807, 89.522, 21.83) # adds the SDD and DB position to the detector simulation.setDetector(detector) # adds the detector to the simulation simulation.setBeamParameters( 0.095373 * nm, 0.378 * deg, 0.0 * deg) # adds the beam parameters to the simulation beam_intensity = params["beam_intensity"] simulation.setBeamIntensity(beam_intensity) #simulation.setBackground(ba.PoissonNoiseBackground()) simulation.setSample( get_sample(params)) # adds the sample to the simulation #print(simulation.treeToString()) print(simulation.parametersToString()) simulation.getOptions().setIncludeSpecular(False) simulation.getOptions().setUseAvgMaterials( True) # enables the graded interfaces formalism #simulation.getOptions().setMonteCarloIntegration(False, 50) simulation.setRegionOfInterest(85, 38, 164, 143) # Masks for full fitting procedure: #simulation.addMask(ba.Rectangle(83.696, 36.530, 84.951 , 106.469), True) #simulation.addMask(ba.Rectangle(3.732, 70.213, 154.232, 73.011), True) #simulation.addMask(ba.Ellipse(59.501, 48.764, 0.239, 0.181), True) #simulation.addMask(ba.Ellipse(79.088, 54.814, 3.132, 3.338), True) #simulation.addMask(ba.Ellipse(90.57, 105.700, 0.167, 0.191), True) #simulation.addMask(ba.Polygon([76.29, 76.88, 7.59, 5.51],[56.26, 57.17, 106.48, 106.53]), True) # Size distribution: #n_samples = 20 #R = params["radius"] #R_stdev = 0.2*R #R_min = 0.1*R #R_max = 2*R #sigma_par = 2.0*nm #radius_distr = ba.DistributionGaussian(R, R_stdev) #simulation.addParameterDistribution("*/Radius", radius_distr, n_samples, sigma_par, ba.RealLimits.limited(R_min, R_max)) simulation.setTerminalProgressMonitor() return simulation
def get_simulation(det): """Create and return GISAXS simulation with beam and detector defined :param det: Detector limits """ simulation = ba.GISASSimulation() simulation.setDetectorParameters(det.phi.n, det.phi.vmin * degree, det.phi.vmax * degree, det.alpha.n, det.alpha.vmin * degree, det.alpha.vmax * degree) simulation.setBeamParameters(1.0 * angstrom, 0, 0) return simulation
def getSimulation(): simulation = ba.GISASSimulation() simulation.setDetectorParameters(200, -2.0 * deg, 2.0 * deg, 200, 0.0 * deg, 2.0 * deg) simulation.setBeamParameters(0.154 * nm, 0.2 * deg, 0.0 * deg) simulation.setBeamIntensity(1.0e+08) distribution_1 = ba.DistributionGaussian(0.00349065850399, 0.00174532925199) simulation.addParameterDistribution("*/Beam/InclinationAngle", distribution_1, 10, 2.0) return simulation
def get_simulation(): """ Returns a GISAXS simulation with a constant backround. """ simulation = ba.GISASSimulation() simulation.setDetectorParameters(100, 0.0*deg, 2.0*deg, 100, 0.0*deg, 2.0*deg) simulation.setBeamParameters(1.0*angstrom, 0.2*deg, 0.0*deg) simulation.setBeamIntensity(1e6) bg = ba.ConstantBackground(1e3) simulation.setBackground(bg) return simulation