diff --git a/Doc/FFCatalog/fig/ff2/bornplot.py b/Doc/FFCatalog/fig/ff2/bornplot.py index 356827029fb6f216677af7f4645bd7bfc5cdbf75..27f3c1838a1db6aaa0e14c3e2cbfcd0d760c04eb 100644 --- a/Doc/FFCatalog/fig/ff2/bornplot.py +++ b/Doc/FFCatalog/fig/ff2/bornplot.py @@ -106,7 +106,7 @@ def get_sample(ff, trafo): :param trafo: Optional rotation """ # defining materials - m_vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + m_vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) m_particle = ba.HomogeneousMaterial("Particle", 1e-5, 0) # collection of particles diff --git a/Doc/FFCatalog/fig/ff2/sim_AnisoPyramid.py b/Doc/FFCatalog/fig/ff2/sim_AnisoPyramid.py index f1baef7034176d89e478ea3babf8cb6dfa66faed..c3919243d8c5c016200b1ff33f39a00dbaa4af94 100755 --- a/Doc/FFCatalog/fig/ff2/sim_AnisoPyramid.py +++ b/Doc/FFCatalog/fig/ff2/sim_AnisoPyramid.py @@ -12,7 +12,7 @@ results = [] for i in range(n): omega = 90*i/(n - 1) title = r'$\omega=%d^\circ$' % omega - ff = ba.FormFactorAnisoPyramid(13*nm, 8*nm, 4.2*nm, 60.0*deg) + ff = ba.FormFactorAnisoPyramid(13*nm, 8*nm, 4.2*nm, 60*deg) trafo = ba.RotationZ(omega*deg) data = bp.run_simulation(det, ff, trafo) results.append(bp.Result(i, data, title)) diff --git a/Doc/FFCatalog/fig/ff2/sim_Cuboctahedron.py b/Doc/FFCatalog/fig/ff2/sim_Cuboctahedron.py index dfa4e41843f8f1be245404eddfc4c17b8a70ee86..1f6fe68f77a45ab1f21a9bc5b0e21202ed0cac12 100755 --- a/Doc/FFCatalog/fig/ff2/sim_Cuboctahedron.py +++ b/Doc/FFCatalog/fig/ff2/sim_Cuboctahedron.py @@ -12,7 +12,7 @@ results = [] for i in range(n): omega = 45*i/(n - 1) title = r'$\omega=%d^\circ$' % omega - ff = ba.FormFactorCuboctahedron(8*nm, 5*nm, 0.5, 60.0*deg) + ff = ba.FormFactorCuboctahedron(8*nm, 5*nm, 0.5, 60*deg) trafo = ba.RotationZ(omega*deg) data = bp.run_simulation(det, ff, trafo) results.append(bp.Result(i, data, title)) diff --git a/Doc/FFCatalog/fig/ff2/sim_Pyramid.py b/Doc/FFCatalog/fig/ff2/sim_Pyramid.py index af80e4661d68854e41613ac41fb47f2e082f30f0..2836ba9fe551107be214bcdb65d6972bac6b3a65 100755 --- a/Doc/FFCatalog/fig/ff2/sim_Pyramid.py +++ b/Doc/FFCatalog/fig/ff2/sim_Pyramid.py @@ -12,7 +12,7 @@ results = [] for i in range(n): omega = 45*i/(n - 1) title = r'$\omega=%d^\circ$' % omega - ff = ba.FormFactorPyramid(10*nm, 4.2*nm, 60.0*deg) + ff = ba.FormFactorPyramid(10*nm, 4.2*nm, 60*deg) trafo = ba.RotationZ(omega*deg) data = bp.run_simulation(det, ff, trafo) results.append(bp.Result(i, data, title)) diff --git a/Examples/fit51_Basic/basic_fitting_tutorial.py b/Examples/fit51_Basic/basic_fitting_tutorial.py index f87b6f6cc0a6f640d87fca131e63d6a14ea1919b..a9929dda19e2891b1c1da7376b720de219622145 100644 --- a/Examples/fit51_Basic/basic_fitting_tutorial.py +++ b/Examples/fit51_Basic/basic_fitting_tutorial.py @@ -20,7 +20,7 @@ def get_sample(params): prism_base_edge = params["prism_base_edge"] # defining materials - m_vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + m_vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) m_substrate = ba.HomogeneousMaterial("Substrate", 6e-6, 2e-8) m_particle = ba.HomogeneousMaterial("Particle", 6e-4, 2e-8) @@ -48,9 +48,9 @@ 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.setDetectorParameters(100, -1*deg, 1*deg, 100, 0*deg, + 2*deg) + simulation.setBeamParameters(1*angstrom, 0.2*deg, 0*deg) simulation.beam().setIntensity(1e+08) simulation.setSample(get_sample(params)) return simulation @@ -64,10 +64,10 @@ def create_real_data(): # default sample parameters params = { - 'cylinder_height': 5.0*nm, - 'cylinder_radius': 5.0*nm, - 'prism_height': 5.0*nm, - 'prism_base_edge': 5.0*nm + 'cylinder_height': 5*nm, + 'cylinder_radius': 5*nm, + 'prism_height': 5*nm, + 'prism_base_edge': 5*nm } # retrieving simulated data in the form of numpy array diff --git a/Examples/fit51_Basic/consecutive_fitting.py b/Examples/fit51_Basic/consecutive_fitting.py index 8b6a79b248b1781130fb22dc37246ec0d6a1e783..42602822eb21d7a2c01f82f7ab4fa9dacf8ba982 100644 --- a/Examples/fit51_Basic/consecutive_fitting.py +++ b/Examples/fit51_Basic/consecutive_fitting.py @@ -20,7 +20,7 @@ def get_sample(params): radius = params["radius"] height = params["height"] - m_vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + m_vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) m_substrate = ba.HomogeneousMaterial("Substrate", 6e-6, 2e-8) m_particle = ba.HomogeneousMaterial("Particle", 6e-4, 2e-8) @@ -45,9 +45,9 @@ def get_simulation(params): Returns a GISAXS simulation with beam and detector 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.setDetectorParameters(100, 0*deg, 2*deg, 100, 0*deg, + 2*deg) + simulation.setBeamParameters(1*angstrom, 0.2*deg, 0*deg) simulation.beam().setIntensity(1e+08) simulation.setSample(get_sample(params)) return simulation @@ -57,7 +57,7 @@ def create_real_data(): """ Generating "real" data by adding noise to the simulated data. """ - params = {'radius': 5.0*nm, 'height': 5.0*nm} + params = {'radius': 5*nm, 'height': 5*nm} simulation = get_simulation(params) simulation.runSimulation() @@ -79,7 +79,7 @@ def run_fitting(): real_data = create_real_data() fit_objective = ba.FitObjective() - fit_objective.addSimulationAndData(get_simulation, real_data, 1.0) + fit_objective.addSimulationAndData(get_simulation, real_data, 1) fit_objective.initPrint(10) fit_objective.initPlot(10) """ @@ -88,8 +88,8 @@ def run_fitting(): to puzzle our minimizer's as much as possible. """ params = ba.Parameters() - params.add("height", 1.*nm, min=0.01, max=30.0, step=0.05*nm) - params.add("radius", 20.*nm, min=0.01, max=30.0, step=0.05*nm) + params.add("height", 1.*nm, min=0.01, max=30, step=0.05*nm) + params.add("radius", 20.*nm, min=0.01, max=30, step=0.05*nm) """ Now we run first minimization round using the Genetic minimizer. The Genetic minimizer is able to explore large parameter space diff --git a/Examples/fit51_Basic/minimal_fit_example.py b/Examples/fit51_Basic/minimal_fit_example.py index 4cac7fe64a2a24c085f41de3f0f56c2ad92eae82..c4d26c6cad4a1f238b68912be72843a9599accb9 100644 --- a/Examples/fit51_Basic/minimal_fit_example.py +++ b/Examples/fit51_Basic/minimal_fit_example.py @@ -15,15 +15,15 @@ def get_simulation(params): sphere = ba.Particle(ba.HomogeneousMaterial("Particle", 6e-4, 2e-8), ba.FormFactorFullSphere(radius)) - layer = ba.Layer(ba.HomogeneousMaterial("Vacuum", 0.0, 0.0)) + layer = ba.Layer(ba.HomogeneousMaterial("Vacuum", 0, 0)) layer.addLayout(ba.ParticleLayout(sphere)) multi_layer = ba.MultiLayer() multi_layer.addLayer(layer) 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.setDetectorParameters(100, -1*deg, 1*deg, 100, 0*deg, + 2*deg) + simulation.setBeamParameters(1*angstrom, 0.2*deg, 0*deg) simulation.setSample(multi_layer) return simulation @@ -33,7 +33,7 @@ def real_data(): """ Generating "experimental" data by running simulation with default parameters. """ - simulation = get_simulation({'radius': 5.0*nm}) + simulation = get_simulation({'radius': 5*nm}) simulation.runSimulation() return simulation.result().array() diff --git a/Examples/fit51_Basic/minimizer_settings.py b/Examples/fit51_Basic/minimizer_settings.py index 469cd26e36b1a4f1d8cb84725ac657ee0a7943b9..3ed3fdd051ba10765ab5b8e9cf7934ab5670e86d 100644 --- a/Examples/fit51_Basic/minimizer_settings.py +++ b/Examples/fit51_Basic/minimizer_settings.py @@ -16,7 +16,7 @@ def get_sample(params): prism_base_edge = params["prism_base_edge"] # defining materials - m_vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + m_vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) m_substrate = ba.HomogeneousMaterial("Substrate", 6e-6, 2e-8) m_particle = ba.HomogeneousMaterial("Particle", 6e-4, 2e-8) @@ -46,9 +46,9 @@ 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.setDetectorParameters(100, -1*deg, 1*deg, 100, 0*deg, + 2*deg) + simulation.setBeamParameters(1*angstrom, 0.2*deg, 0*deg) simulation.beam().setIntensity(1e+08) simulation.setSample(get_sample(params)) return simulation @@ -60,10 +60,10 @@ def create_real_data(): """ params = { - 'cylinder_height': 5.0*nm, - 'cylinder_radius': 5.0*nm, - 'prism_height': 5.0*nm, - 'prism_base_edge': 5.0*nm + 'cylinder_height': 5*nm, + 'cylinder_radius': 5*nm, + 'prism_height': 5*nm, + 'prism_base_edge': 5*nm } simulation = get_simulation(params) @@ -86,7 +86,7 @@ def run_fitting(): print(ba.MinimizerFactory().catalogDetailsToString()) fit_objective = ba.FitObjective() - fit_objective.addSimulationAndData(get_simulation, real_data, 1.0) + fit_objective.addSimulationAndData(get_simulation, real_data, 1) fit_objective.initPrint(10) params = ba.Parameters() diff --git a/Examples/fit52_Advanced/find_background.py b/Examples/fit52_Advanced/find_background.py index 5b32f9d604aca2e0aef1dabe118ebb52b8c80591..d1fecc2f91dac3cc2e2fd330435008adaf546296 100644 --- a/Examples/fit52_Advanced/find_background.py +++ b/Examples/fit52_Advanced/find_background.py @@ -20,7 +20,7 @@ def get_sample(params): radius = params["radius"] height = params["height"] - m_vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + m_vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) m_substrate = ba.HomogeneousMaterial("Substrate", 6e-6, 2e-8) m_particle = ba.HomogeneousMaterial("Particle", 6e-4, 2e-8) @@ -48,9 +48,9 @@ def get_simulation(params): scale = params["scale"] 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.setDetectorParameters(100, -1*deg, 1*deg, 100, 0*deg, + 2*deg) + simulation.setBeamParameters(1*angstrom, 0.2*deg, 0*deg) simulation.beam().setIntensity(1e12*scale) simulation.setBackground(ba.ConstantBackground(background)) simulation.setSample(get_sample(params)) @@ -68,9 +68,9 @@ def create_real_data(): """ params = { - 'radius': 5.0*nm, - 'height': 10.0*nm, - 'scale': 2.0, + 'radius': 5*nm, + 'height': 10*nm, + 'scale': 2, 'background': 1000 } @@ -88,7 +88,7 @@ def run_fitting(): real_data = create_real_data() fit_objective = ba.FitObjective() - fit_objective.addSimulationAndData(get_simulation, real_data, 1.0) + fit_objective.addSimulationAndData(get_simulation, real_data, 1) fit_objective.initPrint(10) fit_objective.initPlot(10) @@ -96,8 +96,8 @@ def run_fitting(): params = ba.Parameters() params.add("radius", 5.*nm, vary=False) params.add("height", 9.*nm, min=8.*nm, max=12.*nm) - params.add("scale", 1.5, min=1.0, max=3.0) - params.add("background", 200, min=100.0, max=2000.0, step=100.0) + params.add("scale", 1.5, min=1, max=3) + params.add("background", 200, min=100, max=2000, step=100) minimizer = ba.Minimizer() result = minimizer.minimize(fit_objective.evaluate, params) diff --git a/Examples/fit52_Advanced/fit_along_slices.py b/Examples/fit52_Advanced/fit_along_slices.py index bd8d595d331ea7789d82e62b6bbdb0c9e5565fca..ceabd0f0140282140dc9c88fc6ab9d01207ac3f8 100644 --- a/Examples/fit52_Advanced/fit_along_slices.py +++ b/Examples/fit52_Advanced/fit_along_slices.py @@ -18,7 +18,7 @@ def get_sample(params): radius = params["radius"] height = params["height"] - m_vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + m_vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) m_substrate = ba.HomogeneousMaterial("Substrate", 6e-6, 2e-8) m_particle = ba.HomogeneousMaterial("Particle", 6e-4, 2e-8) @@ -43,9 +43,9 @@ def get_simulation(params, add_masks=True): Create and return 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.setDetectorParameters(100, -1*deg, 1*deg, 100, 0*deg, + 2*deg) + simulation.setBeamParameters(1*angstrom, 0.2*deg, 0*deg) simulation.beam().setIntensity(1e+08) simulation.setSample(get_sample(params)) if add_masks: @@ -65,7 +65,7 @@ def create_real_data(): Generating "real" data by adding noise to the simulated data. """ # initial values which we will have to find later during the fit - params = {'radius': 5.0*nm, 'height': 10.0*nm} + params = {'radius': 5*nm, 'height': 10*nm} # retrieving simulated data in the form of numpy array simulation = get_simulation(params, add_masks=False) @@ -117,7 +117,7 @@ class PlotObserver: for label, slice in slices: plt.semilogy(slice.binCenters(), slice.binValues(), label=label) plt.xlim(slice.getXmin(), slice.getXmax()) - plt.ylim(1.0, slice.getMaximum()*10.0) + plt.ylim(1, slice.getMaximum()*10) plt.legend(loc='upper right') plt.title(title) @@ -185,7 +185,7 @@ def run_fitting(): real_data = create_real_data() fit_objective = ba.FitObjective() - fit_objective.addSimulationAndData(get_simulation, real_data, 1.0) + fit_objective.addSimulationAndData(get_simulation, real_data, 1) fit_objective.initPrint(10) # creating custom observer which will draw fit progress @@ -193,8 +193,8 @@ def run_fitting(): fit_objective.initPlot(10, plotter) params = ba.Parameters() - params.add("radius", 6.*nm, min=4.0, max=8.0) - params.add("height", 9.*nm, min=8.0, max=12.0) + params.add("radius", 6.*nm, min=4, max=8) + params.add("height", 9.*nm, min=8, max=12) minimizer = ba.Minimizer() result = minimizer.minimize(fit_objective.evaluate, params) diff --git a/Examples/fit52_Advanced/fit_with_masks.py b/Examples/fit52_Advanced/fit_with_masks.py index eae6aeaa3824f11773fdd484f61d8489541310e4..fafea2655a8e7a0170cd4b7bfbfed6ca24d2ddbf 100644 --- a/Examples/fit52_Advanced/fit_with_masks.py +++ b/Examples/fit52_Advanced/fit_with_masks.py @@ -17,7 +17,7 @@ def get_sample(params): radius = params["radius"] height = params["height"] - m_vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + m_vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) m_substrate = ba.HomogeneousMaterial("Substrate", 6e-6, 2e-8) m_particle = ba.HomogeneousMaterial("Particle", 6e-4, 2e-8) @@ -42,9 +42,9 @@ def get_simulation(params, add_masks=True): Create and return 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.setDetectorParameters(100, -1*deg, 1*deg, 100, 0*deg, + 2*deg) + simulation.setBeamParameters(1*angstrom, 0.2*deg, 0*deg) simulation.beam().setIntensity(1e+08) simulation.setSample(get_sample(params)) @@ -58,7 +58,7 @@ def create_real_data(): """ Generating "real" data by adding noise to the simulated data. """ - params = {'radius': 5.0*nm, 'height': 10.0*nm} + params = {'radius': 5*nm, 'height': 10*nm} # retrieving simulated data in the form of numpy array simulation = get_simulation(params, add_masks=False) @@ -90,14 +90,14 @@ def add_mask_to_simulation(simulation): simulation.maskAll() # set mask to simulate pacman's head - simulation.addMask(ba.Ellipse(0.0*deg, 1.0*deg, 0.5*deg, 0.5*deg), False) + simulation.addMask(ba.Ellipse(0*deg, 1*deg, 0.5*deg, 0.5*deg), False) # set mask for pacman's eye simulation.addMask(ba.Ellipse(0.11*deg, 1.25*deg, 0.05*deg, 0.05*deg), True) # set mask for pacman's mouth - points = [[0.0*deg, 1.0*deg], [0.5*deg, 1.2*deg], [0.5*deg, 0.8*deg], - [0.0*deg, 1.0*deg]] + points = [[0*deg, 1*deg], [0.5*deg, 1.2*deg], [0.5*deg, 0.8*deg], + [0*deg, 1*deg]] simulation.addMask(ba.Polygon(points), True) # giving pacman something to eat @@ -116,13 +116,13 @@ def run_fitting(): real_data = create_real_data() fit_objective = ba.FitObjective() - fit_objective.addSimulationAndData(get_simulation, real_data, 1.0) + fit_objective.addSimulationAndData(get_simulation, real_data, 1) fit_objective.initPrint(10) fit_objective.initPlot(10) params = ba.Parameters() - params.add("radius", 6.*nm, min=4.0, max=8.0) - params.add("height", 9.*nm, min=8.0, max=12.0) + params.add("radius", 6.*nm, min=4, max=8) + params.add("height", 9.*nm, min=8, max=12) minimizer = ba.Minimizer() result = minimizer.minimize(fit_objective.evaluate, params) diff --git a/Examples/fit52_Advanced/multiple_datasets.py b/Examples/fit52_Advanced/multiple_datasets.py index de24da26ecf3ab88bb83c4d6f4faf2a6057323d4..7c107d699004ec74261cf3249c9f238a414c50d6 100644 --- a/Examples/fit52_Advanced/multiple_datasets.py +++ b/Examples/fit52_Advanced/multiple_datasets.py @@ -18,7 +18,7 @@ def get_sample(params): radius_b = params["radius_b"] height = params["height"] - m_vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + m_vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) m_substrate = ba.HomogeneousMaterial("Substrate", 6e-6, 2e-8) m_particle = ba.HomogeneousMaterial("Particle", 6e-4, 2e-8) @@ -45,9 +45,9 @@ def get_simulation(params): incident_angle = params["incident_angle"] 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_angle, 0.0*deg) + simulation.setDetectorParameters(50, -1.5*deg, 1.5*deg, 50, 0*deg, + 2*deg) + simulation.setBeamParameters(1*angstrom, incident_angle, 0*deg) simulation.beam().setIntensity(1e+08) simulation.setSample(get_sample(params)) return simulation @@ -68,9 +68,9 @@ def create_real_data(incident_alpha): Generating "real" data by adding noise to the simulated data. """ params = { - 'radius_a': 5.0*nm, - 'radius_b': 6.0*nm, - 'height': 8.0*nm, + 'radius_a': 5*nm, + 'radius_b': 6*nm, + 'height': 8*nm, "incident_angle": incident_alpha } @@ -111,20 +111,20 @@ class PlotObserver(): plt.subplot(canvas[i_dataset*3]) ba.plot_colormap(real_data, title="\"Real\" data - #" + str(i_dataset + 1), - zmin=1.0, + zmin=1, zmax=zmax, zlabel="") plt.subplot(canvas[1 + i_dataset*3]) ba.plot_colormap(simul_data, title="Simulated data - #" + str(i_dataset + 1), - zmin=1.0, + zmin=1, zmax=zmax, zlabel="") plt.subplot(canvas[2 + i_dataset*3]) ba.plot_colormap(chi2_map, title="Chi2 map - #" + str(i_dataset + 1), zmin=0.001, - zmax=10.0, + zmax=10, zlabel="") @staticmethod @@ -192,8 +192,8 @@ def run_fitting(): data2 = create_real_data(0.4*deg) fit_objective = ba.FitObjective() - fit_objective.addSimulationAndData(simulation1, data1, 1.0) - fit_objective.addSimulationAndData(simulation2, data2, 1.0) + fit_objective.addSimulationAndData(simulation1, data1, 1) + fit_objective.addSimulationAndData(simulation2, data2, 1) fit_objective.initPrint(10) # creating custom observer which will draw fit progress @@ -201,9 +201,9 @@ def run_fitting(): fit_objective.initPlot(10, plotter.update) params = ba.Parameters() - params.add("radius_a", 4.*nm, min=2.0, max=10.0) + params.add("radius_a", 4.*nm, min=2, max=10) params.add("radius_b", 6.*nm, vary=False) - params.add("height", 4.*nm, min=2.0, max=10.0) + params.add("height", 4.*nm, min=2, max=10) minimizer = ba.Minimizer() result = minimizer.minimize(fit_objective.evaluate, params) diff --git a/Examples/fit53_CustomObjective/custom_objective_function.py b/Examples/fit53_CustomObjective/custom_objective_function.py index 1690de82ffa49a72d390d9b5b71b3c58083e39e5..5843a202705166c2a2dc604aae165e245671ad72 100644 --- a/Examples/fit53_CustomObjective/custom_objective_function.py +++ b/Examples/fit53_CustomObjective/custom_objective_function.py @@ -43,7 +43,7 @@ def get_sample(params): radius = params['radius'] lattice_length = params['length'] - m_vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + m_vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) m_substrate = ba.HomogeneousMaterial("Substrate", 6e-6, 2e-8) m_particle = ba.HomogeneousMaterial("Particle", 6e-4, 2e-8) @@ -73,9 +73,9 @@ def get_simulation(params): Create and return 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.setDetectorParameters(100, -1*deg, 1*deg, 100, 0*deg, + 2*deg) + simulation.setBeamParameters(1*angstrom, 0.2*deg, 0*deg) simulation.beam().setIntensity(1e+08) simulation.setSample(get_sample(params)) return simulation @@ -107,7 +107,7 @@ def run_fitting(): real_data = create_real_data() objective = MyObjective() - objective.addSimulationAndData(get_simulation, real_data, 1.0) + objective.addSimulationAndData(get_simulation, real_data, 1) objective.initPrint(10) params = ba.Parameters() diff --git a/Examples/fit54_ExternalMinimizer/lmfit_basics.py b/Examples/fit54_ExternalMinimizer/lmfit_basics.py index 2cc226890c9a8b084a8b921c6922020df0302801..d67b8899e09bc6df0c8cc1d02f8d1b53460224fa 100644 --- a/Examples/fit54_ExternalMinimizer/lmfit_basics.py +++ b/Examples/fit54_ExternalMinimizer/lmfit_basics.py @@ -17,7 +17,7 @@ def get_sample(params): radius = params['radius'] lattice_length = params['length'] - m_vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + m_vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) m_substrate = ba.HomogeneousMaterial("Substrate", 6e-6, 2e-8) m_particle = ba.HomogeneousMaterial("Particle", 6e-4, 2e-8) @@ -47,9 +47,9 @@ def get_simulation(params): Create and return 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.setDetectorParameters(100, -1*deg, 1*deg, 100, 0*deg, + 2*deg) + simulation.setBeamParameters(1*angstrom, 0.2*deg, 0*deg) simulation.beam().setIntensity(1e+08) simulation.setSample(get_sample(params)) return simulation @@ -81,7 +81,7 @@ def run_fitting(): real_data = create_real_data() fit_objective = ba.FitObjective() - fit_objective.addSimulationAndData(get_simulation, real_data, 1.0) + fit_objective.addSimulationAndData(get_simulation, real_data, 1) fit_objective.initPrint(10) params = lmfit.Parameters() diff --git a/Examples/fit54_ExternalMinimizer/lmfit_with_plotting.py b/Examples/fit54_ExternalMinimizer/lmfit_with_plotting.py index c8414a9b13db8c4469176ede1a25768a6f415417..ca5b4545534f32bd01e55305cb17ef3210b2529f 100644 --- a/Examples/fit54_ExternalMinimizer/lmfit_with_plotting.py +++ b/Examples/fit54_ExternalMinimizer/lmfit_with_plotting.py @@ -18,7 +18,7 @@ def get_sample(params): radius = params['radius'] lattice_length = params['length'] - m_vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + m_vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) m_substrate = ba.HomogeneousMaterial("Substrate", 6e-6, 2e-8) m_particle = ba.HomogeneousMaterial("Particle", 6e-4, 2e-8) @@ -48,9 +48,9 @@ def get_simulation(params): Create and return 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.setDetectorParameters(100, -1*deg, 1*deg, 100, 0*deg, + 2*deg) + simulation.setBeamParameters(1*angstrom, 0.2*deg, 0*deg) simulation.beam().setIntensity(1e+08) simulation.setSample(get_sample(params)) return simulation @@ -96,7 +96,7 @@ def run_fitting(): real_data = create_real_data() fit_objective = ba.FitObjective() - fit_objective.addSimulationAndData(get_simulation, real_data, 1.0) + fit_objective.addSimulationAndData(get_simulation, real_data, 1) fit_objective.initPrint(10) params = lmfit.Parameters() diff --git a/Examples/fit55_SpecularIntro/FitSpecularBasics.py b/Examples/fit55_SpecularIntro/FitSpecularBasics.py index f914dcbb25d54f86a0bf01011dc682079aad6de1..0d4f94f7e7856359bfa0d704d3b96758c0972fd8 100644 --- a/Examples/fit55_SpecularIntro/FitSpecularBasics.py +++ b/Examples/fit55_SpecularIntro/FitSpecularBasics.py @@ -36,9 +36,9 @@ def get_sample(params): # defining materials m_vacuum = ba.MaterialBySLD() - m_ni = ba.MaterialBySLD("Ni", ni_sld_real, 0.0) - m_ti = ba.MaterialBySLD("Ti", ti_sld_real, 0.0) - m_substrate = ba.MaterialBySLD("SiSubstrate", si_sld_real, 0.0) + m_ni = ba.MaterialBySLD("Ni", ni_sld_real, 0) + m_ti = ba.MaterialBySLD("Ti", ti_sld_real, 0) + m_substrate = ba.MaterialBySLD("SiSubstrate", si_sld_real, 0) # vacuum layer and substrate form multi layer vacuum_layer = ba.Layer(m_vacuum) @@ -110,7 +110,7 @@ def run_fitting(): real_data = get_real_data_values() fit_objective = ba.FitObjective() - fit_objective.addSimulationAndData(get_simulation, real_data, 1.0) + fit_objective.addSimulationAndData(get_simulation, real_data, 1) plot_observer = ba_fitmonitor.PlotterSpecular() fit_objective.initPrint(10) diff --git a/Examples/fit55_SpecularIntro/FitWithUncertainties.py b/Examples/fit55_SpecularIntro/FitWithUncertainties.py index 416685355b4d53bde4fc0b73d0717c9c484fed6f..4d3142f2752bc415da01d1c16cea2e31f4347324 100644 --- a/Examples/fit55_SpecularIntro/FitWithUncertainties.py +++ b/Examples/fit55_SpecularIntro/FitWithUncertainties.py @@ -40,9 +40,9 @@ def get_sample(params): # defining materials m_vacuum = ba.MaterialBySLD() - m_ni = ba.MaterialBySLD("Ni", ni_sld_real, 0.0) - m_ti = ba.MaterialBySLD("Ti", ti_sld_real, 0.0) - m_substrate = ba.MaterialBySLD("SiSubstrate", si_sld_real, 0.0) + m_ni = ba.MaterialBySLD("Ni", ni_sld_real, 0) + m_ti = ba.MaterialBySLD("Ti", ti_sld_real, 0) + m_substrate = ba.MaterialBySLD("SiSubstrate", si_sld_real, 0) # vacuum layer and substrate form multi layer vacuum_layer = ba.Layer(m_vacuum) diff --git a/Examples/fit55_SpecularIntro/PolarizedSpinAsymmetryFit.py b/Examples/fit55_SpecularIntro/PolarizedSpinAsymmetryFit.py index 5262ea8031c2183254eb0c76f0a3bf3a23a62aa5..4f60c1f3e5a9f4c28940cf32073ff50c995f278d 100644 --- a/Examples/fit55_SpecularIntro/PolarizedSpinAsymmetryFit.py +++ b/Examples/fit55_SpecularIntro/PolarizedSpinAsymmetryFit.py @@ -52,7 +52,7 @@ def get_sample(params): magnetizationMagnitude*numpy.sin(angle*deg), magnetizationMagnitude*numpy.cos(angle*deg), 0) - mat_vacuum = ba.MaterialBySLD("Vacuum", 0.0, 0.0) + mat_vacuum = ba.MaterialBySLD("Vacuum", 0, 0) mat_layer = ba.MaterialBySLD("(Mg,Al,Fe)3O4", params["rho_Mafo"]*1e-6, 0, magnetizationVector) mat_substrate = ba.MaterialBySLD("MgAl2O4", *sldMao) @@ -93,7 +93,7 @@ def get_simulation(q_axis, parameters, polarization, analyzer): scan.setAbsoluteQResolution(distr, parameters["q_res"]) simulation.beam().setPolarization(polarization) - simulation.setAnalyzerProperties(analyzer, 1.0, 0.5) + simulation.setAnalyzerProperties(analyzer, 1, 0.5) simulation.setScan(scan) return simulation @@ -272,10 +272,10 @@ def run_fit_ba(q_axis, r_data, r_uncertainty, simulationFactory, startParams): fit_objective.addSimulationAndData( lambda params: simulationFactory[0](q_axis[0], params), r_data[0], - r_uncertainty[0], 1.0) + r_uncertainty[0], 1) fit_objective.addSimulationAndData( lambda params: simulationFactory[1](q_axis[1], params), r_data[1], - r_uncertainty[1], 1.0) + r_uncertainty[1], 1) fit_objective.initPrint(10) @@ -305,7 +305,7 @@ if __name__ == '__main__': startParams = { # own starting values - "q_res": (0.0, 0, 0.1), + "q_res": (0, 0, 0.1), "q_offset": (0, -0.002, 0.002), "rho_Mafo": (6.3649, 2, 7), "rhoM_Mafo": (0, 0, 2), diff --git a/Examples/fit55_SpecularIntro/RealLifeReflectometryFitting.py b/Examples/fit55_SpecularIntro/RealLifeReflectometryFitting.py index 7c7aabe6ae7ab4d827815c5b39327f4b4a3d37bc..a96af5188c52c2bb4426319d977b56760e83bb61 100644 --- a/Examples/fit55_SpecularIntro/RealLifeReflectometryFitting.py +++ b/Examples/fit55_SpecularIntro/RealLifeReflectometryFitting.py @@ -110,7 +110,7 @@ def buildSample(arg_dict): Creates sample and returns it """ # defining materials - m_vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + m_vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) m_si_o2 = ba.HomogeneousMaterial("SiO2", 8.57040868e-06*arg_dict["concentration"], 1.11016654e-07*arg_dict["concentration"]) @@ -208,11 +208,11 @@ def run_fitting(): # running preliminary optimization on the total range of experimental data. bounds = [ (1e6, 1e8), # beam intensity - (0.0, 0.1), # beam-to-sample width ratio - (0.0, 0.08*ba.deg), # beam_divergence - (0.0, 1.0), # oxide_concentration - (0.0, 2.0*ba.nm), # oxide_thickness - (0.0, 2.0*ba.nm) + (0, 0.1), # beam-to-sample width ratio + (0, 0.08*ba.deg), # beam_divergence + (0, 1), # oxide_concentration + (0, 2*ba.nm), # oxide_thickness + (0, 2*ba.nm) ] # roughness print("Start preliminary fitting of experimental data:\n") @@ -226,9 +226,9 @@ def run_fitting(): tol=1e-5) bounds = [ - (0.0, 1.0), # oxide_concentration - (0.0, 2.0*ba.nm), # oxide_thickness - (0.0, 2.0*ba.nm) + (0, 1), # oxide_concentration + (0, 2*ba.nm), # oxide_thickness + (0, 2*ba.nm) ] # roughness fixed_args = ( diff --git a/Examples/fit56_SpecularAdvanced/Honeycomb_fit.py b/Examples/fit56_SpecularAdvanced/Honeycomb_fit.py index d6ead29c29f6789ffb3debaf1dad62a3b25ccc50..ac1a55b222523ef4a167faf14085ce702b518266 100644 --- a/Examples/fit56_SpecularAdvanced/Honeycomb_fit.py +++ b/Examples/fit56_SpecularAdvanced/Honeycomb_fit.py @@ -324,7 +324,7 @@ if __name__ == '__main__': "sld_Si_imag": (0, 0, 0), "sld_SiO2_real": (3.47, 3, 4), "sld_Si_real": (2.0704, 2, 3), - "dq": (0.018, 0.0, 0.1), + "dq": (0.018, 0, 0.1), } if len(sys.argv) > 1 and sys.argv[1] == "fit": @@ -337,7 +337,7 @@ if __name__ == '__main__': "t_Py1": (64, 50, 80), "t_SiO2": (16, 10, 30), "sld_PyOx_real": (1.915, 1.6, 2.2), - "sld_Py2_real": (5.0, 3, 6), + "sld_Py2_real": (5, 3, 6), "sld_Py1_real": (4.62, 3, 6), "r_PyOx": (27, 5, 35), "r_Py2": (12, 5, 20), @@ -365,7 +365,7 @@ if __name__ == '__main__': 'sld_Py1_real': 4.612135848532186, 'r_PyOx': 31.323366207013787, 'r_Py2': 9.083768897940645, - 'r_Py1': 5.0, + 'r_Py1': 5, 'r_SiO2': 14.43455709065263, 'r_Si': 14.948233893986075, 'msld_PyOx': 0.292684104601585, diff --git a/Examples/fit56_SpecularAdvanced/Pt_layer_fit.py b/Examples/fit56_SpecularAdvanced/Pt_layer_fit.py index e06ddd9c53841c9c0b4c0b0f1697da99ef91034a..b2d0232e3f56fd53606968bad9e9cda4ccd03a66 100644 --- a/Examples/fit56_SpecularAdvanced/Pt_layer_fit.py +++ b/Examples/fit56_SpecularAdvanced/Pt_layer_fit.py @@ -33,7 +33,7 @@ sldSi = (2.0728e-06, 2.3747e-11) def get_sample(params): - mat_ambient = ba.MaterialBySLD("Ambient", 0.0, 0.0) + mat_ambient = ba.MaterialBySLD("Ambient", 0, 0) mat_layer = ba.MaterialBySLD("Pt", *sldPt) mat_substrate = ba.MaterialBySLD("Si", *sldSi) @@ -178,7 +178,7 @@ def run_fit_ba(q_axis, r_data, r_uncertainty, simulationFactory, startParams): fit_objective.addSimulationAndData( lambda params: simulationFactory(q_axis, params), r_data, r_uncertainty, - 1.0) + 1) fit_objective.initPrint(10) @@ -208,8 +208,8 @@ if __name__ == '__main__': startParams = { # own starting values - "q_offset": (0.0, -0.02, 0.02), - "q_res/q": (0.0, 0, 0.02), + "q_offset": (0, -0.02, 0.02), + "q_res/q": (0, 0, 0.02), "t_pt/nm": (53, 40, 60), "r_si/nm": (1.22, 0, 5), "r_pt/nm": (0.25, 0, 5), diff --git a/Examples/fit61_Galaxi/fit_galaxi_data.py b/Examples/fit61_Galaxi/fit_galaxi_data.py index faeb0723acdec4dfb89a84d0cafbe2c0339c7a34..257eb0520e5bbd6ec1225fc806c1d7becda739c5 100644 --- a/Examples/fit61_Galaxi/fit_galaxi_data.py +++ b/Examples/fit61_Galaxi/fit_galaxi_data.py @@ -37,9 +37,9 @@ def create_simulation(params): """ simulation = ba.GISASSimulation() simulation.setDetector(create_detector()) - simulation.setBeamParameters(wavelength, alpha_i, 0.0) + simulation.setBeamParameters(wavelength, alpha_i, 0) simulation.beam().setIntensity(1.2e7) - simulation.setRegionOfInterest(85.0, 70.0, 120.0, 92.) + simulation.setRegionOfInterest(85, 70, 120, 92.) simulation.addMask(ba.Rectangle(101.9, 82.1, 103.7, 85.2), True) # beamstop sample_builder = SampleBuilder() @@ -60,14 +60,14 @@ def run_fitting(): real_data = load_real_data() fit_objective = ba.FitObjective() - fit_objective.addSimulationAndData(create_simulation, real_data, 1.0) + fit_objective.addSimulationAndData(create_simulation, real_data, 1) fit_objective.initPrint(10) fit_objective.initPlot(10) params = ba.Parameters() - params.add("radius", 5.*nm, min=4.0, max=6.0, step=0.1*nm) + params.add("radius", 5.*nm, min=4, max=6, step=0.1*nm) params.add("sigma", 0.55, min=0.2, max=0.8, step=0.01) - params.add("distance", 27.*nm, min=20.0, max=70.0) + params.add("distance", 27.*nm, min=20, max=70) minimizer = ba.Minimizer() result = minimizer.minimize(fit_objective.evaluate, params) diff --git a/Examples/fit61_Galaxi/sample_builder.py b/Examples/fit61_Galaxi/sample_builder.py index b9a919eca84d7356f3a46ac025de900815a3233f..13cf6a5aeb47fdbcc5d91a93673e858a20fbf960 100644 --- a/Examples/fit61_Galaxi/sample_builder.py +++ b/Examples/fit61_Galaxi/sample_builder.py @@ -43,7 +43,7 @@ class SampleBuilder: """ # defining materials - m_vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + m_vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) m_Si = ba.HomogeneousMaterial("Si", 5.78164736e-6, 1.02294578e-7) m_Ag = ba.HomogeneousMaterial("Ag", 2.24749529E-5, 1.61528396E-6) m_PTFE = ba.HomogeneousMaterial("PTFE", 5.20508729E-6, 1.96944292E-8) @@ -55,31 +55,31 @@ class SampleBuilder: sphere_ff = ba.FormFactorFullSphere(self.radius) sphere = ba.Particle(m_Ag, sphere_ff) - position = ba.kvector_t(0*ba.nm, 0*ba.nm, -1.0*self.hmdso_thickness) + position = ba.kvector_t(0*ba.nm, 0*ba.nm, -1*self.hmdso_thickness) sphere.setPosition(position) ln_distr = ba.DistributionLogNormal(self.radius, self.sigma) par_distr = ba.ParameterDistribution( "/Particle/FullSphere/Radius", ln_distr, nparticles, nfwhm, - ba.RealLimits.limited(0.0, self.hmdso_thickness/2.0)) + ba.RealLimits.limited(0, self.hmdso_thickness/2)) part_coll = ba.ParticleDistribution(sphere, par_distr) # interference function interference = ba.InterferenceFunctionRadialParaCrystal( self.distance, 1e6*ba.nm) interference.setKappa(self.kappa) - interference.setDomainSize(20000.0) + interference.setDomainSize(20000) pdf = ba.FTDistribution1DGauss(self.disorder) interference.setProbabilityDistribution(pdf) # assembling particle layout layout = ba.ParticleLayout() - layout.addParticle(part_coll, 1.0) + layout.addParticle(part_coll, 1) layout.setInterferenceFunction(interference) layout.setTotalParticleSurfaceDensity(1) # roughness - r_ptfe = ba.LayerRoughness(2.3*ba.nm, 0.3, 5.0*ba.nm) - r_hmdso = ba.LayerRoughness(1.1*ba.nm, 0.3, 5.0*ba.nm) + r_ptfe = ba.LayerRoughness(2.3*ba.nm, 0.3, 5*ba.nm) + r_hmdso = ba.LayerRoughness(1.1*ba.nm, 0.3, 5*ba.nm) # layers vacuum_layer = ba.Layer(m_vacuum) diff --git a/Examples/scatter2d/ApproximationDA.py b/Examples/scatter2d/ApproximationDA.py index 6fbd99ed31db0622b4bbb707a9749ac79ec0d45e..06be7b3803d323232575df00162a979d6f88646d 100644 --- a/Examples/scatter2d/ApproximationDA.py +++ b/Examples/scatter2d/ApproximationDA.py @@ -15,19 +15,19 @@ def get_sample(): # Define materials material_Particle = ba.HomogeneousMaterial("Particle", 0.0006, 2e-08) material_Substrate = ba.HomogeneousMaterial("Substrate", 6e-06, 2e-08) - material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) # Define form factors - ff_1 = ba.FormFactorCylinder(5.0*nm, 5.0*nm) - ff_2 = ba.FormFactorCylinder(8.0*nm, 8.0*nm) + ff_1 = ba.FormFactorCylinder(5*nm, 5*nm) + ff_2 = ba.FormFactorCylinder(8*nm, 8*nm) # Define particles particle_1 = ba.Particle(material_Particle, ff_1) particle_2 = ba.Particle(material_Particle, ff_2) # Define interference functions - iff = ba.InterferenceFunctionRadialParaCrystal(18.0*nm, 1000.0*nm) - iff_pdf = ba.FTDistribution1DGauss(3.0*nm) + iff = ba.InterferenceFunctionRadialParaCrystal(18*nm, 1000*nm) + iff_pdf = ba.FTDistribution1DGauss(3*nm) iff.setProbabilityDistribution(iff_pdf) # Define particle layouts @@ -52,7 +52,7 @@ def get_sample(): def get_simulation(sample): - beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) + beam = ba.Beam(1, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) detector = ba.SphericalDetector(200, 2*deg, 1*deg, 1*deg) simulation = ba.GISASSimulation(beam, sample, detector) return simulation diff --git a/Examples/scatter2d/ApproximationLMA.py b/Examples/scatter2d/ApproximationLMA.py index ee4dc132730efb5a088929f1c366655d937f1695..ec5ebc715e877d42527c4b6c36dbbd59a2f26839 100644 --- a/Examples/scatter2d/ApproximationLMA.py +++ b/Examples/scatter2d/ApproximationLMA.py @@ -15,22 +15,22 @@ def get_sample(): # Define materials material_Particle = ba.HomogeneousMaterial("Particle", 0.0006, 2e-08) material_Substrate = ba.HomogeneousMaterial("Substrate", 6e-06, 2e-08) - material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) # Define form factors - ff_1 = ba.FormFactorCylinder(5.0*nm, 5.0*nm) - ff_2 = ba.FormFactorCylinder(8.0*nm, 8.0*nm) + ff_1 = ba.FormFactorCylinder(5*nm, 5*nm) + ff_2 = ba.FormFactorCylinder(8*nm, 8*nm) # Define particles particle_1 = ba.Particle(material_Particle, ff_1) particle_2 = ba.Particle(material_Particle, ff_2) # Define interference functions - iff_1 = ba.InterferenceFunctionRadialParaCrystal(16.8*nm, 1000.0*nm) - iff_1_pdf = ba.FTDistribution1DGauss(3.0*nm) + iff_1 = ba.InterferenceFunctionRadialParaCrystal(16.8*nm, 1000*nm) + iff_1_pdf = ba.FTDistribution1DGauss(3*nm) iff_1.setProbabilityDistribution(iff_1_pdf) - iff_2 = ba.InterferenceFunctionRadialParaCrystal(22.8*nm, 1000.0*nm) - iff_2_pdf = ba.FTDistribution1DGauss(3.0*nm) + iff_2 = ba.InterferenceFunctionRadialParaCrystal(22.8*nm, 1000*nm) + iff_2_pdf = ba.FTDistribution1DGauss(3*nm) iff_2.setProbabilityDistribution(iff_2_pdf) # Define particle layouts @@ -60,7 +60,7 @@ def get_sample(): def get_simulation(sample): - beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) + beam = ba.Beam(1, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) detector = ba.SphericalDetector(200, 2*deg, 1*deg, 1*deg) simulation = ba.GISASSimulation(beam, sample, detector) return simulation diff --git a/Examples/scatter2d/ApproximationSSCA.py b/Examples/scatter2d/ApproximationSSCA.py index b2f8a8e5c82a227060fd59c256e680ee9a97282e..04a682940e9f00c882e256191389b67f4a880296 100644 --- a/Examples/scatter2d/ApproximationSSCA.py +++ b/Examples/scatter2d/ApproximationSSCA.py @@ -15,20 +15,20 @@ def get_sample(): # Define materials material_Particle = ba.HomogeneousMaterial("Particle", 0.0006, 2e-08) material_Substrate = ba.HomogeneousMaterial("Substrate", 6e-06, 2e-08) - material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) # Define form factors - ff_1 = ba.FormFactorCylinder(5.0*nm, 5.0*nm) - ff_2 = ba.FormFactorCylinder(8.0*nm, 8.0*nm) + ff_1 = ba.FormFactorCylinder(5*nm, 5*nm) + ff_2 = ba.FormFactorCylinder(8*nm, 8*nm) # Define particles particle_1 = ba.Particle(material_Particle, ff_1) particle_2 = ba.Particle(material_Particle, ff_2) # Define interference functions - iff = ba.InterferenceFunctionRadialParaCrystal(18.0*nm, 1000.0*nm) - iff.setKappa(1.0) - iff_pdf = ba.FTDistribution1DGauss(3.0*nm) + iff = ba.InterferenceFunctionRadialParaCrystal(18*nm, 1000*nm) + iff.setKappa(1) + iff_pdf = ba.FTDistribution1DGauss(3*nm) iff.setProbabilityDistribution(iff_pdf) # Define particle layouts @@ -53,7 +53,7 @@ def get_sample(): def get_simulation(sample): - beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) + beam = ba.Beam(1, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) detector = ba.SphericalDetector(200, 2*deg, 1*deg, 1*deg) simulation = ba.GISASSimulation(beam, sample, detector) return simulation diff --git a/Examples/scatter2d/BeamDivergence.py b/Examples/scatter2d/BeamDivergence.py index 9045ea1767db48df887a92acff0bd64000ad163d..1c448d47a3d92b81c42b82c594d8fa4a1fba570e 100644 --- a/Examples/scatter2d/BeamDivergence.py +++ b/Examples/scatter2d/BeamDivergence.py @@ -14,17 +14,17 @@ def get_sample(): # Define materials material_Particle = ba.HomogeneousMaterial("Particle", 0.0006, 2e-08) material_Substrate = ba.HomogeneousMaterial("Substrate", 6e-06, 2e-08) - material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) # Define form factors - ff = ba.FormFactorCylinder(5.0*nm, 5.0*nm) + ff = ba.FormFactorCylinder(5*nm, 5*nm) # Define particles particle = ba.Particle(material_Particle, ff) # Define particle layouts layout = ba.ParticleLayout() - layout.addParticle(particle, 1.0) + layout.addParticle(particle, 1) layout.setWeight(1) layout.setTotalParticleSurfaceDensity(0.01) @@ -42,17 +42,17 @@ def get_sample(): def get_simulation(sample): - beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) + beam = ba.Beam(1, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) detector = ba.SphericalDetector(100, 2*deg, 1*deg, 1*deg) simulation = ba.GISASSimulation(beam, sample, detector) distr_1 = ba.DistributionLogNormal(0.1*nm, 0.1) - simulation.addParameterDistribution("*/Beam/Wavelength", distr_1, 5, 0.0) + simulation.addParameterDistribution("*/Beam/Wavelength", distr_1, 5, 0) distr_2 = ba.DistributionGaussian(0.2*deg, 0.1*deg) simulation.addParameterDistribution("*/Beam/InclinationAngle", distr_2, 5, - 0.0) + 0) distr_3 = ba.DistributionGaussian(0*deg, 0.1*deg) simulation.addParameterDistribution("*/Beam/AzimuthalAngle", distr_3, 5, - 0.0) + 0) return simulation diff --git a/Examples/scatter2d/BoxesWithSpecularPeak.py b/Examples/scatter2d/BoxesWithSpecularPeak.py index aab73f75c80e86c852388fe8b65ba8170e5372c8..060f300eb956cc6cb48ba4d9b7d7be248a82f83e 100644 --- a/Examples/scatter2d/BoxesWithSpecularPeak.py +++ b/Examples/scatter2d/BoxesWithSpecularPeak.py @@ -14,25 +14,25 @@ def get_sample(): # Define materials material_Particle = ba.HomogeneousMaterial("Particle", 3e-05, 2e-08) material_Substrate = ba.HomogeneousMaterial("Substrate", 6e-06, 2e-08) - material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) # Define form factors - ff = ba.FormFactorBox(5.0*nm, 5.0*nm, 10.0*nm) + ff = ba.FormFactorBox(5*nm, 5*nm, 10*nm) # Define particles particle = ba.Particle(material_Particle, ff) # Define 2D lattices - lattice = ba.BasicLattice2D(8.0*nm, 8.0*nm, 90.0*deg, 0.0*deg) + lattice = ba.BasicLattice2D(8*nm, 8*nm, 90*deg, 0*deg) # Define interference functions iff = ba.InterferenceFunction2DLattice(lattice) - iff_pdf = ba.FTDecayFunction2DCauchy(100.0*nm, 100.0*nm, 0.0*deg) + iff_pdf = ba.FTDecayFunction2DCauchy(100*nm, 100*nm, 0*deg) iff.setDecayFunction(iff_pdf) # Define particle layouts layout = ba.ParticleLayout() - layout.addParticle(particle, 1.0) + layout.addParticle(particle, 1) layout.setInterferenceFunction(iff) layout.setWeight(1) layout.setTotalParticleSurfaceDensity(0.015625) @@ -51,7 +51,7 @@ def get_sample(): def get_simulation(sample): - beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) + beam = ba.Beam(1, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) detector = ba.SphericalDetector(101, -2*deg, 2*deg, 101, 0*deg, 2*deg) simulation = ba.GISASSimulation(beam, sample, detector) simulation.getOptions().setUseAvgMaterials(True) diff --git a/Examples/scatter2d/BuriedParticles.py b/Examples/scatter2d/BuriedParticles.py index 806d1d379f675d92022c63901f98e5b9004bfa01..5e9cf456be169bea3898b07c8b549917262e83ed 100644 --- a/Examples/scatter2d/BuriedParticles.py +++ b/Examples/scatter2d/BuriedParticles.py @@ -15,27 +15,27 @@ def get_sample(): # Define materials material_IntermLayer = ba.HomogeneousMaterial("IntermLayer", 3.45e-06, 5.24e-09) - material_Particle = ba.HomogeneousMaterial("Particle", 0.0, 0.0) + material_Particle = ba.HomogeneousMaterial("Particle", 0, 0) material_Substrate = ba.HomogeneousMaterial("Substrate", 7.43e-06, 1.72e-07) - material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) # Define form factors ff = ba.FormFactorFullSphere(10.2*nm) # Define particles particle = ba.Particle(material_Particle, ff) - particle_position = kvector_t(0.0*nm, 0.0*nm, -25.2*nm) + particle_position = kvector_t(0*nm, 0*nm, -25.2*nm) particle.setPosition(particle_position) # Define particle layouts layout = ba.ParticleLayout() - layout.addParticle(particle, 1.0) + layout.addParticle(particle, 1) layout.setWeight(1) layout.setTotalParticleSurfaceDensity(0.01) # Define layers layer_1 = ba.Layer(material_Vacuum) - layer_2 = ba.Layer(material_IntermLayer, 30.0*nm) + layer_2 = ba.Layer(material_IntermLayer, 30*nm) layer_2.addLayout(layout) layer_3 = ba.Layer(material_Substrate) @@ -49,7 +49,7 @@ def get_sample(): def get_simulation(sample): - beam = ba.Beam(1.0, 0.15*nm, ba.Direction(0.15*deg, 0*deg)) + beam = ba.Beam(1, 0.15*nm, ba.Direction(0.15*deg, 0*deg)) detector = ba.SphericalDetector(200, 2*deg, 0*deg, 1*deg) simulation = ba.GISASSimulation(beam, sample, detector) return simulation diff --git a/Examples/scatter2d/ConstantBackground.py b/Examples/scatter2d/ConstantBackground.py index 9fbb322fd877f944e09de5eaa5be108183ed666e..fdd1bb10854cf4e49ea4d58a1ba41e9851f17c86 100644 --- a/Examples/scatter2d/ConstantBackground.py +++ b/Examples/scatter2d/ConstantBackground.py @@ -14,17 +14,17 @@ def get_sample(): # Define materials material_Particle = ba.HomogeneousMaterial("Particle", 0.0006, 2e-08) material_Substrate = ba.HomogeneousMaterial("Substrate", 6e-06, 2e-08) - material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) # Define form factors - ff = ba.FormFactorCylinder(5.0*nm, 5.0*nm) + ff = ba.FormFactorCylinder(5*nm, 5*nm) # Define particles particle = ba.Particle(material_Particle, ff) # Define particle layouts layout = ba.ParticleLayout() - layout.addParticle(particle, 1.0) + layout.addParticle(particle, 1) layout.setWeight(1) layout.setTotalParticleSurfaceDensity(0.01) @@ -42,7 +42,7 @@ def get_sample(): def get_simulation(sample): - beam = ba.Beam(1000000.0, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) + beam = ba.Beam(1000000, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) detector = ba.SphericalDetector(100, 2*deg, 1*deg, 1*deg) simulation = ba.GISASSimulation(beam, sample, detector) background = ba.ConstantBackground(1.0e+03) diff --git a/Examples/scatter2d/CoreShellNanoparticles.py b/Examples/scatter2d/CoreShellNanoparticles.py index 463858ed9d3db12b660226550db102f778fcceff..c273d42b9863cc1d0fe83f3238d7ca748f95d817 100644 --- a/Examples/scatter2d/CoreShellNanoparticles.py +++ b/Examples/scatter2d/CoreShellNanoparticles.py @@ -14,11 +14,11 @@ def get_sample(): # Define materials material_Core = ba.HomogeneousMaterial("Core", 6e-05, 2e-08) material_Shell = ba.HomogeneousMaterial("Shell", 0.0001, 2e-08) - material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) # Define form factors - ff_1 = ba.FormFactorBox(12.0*nm, 12.0*nm, 7.0*nm) - ff_2 = ba.FormFactorBox(16.0*nm, 16.0*nm, 8.0*nm) + ff_1 = ba.FormFactorBox(12*nm, 12*nm, 7*nm) + ff_2 = ba.FormFactorBox(16*nm, 16*nm, 8*nm) # Define particles particle_1 = ba.Particle(material_Core, ff_1) @@ -32,7 +32,7 @@ def get_sample(): # Define particle layouts layout = ba.ParticleLayout() - layout.addParticle(particle_3, 1.0) + layout.addParticle(particle_3, 1) layout.setInterferenceFunction(iff) layout.setWeight(1) layout.setTotalParticleSurfaceDensity(0.01) @@ -49,7 +49,7 @@ def get_sample(): def get_simulation(sample): - beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) + beam = ba.Beam(1, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) detector = ba.SphericalDetector(200, 2*deg, 0*deg, 1*deg) simulation = ba.GISASSimulation(beam, sample, detector) return simulation diff --git a/Examples/scatter2d/CorrelatedRoughness.py b/Examples/scatter2d/CorrelatedRoughness.py index c92cb436be1143128face845684b4488462c1019..9ed7e4325311c0b3e92148052a24bb92a093ddc3 100644 --- a/Examples/scatter2d/CorrelatedRoughness.py +++ b/Examples/scatter2d/CorrelatedRoughness.py @@ -11,21 +11,21 @@ def get_sample(): Returns a sample with two layers on a substrate, with correlated roughnesses. """ # defining materials - m_vacuum = ba.HomogeneousMaterial("ambience", 0.0, 0.0) - m_part_a = ba.HomogeneousMaterial("PartA", 5e-6, 0.0) - m_part_b = ba.HomogeneousMaterial("PartB", 10e-6, 0.0) - m_substrate = ba.HomogeneousMaterial("substrate", 15e-6, 0.0) + m_vacuum = ba.HomogeneousMaterial("ambience", 0, 0) + m_part_a = ba.HomogeneousMaterial("PartA", 5e-6, 0) + m_part_b = ba.HomogeneousMaterial("PartB", 10e-6, 0) + m_substrate = ba.HomogeneousMaterial("substrate", 15e-6, 0) # defining layers l_ambience = ba.Layer(m_vacuum) l_part_a = ba.Layer(m_part_a, 2.5*nm) - l_part_b = ba.Layer(m_part_b, 5.0*nm) + l_part_b = ba.Layer(m_part_b, 5*nm) l_substrate = ba.Layer(m_substrate) roughness = ba.LayerRoughness() - roughness.setSigma(1.0*nm) + roughness.setSigma(1*nm) roughness.setHurstParameter(0.3) - roughness.setLatteralCorrLength(5.0*nm) + roughness.setLatteralCorrLength(5*nm) my_sample = ba.MultiLayer() @@ -44,7 +44,7 @@ def get_sample(): def get_simulation(sample): - beam = ba.Beam(500000000000.0, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) + beam = ba.Beam(500000000000, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) detector = ba.SphericalDetector(200, 1*deg, 0*deg, 0.5*deg) simulation = ba.GISASSimulation(beam, sample, detector) return simulation diff --git a/Examples/scatter2d/CosineRipplesAtRectLattice.py b/Examples/scatter2d/CosineRipplesAtRectLattice.py index d5bf586e48bbb50074b8c8d086e9b9280ffc85be..e870a6e280ec2487f09a5cf38d3f567b2910fb34 100644 --- a/Examples/scatter2d/CosineRipplesAtRectLattice.py +++ b/Examples/scatter2d/CosineRipplesAtRectLattice.py @@ -15,25 +15,25 @@ def get_sample(): # Define materials material_Particle = ba.HomogeneousMaterial("Particle", 0.0006, 2e-08) material_Substrate = ba.HomogeneousMaterial("Substrate", 6e-06, 2e-08) - material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) # Define form factors - ff = ba.FormFactorCosineRippleBox(100.0*nm, 20.0*nm, 4.0*nm) + ff = ba.FormFactorCosineRippleBox(100*nm, 20*nm, 4*nm) # Define particles particle = ba.Particle(material_Particle, ff) # Define 2D lattices - lattice = ba.BasicLattice2D(200.0*nm, 50.0*nm, 90.0*deg, 0.0*deg) + lattice = ba.BasicLattice2D(200*nm, 50*nm, 90*deg, 0*deg) # Define interference functions iff = ba.InterferenceFunction2DLattice(lattice) - iff_pdf = ba.FTDecayFunction2DCauchy(160.0*nm, 16.0*nm, 0.0*deg) + iff_pdf = ba.FTDecayFunction2DCauchy(160*nm, 16*nm, 0*deg) iff.setDecayFunction(iff_pdf) # Define particle layouts layout = ba.ParticleLayout() - layout.addParticle(particle, 1.0) + layout.addParticle(particle, 1) layout.setInterferenceFunction(iff) layout.setWeight(1) layout.setTotalParticleSurfaceDensity(0.0001) @@ -52,7 +52,7 @@ def get_sample(): def get_simulation(sample): - beam = ba.Beam(1.0, 0.16*nm, ba.Direction(0.3*deg, 0*deg)) + beam = ba.Beam(1, 0.16*nm, ba.Direction(0.3*deg, 0*deg)) detector = ba.SphericalDetector(100, -1.5*deg, 1.5*deg, 100, 0*deg, 2.5*deg) simulation = ba.GISASSimulation(beam, sample, detector) return simulation diff --git a/Examples/scatter2d/CylindersAndPrisms.py b/Examples/scatter2d/CylindersAndPrisms.py index 7db298a07b4139da5554464fb521c32d28255f6d..f5d36622ccd859a485d24f8940b24eac2803efdc 100644 --- a/Examples/scatter2d/CylindersAndPrisms.py +++ b/Examples/scatter2d/CylindersAndPrisms.py @@ -14,11 +14,11 @@ def get_sample(): # Define materials material_Particle = ba.HomogeneousMaterial("Particle", 0.0006, 2e-08) material_Substrate = ba.HomogeneousMaterial("Substrate", 6e-06, 2e-08) - material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) # Define form factors - ff_1 = ba.FormFactorCylinder(5.0*nm, 5.0*nm) - ff_2 = ba.FormFactorPrism3(10.0*nm, 5.0*nm) + ff_1 = ba.FormFactorCylinder(5*nm, 5*nm) + ff_2 = ba.FormFactorPrism3(10*nm, 5*nm) # Define particles particle_1 = ba.Particle(material_Particle, ff_1) @@ -49,7 +49,7 @@ def get_sample(): def get_simulation(sample): - beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) + beam = ba.Beam(1, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) detector = ba.SphericalDetector(100, 2*deg, 0*deg, 1*deg) simulation = ba.GISASSimulation(beam, sample, detector) return simulation diff --git a/Examples/scatter2d/CylindersInAverageLayer.py b/Examples/scatter2d/CylindersInAverageLayer.py index 55c7e31fa33f1d0d9594bb717086da4b28a1d087..e5543bee147f65971e0ee8c24aa1f14b3eb79af1 100644 --- a/Examples/scatter2d/CylindersInAverageLayer.py +++ b/Examples/scatter2d/CylindersInAverageLayer.py @@ -11,7 +11,7 @@ def get_sample(cyl_height=5*nm): Returns a sample with cylinders on a substrate. """ # defining materials - m_vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + m_vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) m_layer = ba.HomogeneousMaterial("Layer", 3e-6, 2e-8) m_substrate = ba.HomogeneousMaterial("Substrate", 6e-6, 2e-8) m_particle = ba.HomogeneousMaterial("Particle", 3e-5, 2e-8) @@ -19,9 +19,9 @@ def get_sample(cyl_height=5*nm): # cylindrical particle cylinder_ff = ba.FormFactorCylinder(5*nm, cyl_height) cylinder = ba.Particle(m_particle, cylinder_ff) - position = ba.kvector_t(0.0, 0.0, -cyl_height) + position = ba.kvector_t(0, 0, -cyl_height) particle_layout = ba.ParticleLayout() - particle_layout.addParticle(cylinder, 1.0, position) + particle_layout.addParticle(cylinder, 1, position) # interference function interference = ba.InterferenceFunction2DLattice( @@ -43,7 +43,7 @@ def get_sample(cyl_height=5*nm): def get_simulation(sample): - beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) + beam = ba.Beam(1, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) detector = ba.SphericalDetector(100, -2*deg, 2*deg, 100, 0*deg, 2*deg) simulation = ba.GISASSimulation(beam, sample, detector) simulation.getOptions().setUseAvgMaterials(True) diff --git a/Examples/scatter2d/CylindersInBA.py b/Examples/scatter2d/CylindersInBA.py index bbae5380ae3e9ff683d6ed99bb8d49ae33d7e4a2..623f17ebc3c372b990291584401fa95c1f89df0c 100755 --- a/Examples/scatter2d/CylindersInBA.py +++ b/Examples/scatter2d/CylindersInBA.py @@ -39,7 +39,7 @@ def get_sample(): def get_simulation(sample): - beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) + beam = ba.Beam(1, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) detector = ba.SphericalDetector(200, -2*deg, 2*deg, 200, 0*deg, 3*deg) simulation = ba.GISASSimulation(beam, sample, detector) return simulation diff --git a/Examples/scatter2d/CylindersWithSizeDistribution.py b/Examples/scatter2d/CylindersWithSizeDistribution.py index fcc66e4795e64bdb8466e6b91031b349507e09bc..cab15d672c7d12ee2ea97d3915f8a77d31d09097 100644 --- a/Examples/scatter2d/CylindersWithSizeDistribution.py +++ b/Examples/scatter2d/CylindersWithSizeDistribution.py @@ -14,23 +14,23 @@ def get_sample(): # Define materials material_Particle = ba.HomogeneousMaterial("Particle", 0.0006, 2e-08) - material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) # Define form factors - ff = ba.FormFactorCylinder(5.0*nm, 5.0*nm) + ff = ba.FormFactorCylinder(5*nm, 5*nm) # Define particles particle = ba.Particle(material_Particle, ff) # Define particles with parameter following a distribution - distr_1 = ba.DistributionGaussian(5.0*nm, 1.0*nm) + distr_1 = ba.DistributionGaussian(5*nm, 1*nm) par_distr_1 = ba.ParameterDistribution("/Particle/Cylinder/Radius", distr_1, - 100, 2.0) + 100, 2) particle_distrib = ba.ParticleDistribution(particle, par_distr_1) # Define particle layouts layout = ba.ParticleLayout() - layout.addParticle(particle_distrib, 1.0) + layout.addParticle(particle_distrib, 1) layout.setWeight(1) layout.setTotalParticleSurfaceDensity(0.01) @@ -46,7 +46,7 @@ def get_sample(): def get_simulation(sample): - beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) + beam = ba.Beam(1, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) detector = ba.SphericalDetector(200, 2*deg, 1*deg, 1*deg) simulation = ba.GISASSimulation(beam, sample, detector) return simulation diff --git a/Examples/scatter2d/DetectorResolutionFunction.py b/Examples/scatter2d/DetectorResolutionFunction.py index 8eeaf26f0005fbe750425a249ecf89094af8dde1..0b81700f776eff650ce979b476833151de44361c 100644 --- a/Examples/scatter2d/DetectorResolutionFunction.py +++ b/Examples/scatter2d/DetectorResolutionFunction.py @@ -14,17 +14,17 @@ def get_sample(): # Define materials material_Particle = ba.HomogeneousMaterial("Particle", 0.0006, 2e-08) material_Substrate = ba.HomogeneousMaterial("Substrate", 6e-06, 2e-08) - material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) # Define form factors - ff = ba.FormFactorCylinder(5.0*nm, 5.0*nm) + ff = ba.FormFactorCylinder(5*nm, 5*nm) # Define particles particle = ba.Particle(material_Particle, ff) # Define particle layouts layout = ba.ParticleLayout() - layout.addParticle(particle, 1.0) + layout.addParticle(particle, 1) layout.setWeight(1) layout.setTotalParticleSurfaceDensity(0.01) @@ -42,7 +42,7 @@ def get_sample(): def get_simulation(sample): - beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) + beam = ba.Beam(1, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) detector = ba.SphericalDetector(100, 2*deg, 1*deg, 1*deg) simulation = ba.GISASSimulation(beam, sample, detector) simulation.setDetectorResolutionFunction( diff --git a/Examples/scatter2d/DodecahedraSAS.py b/Examples/scatter2d/DodecahedraSAS.py index de550113c22335a96ae2adc2f4468cea6e402c98..32961c9125970733c8b74be83f8d11cf6af3ee4f 100755 --- a/Examples/scatter2d/DodecahedraSAS.py +++ b/Examples/scatter2d/DodecahedraSAS.py @@ -9,7 +9,7 @@ from bornagain import deg, nm def get_sample(): - m_vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + m_vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) m_solution = ba.HomogeneousMaterial("Solution", 6e-6, 2e-8) m_particle = ba.HomogeneousMaterial("Particle", 6e-4, 2e-8) @@ -33,7 +33,7 @@ def get_sample(): def get_simulation(sample): # Beam from above (perpendicular to sample): - beam = ba.Beam(1, 0.4*nm, ba.Direction(90*deg, 0.0*deg)) + beam = ba.Beam(1, 0.4*nm, ba.Direction(90*deg, 0*deg)) # Detector opposite to source: detPos = 2000 # distance from sample center to detector in mm diff --git a/Examples/scatter2d/HalfSpheresInAverageTopLayer.py b/Examples/scatter2d/HalfSpheresInAverageTopLayer.py index d3328cb59461c6b7edef033a096477b52f208ae0..825419a89f7a8ff4719acfa392e64f74092450a1 100644 --- a/Examples/scatter2d/HalfSpheresInAverageTopLayer.py +++ b/Examples/scatter2d/HalfSpheresInAverageTopLayer.py @@ -15,25 +15,25 @@ def get_sample(): # Define materials material_Particle = ba.HomogeneousMaterial("Particle", 3e-05, 2e-08) material_Substrate = ba.HomogeneousMaterial("Substrate", 6e-06, 2e-08) - material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) # Define form factors - ff = ba.FormFactorTruncatedSphere(5.0*nm, 5.0*nm, 0.0*nm) + ff = ba.FormFactorTruncatedSphere(5*nm, 5*nm, 0*nm) # Define particles particle = ba.Particle(material_Particle, ff) # Define 2D lattices - lattice = ba.BasicLattice2D(10.0*nm, 10.0*nm, 90.0*deg, 0.0*deg) + lattice = ba.BasicLattice2D(10*nm, 10*nm, 90*deg, 0*deg) # Define interference functions iff = ba.InterferenceFunction2DLattice(lattice) - iff_pdf = ba.FTDecayFunction2DCauchy(100.0*nm, 100.0*nm, 0.0*deg) + iff_pdf = ba.FTDecayFunction2DCauchy(100*nm, 100*nm, 0*deg) iff.setDecayFunction(iff_pdf) # Define particle layouts layout = ba.ParticleLayout() - layout.addParticle(particle, 1.0) + layout.addParticle(particle, 1) layout.setInterferenceFunction(iff) layout.setWeight(1) layout.setTotalParticleSurfaceDensity(0.01) @@ -53,7 +53,7 @@ def get_sample(): def get_simulation(sample): - beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) + beam = ba.Beam(1, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) detector = ba.SphericalDetector(100, -2*deg, 2*deg, 100, 0*deg, 2*deg) simulation = ba.GISASSimulation(beam, sample, detector) simulation.getOptions().setUseAvgMaterials(True) diff --git a/Examples/scatter2d/HexagonalLatticesWithBasis.py b/Examples/scatter2d/HexagonalLatticesWithBasis.py index 95335e8009aa994a2d35bcb2eefdd2e3026118c3..66f76e4836ee2b5b8d10d8bcfcdb65221b5eb4ed 100644 --- a/Examples/scatter2d/HexagonalLatticesWithBasis.py +++ b/Examples/scatter2d/HexagonalLatticesWithBasis.py @@ -15,16 +15,16 @@ def get_sample(): # Define materials material_Particle = ba.HomogeneousMaterial("Particle", 0.0006, 2e-08) material_Substrate = ba.HomogeneousMaterial("Substrate", 6e-06, 2e-08) - material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) # Define form factors - ff_1 = ba.FormFactorFullSphere(10.0*nm) - ff_2 = ba.FormFactorFullSphere(10.0*nm) + ff_1 = ba.FormFactorFullSphere(10*nm) + ff_2 = ba.FormFactorFullSphere(10*nm) # Define particles particle_1 = ba.Particle(material_Particle, ff_1) particle_2 = ba.Particle(material_Particle, ff_2) - particle_2_position = kvector_t(10.0*nm, 10.0*nm, 17.3205080757*nm) + particle_2_position = kvector_t(10*nm, 10*nm, 17.3205080757*nm) particle_2.setPosition(particle_2_position) # Define composition of particles at specific positions @@ -33,16 +33,16 @@ def get_sample(): particle_3.addParticle(particle_2) # Define 2D lattices - lattice = ba.BasicLattice2D(20.0*nm, 20.0*nm, 120.0*deg, 0.0*deg) + lattice = ba.BasicLattice2D(20*nm, 20*nm, 120*deg, 0*deg) # Define interference functions iff = ba.InterferenceFunction2DLattice(lattice) - iff_pdf = ba.FTDecayFunction2DCauchy(10.0*nm, 10.0*nm, 0.0*deg) + iff_pdf = ba.FTDecayFunction2DCauchy(10*nm, 10*nm, 0*deg) iff.setDecayFunction(iff_pdf) # Define particle layouts layout = ba.ParticleLayout() - layout.addParticle(particle_3, 1.0) + layout.addParticle(particle_3, 1) layout.setInterferenceFunction(iff) layout.setWeight(1) layout.setTotalParticleSurfaceDensity(0.00288675134595) @@ -61,7 +61,7 @@ def get_sample(): def get_simulation(sample): - beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) + beam = ba.Beam(1, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) detector = ba.SphericalDetector(200, -1*deg, 1*deg, 200, 0*deg, 1*deg) simulation = ba.GISASSimulation(beam, sample, detector) return simulation diff --git a/Examples/scatter2d/Interference1DRadialParaCrystal.py b/Examples/scatter2d/Interference1DRadialParaCrystal.py index 0915d819a30651d32d930edfc41ce38ad180b6d2..7349d64208e909b26824f39eda04709711ee40c7 100644 --- a/Examples/scatter2d/Interference1DRadialParaCrystal.py +++ b/Examples/scatter2d/Interference1DRadialParaCrystal.py @@ -14,22 +14,22 @@ def get_sample(): # Define materials material_Particle = ba.HomogeneousMaterial("Particle", 0.0006, 2e-08) material_Substrate = ba.HomogeneousMaterial("Substrate", 6e-06, 2e-08) - material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) # Define form factors - ff = ba.FormFactorCylinder(5.0*nm, 5.0*nm) + ff = ba.FormFactorCylinder(5*nm, 5*nm) # Define particles particle = ba.Particle(material_Particle, ff) # Define interference functions - iff = ba.InterferenceFunctionRadialParaCrystal(20.0*nm, 1000.0*nm) - iff_pdf = ba.FTDistribution1DGauss(7.0*nm) + iff = ba.InterferenceFunctionRadialParaCrystal(20*nm, 1000*nm) + iff_pdf = ba.FTDistribution1DGauss(7*nm) iff.setProbabilityDistribution(iff_pdf) # Define particle layouts layout = ba.ParticleLayout() - layout.addParticle(particle, 1.0) + layout.addParticle(particle, 1) layout.setInterferenceFunction(iff) layout.setWeight(1) layout.setTotalParticleSurfaceDensity(0.01) @@ -48,7 +48,7 @@ def get_sample(): def get_simulation(sample): - beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) + beam = ba.Beam(1, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) detector = ba.SphericalDetector(200, -2*deg, 2*deg, 200, 0*deg, 2*deg) simulation = ba.GISASSimulation(beam, sample, detector) return simulation diff --git a/Examples/scatter2d/Interference2DCenteredSquareLattice.py b/Examples/scatter2d/Interference2DCenteredSquareLattice.py index 1ce18932a8c6ac71e250f1fec8af079ed260643a..e580d0c0ec14d212d6a4556df15be0f4afd9fde5 100644 --- a/Examples/scatter2d/Interference2DCenteredSquareLattice.py +++ b/Examples/scatter2d/Interference2DCenteredSquareLattice.py @@ -15,16 +15,16 @@ def get_sample(): # Define materials material_Particle = ba.HomogeneousMaterial("Particle", 0.0006, 2e-08) material_Substrate = ba.HomogeneousMaterial("Substrate", 6e-06, 2e-08) - material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) # Define form factors - ff_1 = ba.FormFactorCylinder(3.0*nm, 3.0*nm) - ff_2 = ba.FormFactorCylinder(3.0*nm, 3.0*nm) + ff_1 = ba.FormFactorCylinder(3*nm, 3*nm) + ff_2 = ba.FormFactorCylinder(3*nm, 3*nm) # Define particles particle_1 = ba.Particle(material_Particle, ff_1) particle_2 = ba.Particle(material_Particle, ff_2) - particle_2_position = kvector_t(12.5*nm, 12.5*nm, 0.0*nm) + particle_2_position = kvector_t(12.5*nm, 12.5*nm, 0*nm) particle_2.setPosition(particle_2_position) # Define composition of particles at specific positions @@ -33,16 +33,16 @@ def get_sample(): particle_3.addParticle(particle_2) # Define 2D lattices - lattice = ba.BasicLattice2D(25.0*nm, 25.0*nm, 90.0*deg, 0.0*deg) + lattice = ba.BasicLattice2D(25*nm, 25*nm, 90*deg, 0*deg) # Define interference functions iff = ba.InterferenceFunction2DLattice(lattice) - iff_pdf = ba.FTDecayFunction2DCauchy(48.0*nm, 16.0*nm, 0.0*deg) + iff_pdf = ba.FTDecayFunction2DCauchy(48*nm, 16*nm, 0*deg) iff.setDecayFunction(iff_pdf) # Define particle layouts layout = ba.ParticleLayout() - layout.addParticle(particle_3, 1.0) + layout.addParticle(particle_3, 1) layout.setInterferenceFunction(iff) layout.setWeight(1) layout.setTotalParticleSurfaceDensity(0.0016) @@ -61,7 +61,7 @@ def get_sample(): def get_simulation(sample): - beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) + beam = ba.Beam(1, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) detector = ba.SphericalDetector(200, -2*deg, 2*deg, 200, 0*deg, 2*deg) simulation = ba.GISASSimulation(beam, sample, detector) return simulation diff --git a/Examples/scatter2d/Interference2DLatticeSumOfRotated.py b/Examples/scatter2d/Interference2DLatticeSumOfRotated.py index 9866a4a53734d3f7191663f0fcc4534ac84d82a5..f82cfa263c5907ffed2ab8add8aa9f68fc3d3c2a 100644 --- a/Examples/scatter2d/Interference2DLatticeSumOfRotated.py +++ b/Examples/scatter2d/Interference2DLatticeSumOfRotated.py @@ -8,7 +8,7 @@ def get_sample(): Returns a sample with cylinders on a substrate, forming a 2D lattice with different disorder rotated lattice """ - m_vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + m_vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) m_substrate = ba.HomogeneousMaterial("Substrate", 6e-6, 2e-8) m_particle = ba.HomogeneousMaterial("Particle", 6e-4, 2e-8) @@ -16,16 +16,16 @@ def get_sample(): substrate_layer = ba.Layer(m_substrate) p_interference_function = \ - ba.InterferenceFunction2DLattice(ba.SquareLattice2D(25.0*nm, 0)) + ba.InterferenceFunction2DLattice(ba.SquareLattice2D(25*nm, 0)) pdf = ba.FTDecayFunction2DCauchy(48*nm, 16*nm, 0) p_interference_function.setDecayFunction(pdf) particle_layout = ba.ParticleLayout() - ff = ba.FormFactorCylinder(3.0*nm, 3.0*nm) - position = ba.kvector_t(0.0, 0.0, 0.0) + ff = ba.FormFactorCylinder(3*nm, 3*nm) + position = ba.kvector_t(0, 0, 0) cylinder = ba.Particle(m_particle, ff.clone()) cylinder.setPosition(position) - particle_layout.addParticle(cylinder, 1.0) + particle_layout.addParticle(cylinder, 1) particle_layout.setInterferenceFunction(p_interference_function) vacuum_layer.addLayout(particle_layout) @@ -37,11 +37,11 @@ def get_sample(): def get_simulation(sample): - beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) + beam = ba.Beam(1, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) detector = ba.SphericalDetector(100, 2*deg, 1*deg, 1*deg) simulation = ba.GISASSimulation(beam, sample, detector) distr_1 = ba.DistributionGate(0*deg, 240*deg) - simulation.addParameterDistribution("*/SquareLattice2D/Xi", distr_1, 3, 0.0) + simulation.addParameterDistribution("*/SquareLattice2D/Xi", distr_1, 3, 0) return simulation diff --git a/Examples/scatter2d/Interference2DParaCrystal.py b/Examples/scatter2d/Interference2DParaCrystal.py index 77d5ba2efce7fee36f9ad10adce95ceaea8b3d34..582581928054cbd35184ac5f578a3ccdb94180d8 100644 --- a/Examples/scatter2d/Interference2DParaCrystal.py +++ b/Examples/scatter2d/Interference2DParaCrystal.py @@ -14,28 +14,28 @@ def get_sample(): # Define materials material_Particle = ba.HomogeneousMaterial("Particle", 0.0006, 2e-08) material_Substrate = ba.HomogeneousMaterial("Substrate", 6e-06, 2e-08) - material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) # Define form factors - ff = ba.FormFactorCylinder(4.0*nm, 5.0*nm) + ff = ba.FormFactorCylinder(4*nm, 5*nm) # Define particles particle = ba.Particle(material_Particle, ff) # Define 2D lattices - lattice = ba.BasicLattice2D(10.0*nm, 10.0*nm, 90.0*deg, 0.0*deg) + lattice = ba.BasicLattice2D(10*nm, 10*nm, 90*deg, 0*deg) # Define interference functions - iff = ba.InterferenceFunction2DParaCrystal(lattice, 0.0*nm, 20000.0*nm, - 20000.0*nm) + iff = ba.InterferenceFunction2DParaCrystal(lattice, 0*nm, 20000*nm, + 20000*nm) iff.setIntegrationOverXi(True) - iff_pdf_1 = ba.FTDistribution2DCauchy(1.0*nm, 1.0*nm, 0.0*deg) - iff_pdf_2 = ba.FTDistribution2DCauchy(1.0*nm, 1.0*nm, 0.0*deg) + iff_pdf_1 = ba.FTDistribution2DCauchy(1*nm, 1*nm, 0*deg) + iff_pdf_2 = ba.FTDistribution2DCauchy(1*nm, 1*nm, 0*deg) iff.setProbabilityDistributions(iff_pdf_1, iff_pdf_2) # Define particle layouts layout = ba.ParticleLayout() - layout.addParticle(particle, 1.0) + layout.addParticle(particle, 1) layout.setInterferenceFunction(iff) layout.setWeight(1) layout.setTotalParticleSurfaceDensity(0.01) @@ -54,7 +54,7 @@ def get_sample(): def get_simulation(sample): - beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) + beam = ba.Beam(1, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) detector = ba.SphericalDetector(200, -2*deg, 2*deg, 200, 0*deg, 2*deg) simulation = ba.GISASSimulation(beam, sample, detector) return simulation diff --git a/Examples/scatter2d/Interference2DRotatedSquareLattice.py b/Examples/scatter2d/Interference2DRotatedSquareLattice.py index 09595e8a75f29b3c346abcc635699c75dcad1bd5..0f8457773ea30e526d2db05d4696eecf8a78e2ca 100644 --- a/Examples/scatter2d/Interference2DRotatedSquareLattice.py +++ b/Examples/scatter2d/Interference2DRotatedSquareLattice.py @@ -14,26 +14,26 @@ def get_sample(): # Define materials material_Particle = ba.HomogeneousMaterial("Particle", 0.0006, 2e-08) material_Substrate = ba.HomogeneousMaterial("Substrate", 6e-06, 2e-08) - material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) # Define form factors - ff = ba.FormFactorCylinder(3.0*nm, 3.0*nm) + ff = ba.FormFactorCylinder(3*nm, 3*nm) # Define particles particle = ba.Particle(material_Particle, ff) # Define 2D lattices - lattice = ba.BasicLattice2D(25.0*nm, 25.0*nm, 90.0*deg, 30.0*deg) + lattice = ba.BasicLattice2D(25*nm, 25*nm, 90*deg, 30*deg) # Define interference functions iff = ba.InterferenceFunction2DLattice(lattice) iff_pdf = ba.FTDecayFunction2DCauchy(47.7464829276*nm, 15.9154943092*nm, - 30.0*deg) + 30*deg) iff.setDecayFunction(iff_pdf) # Define particle layouts layout = ba.ParticleLayout() - layout.addParticle(particle, 1.0) + layout.addParticle(particle, 1) layout.setInterferenceFunction(iff) layout.setWeight(1) layout.setTotalParticleSurfaceDensity(0.0016) @@ -52,7 +52,7 @@ def get_sample(): def get_simulation(sample): - beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) + beam = ba.Beam(1, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) detector = ba.SphericalDetector(200, -2*deg, 2*deg, 200, 0*deg, 2*deg) simulation = ba.GISASSimulation(beam, sample, detector) return simulation diff --git a/Examples/scatter2d/Interference2DSquareFiniteLattice.py b/Examples/scatter2d/Interference2DSquareFiniteLattice.py index aa6831b1c70e5483b069f14d84c435e8eae5080c..98416d68a4ce3fbe87e4d7e50bb1da50ce7b020c 100644 --- a/Examples/scatter2d/Interference2DSquareFiniteLattice.py +++ b/Examples/scatter2d/Interference2DSquareFiniteLattice.py @@ -14,24 +14,24 @@ def get_sample(): # Define materials material_Particle = ba.HomogeneousMaterial("Particle", 0.0006, 2e-08) material_Substrate = ba.HomogeneousMaterial("Substrate", 6e-06, 2e-08) - material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) # Define form factors - ff = ba.FormFactorCylinder(3.0*nm, 3.0*nm) + ff = ba.FormFactorCylinder(3*nm, 3*nm) # Define particles particle = ba.Particle(material_Particle, ff) # Define 2D lattices - lattice = ba.BasicLattice2D(25.0*nm, 25.0*nm, 90.0*deg, 0.0*deg) + lattice = ba.BasicLattice2D(25*nm, 25*nm, 90*deg, 0*deg) # Define interference functions iff = ba.InterferenceFunctionFinite2DLattice(lattice, 40, 40) - iff.setPositionVariance(1.0*nm2) + iff.setPositionVariance(1*nm2) # Define particle layouts layout = ba.ParticleLayout() - layout.addParticle(particle, 1.0) + layout.addParticle(particle, 1) layout.setInterferenceFunction(iff) layout.setWeight(1) layout.setTotalParticleSurfaceDensity(0.0016) @@ -50,7 +50,7 @@ def get_sample(): def get_simulation(sample): - beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) + beam = ba.Beam(1, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) detector = ba.SphericalDetector(200, -2*deg, 2*deg, 200, 0*deg, 2*deg) simulation = ba.GISASSimulation(beam, sample, detector) return simulation diff --git a/Examples/scatter2d/MagneticSpheres.py b/Examples/scatter2d/MagneticSpheres.py index d8389c08fcc1d38fc6ee2d8a31a3ce1147b318f8..34c27229ee56e48e12146248f616033e9f2eadc6 100644 --- a/Examples/scatter2d/MagneticSpheres.py +++ b/Examples/scatter2d/MagneticSpheres.py @@ -16,19 +16,19 @@ def get_sample(): material_Particle = ba.HomogeneousMaterial("Particle", 2e-05, 4e-07, magnetic_field) material_Substrate = ba.HomogeneousMaterial("Substrate", 7e-06, 1.8e-07) - material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) # Define form factors - ff = ba.FormFactorFullSphere(5.0*nm) + ff = ba.FormFactorFullSphere(5*nm) # Define particles particle = ba.Particle(material_Particle, ff) - particle_position = kvector_t(0.0*nm, 0.0*nm, -10.0*nm) + particle_position = kvector_t(0*nm, 0*nm, -10*nm) particle.setPosition(particle_position) # Define particle layouts layout = ba.ParticleLayout() - layout.addParticle(particle, 1.0) + layout.addParticle(particle, 1) layout.setWeight(1) layout.setTotalParticleSurfaceDensity(0.01) @@ -47,12 +47,12 @@ def get_sample(): def get_simulation(sample): beam = ba.Beam(1e+12, 0.1*nm, ba.Direction(0.5*deg, 0*deg)) - beam_polarization = kvector_t(0.0, 0.0, 1.0) + beam_polarization = kvector_t(0, 0, 1) beam.setPolarization(beam_polarization) detector = ba.SphericalDetector(200, 6*deg, 0*deg, 3*deg) simulation = ba.GISASSimulation(beam, sample, detector) - analyzer_direction = kvector_t(0.0, 0.0, -1.0) - simulation.detector().setAnalyzerProperties(analyzer_direction, 1.0, 0.5) + analyzer_direction = kvector_t(0, 0, -1) + simulation.detector().setAnalyzerProperties(analyzer_direction, 1, 0.5) return simulation diff --git a/Examples/scatter2d/MesoCrystal.py b/Examples/scatter2d/MesoCrystal.py index fa7a0cbca3e5494f70431ac1fdf186df92347547..9785a4bfe69c8768c9cbe7f94d3c62a6a93ae1df 100644 --- a/Examples/scatter2d/MesoCrystal.py +++ b/Examples/scatter2d/MesoCrystal.py @@ -14,19 +14,19 @@ def get_sample(): # Define materials material_Particle = ba.HomogeneousMaterial("Particle", 0.0006, 2e-08) material_Substrate = ba.HomogeneousMaterial("Substrate", 6e-06, 2e-08) - material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) # Define form factors - ff_1 = ba.FormFactorFullSphere(2.0*nm) - ff_2 = ba.FormFactorCylinder(20.0*nm, 50.0*nm) + ff_1 = ba.FormFactorFullSphere(2*nm) + ff_2 = ba.FormFactorCylinder(20*nm, 50*nm) # Define particles particle_1 = ba.Particle(material_Particle, ff_1) # Define 3D lattices - lattice = ba.Lattice3D(ba.kvector_t(5.0*nm, 0.0*nm, 0.0*nm), - ba.kvector_t(0.0*nm, 5.0*nm, 0.0*nm), - ba.kvector_t(0.0*nm, 0.0*nm, 5.0*nm)) + lattice = ba.Lattice3D(ba.kvector_t(5*nm, 0*nm, 0*nm), + ba.kvector_t(0*nm, 5*nm, 0*nm), + ba.kvector_t(0*nm, 0*nm, 5*nm)) # Define crystals crystal = ba.Crystal(particle_1, lattice) @@ -36,7 +36,7 @@ def get_sample(): # Define particle layouts layout = ba.ParticleLayout() - layout.addParticle(particle_2, 1.0) + layout.addParticle(particle_2, 1) layout.setWeight(1) layout.setTotalParticleSurfaceDensity(0.01) @@ -54,7 +54,7 @@ def get_sample(): def get_simulation(sample): - beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) + beam = ba.Beam(1, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) detector = ba.SphericalDetector(200, -2*deg, 2*deg, 200, 0*deg, 2*deg) simulation = ba.GISASSimulation(beam, sample, detector) return simulation diff --git a/Examples/scatter2d/ParticlesCrossingInterface.py b/Examples/scatter2d/ParticlesCrossingInterface.py index bf4d512400bdc405b4b993b11acf2957a731e646..cc8e7129655d9b346175129a56861baac7ccdf0f 100644 --- a/Examples/scatter2d/ParticlesCrossingInterface.py +++ b/Examples/scatter2d/ParticlesCrossingInterface.py @@ -29,18 +29,18 @@ def get_sample(): # Define materials material_Particle = ba.HomogeneousMaterial("Particle", 0.0006, 2e-08) material_Substrate = ba.HomogeneousMaterial("Substrate", 6e-06, 2e-08) - material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) # Define form factors - ff_1 = ba.FormFactorCylinder(5.0*nm, 5.0*nm) - ff_2 = ba.FormFactorPrism3(10.0*nm, 5.0*nm) + ff_1 = ba.FormFactorCylinder(5*nm, 5*nm) + ff_2 = ba.FormFactorPrism3(10*nm, 5*nm) # Define particles particle_1 = ba.Particle(material_Particle, ff_1) - particle_1_position = kvector_t(0.0*nm, 0.0*nm, -3.0*nm) + particle_1_position = kvector_t(0*nm, 0*nm, -3*nm) particle_1.setPosition(particle_1_position) particle_2 = ba.Particle(material_Particle, ff_2) - particle_2_position = kvector_t(0.0*nm, 0.0*nm, -3.0*nm) + particle_2_position = kvector_t(0*nm, 0*nm, -3*nm) particle_2.setPosition(particle_2_position) # Define interference functions @@ -68,7 +68,7 @@ def get_sample(): def get_simulation(sample): - beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) + beam = ba.Beam(1, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) detector = ba.SphericalDetector(100, 2*deg, 0*deg, 1*deg) simulation = ba.GISASSimulation(beam, sample, detector) return simulation diff --git a/Examples/scatter2d/RectangularGrating.py b/Examples/scatter2d/RectangularGrating.py index 640b24778ab0d8467f25808062d3a38584dbfb1b..f5636a0f74ff21ee34f1c22703168030895828fb 100644 --- a/Examples/scatter2d/RectangularGrating.py +++ b/Examples/scatter2d/RectangularGrating.py @@ -9,14 +9,14 @@ import bornagain as ba from bornagain import deg, micrometer, nm, nm2, kvector_t -def get_sample(lattice_rotation_angle=0.0*deg): +def get_sample(lattice_rotation_angle=0*deg): """ Returns a sample with a grating on a substrate. lattice_rotation_angle = 0 - beam parallel to grating lines lattice_rotation_angle = 90*deg - beam perpendicular to grating lines """ # defining materials - m_vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + m_vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) m_si = ba.HomogeneousMaterial("Si", 5.78164736e-6, 1.02294578e-7) box_length, box_width, box_height = 50*micrometer, 70*nm, 50*nm @@ -24,16 +24,16 @@ def get_sample(lattice_rotation_angle=0.0*deg): # collection of particles interference = ba.InterferenceFunction1DLattice( - lattice_length, 90.0*deg - lattice_rotation_angle) + lattice_length, 90*deg - lattice_rotation_angle) - pdf = ba.FTDecayFunction1DGauss(450.0) + pdf = ba.FTDecayFunction1DGauss(450) interference.setDecayFunction(pdf) box_ff = ba.FormFactorLongBoxLorentz(box_length, box_width, box_height) box = ba.Particle(m_si, box_ff) particle_layout = ba.ParticleLayout() - particle_layout.addParticle(box, 1.0, ba.kvector_t(0.0, 0.0, 0.0), + particle_layout.addParticle(box, 1, ba.kvector_t(0, 0, 0), ba.RotationZ(lattice_rotation_angle)) particle_layout.setInterferenceFunction(interference) @@ -43,9 +43,9 @@ def get_sample(lattice_rotation_angle=0.0*deg): substrate_layer = ba.Layer(m_si) roughness = ba.LayerRoughness() - roughness.setSigma(5.0*nm) + roughness.setSigma(5*nm) roughness.setHurstParameter(0.5) - roughness.setLatteralCorrLength(10.0*nm) + roughness.setLatteralCorrLength(10*nm) multi_layer = ba.MultiLayer() multi_layer.addLayer(vacuum_layer) @@ -54,7 +54,7 @@ def get_sample(lattice_rotation_angle=0.0*deg): def get_simulation(sample): - beam = ba.Beam(100000000.0, 0.134*nm, ba.Direction(0.4*deg, 0*deg)) + beam = ba.Beam(100000000, 0.134*nm, ba.Direction(0.4*deg, 0*deg)) detector = ba.SphericalDetector(200, -0.5*deg, 0.5*deg, 200, 0*deg, 0.6*deg) simulation = ba.GISASSimulation(beam, sample, detector) simulation.getOptions().setMonteCarloIntegration(True, 100) diff --git a/Examples/scatter2d/RotatedPyramids.py b/Examples/scatter2d/RotatedPyramids.py index 477807ae07a4a1a5d5e922335567559adfe22f48..ae646f9978c6b6c603457fc483142d4b2d41adbc 100644 --- a/Examples/scatter2d/RotatedPyramids.py +++ b/Examples/scatter2d/RotatedPyramids.py @@ -14,19 +14,19 @@ def get_sample(): # Define materials material_Particle = ba.HomogeneousMaterial("Particle", 0.0006, 2e-08) material_Substrate = ba.HomogeneousMaterial("Substrate", 6e-06, 2e-08) - material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) # Define form factors - ff = ba.FormFactorPyramid(10.0*nm, 5.0*nm, 54.73*deg) + ff = ba.FormFactorPyramid(10*nm, 5*nm, 54.73*deg) # Define particles particle = ba.Particle(material_Particle, ff) - particle_rotation = ba.RotationZ(45.0*deg) + particle_rotation = ba.RotationZ(45*deg) particle.setRotation(particle_rotation) # Define particle layouts layout = ba.ParticleLayout() - layout.addParticle(particle, 1.0) + layout.addParticle(particle, 1) layout.setWeight(1) layout.setTotalParticleSurfaceDensity(0.01) @@ -44,7 +44,7 @@ def get_sample(): def get_simulation(sample): - beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) + beam = ba.Beam(1, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) detector = ba.SphericalDetector(200, -2*deg, 2*deg, 200, 0*deg, 2*deg) simulation = ba.GISASSimulation(beam, sample, detector) return simulation diff --git a/Examples/scatter2d/SpheresAtHexLattice.py b/Examples/scatter2d/SpheresAtHexLattice.py index a3e8f359a659c2f3e2260d5db74f454d6ceadb5f..77a52d28a4b45e932203b3e4eb4a05c592dd316c 100644 --- a/Examples/scatter2d/SpheresAtHexLattice.py +++ b/Examples/scatter2d/SpheresAtHexLattice.py @@ -15,25 +15,25 @@ def get_sample(): # Define materials material_Particle = ba.HomogeneousMaterial("Particle", 0.0006, 2e-08) material_Substrate = ba.HomogeneousMaterial("Substrate", 6e-06, 2e-08) - material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) # Define form factors - ff = ba.FormFactorFullSphere(10.0*nm) + ff = ba.FormFactorFullSphere(10*nm) # Define particles particle = ba.Particle(material_Particle, ff) # Define 2D lattices - lattice = ba.BasicLattice2D(20.0*nm, 20.0*nm, 120.0*deg, 0.0*deg) + lattice = ba.BasicLattice2D(20*nm, 20*nm, 120*deg, 0*deg) # Define interference functions iff = ba.InterferenceFunction2DLattice(lattice) - iff_pdf = ba.FTDecayFunction2DCauchy(10.0*nm, 10.0*nm, 0.0*deg) + iff_pdf = ba.FTDecayFunction2DCauchy(10*nm, 10*nm, 0*deg) iff.setDecayFunction(iff_pdf) # Define particle layouts layout = ba.ParticleLayout() - layout.addParticle(particle, 1.0) + layout.addParticle(particle, 1) layout.setInterferenceFunction(iff) layout.setWeight(1) layout.setTotalParticleSurfaceDensity(0.00288675134595) @@ -52,7 +52,7 @@ def get_sample(): def get_simulation(sample): - beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) + beam = ba.Beam(1, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) detector = ba.SphericalDetector(200, -1*deg, 1*deg, 200, 0*deg, 1*deg) simulation = ba.GISASSimulation(beam, sample, detector) return simulation diff --git a/Examples/scatter2d/TriangularRipple.py b/Examples/scatter2d/TriangularRipple.py index 6f7dddc73f6d0c6e578b948c8abc72000e5f5abc..8f9c0fd705d76739eaa7392e9e6905b86e3b44cb 100644 --- a/Examples/scatter2d/TriangularRipple.py +++ b/Examples/scatter2d/TriangularRipple.py @@ -15,26 +15,26 @@ def get_sample(): # Define materials material_Particle = ba.HomogeneousMaterial("Particle", 0.0006, 2e-08) material_Substrate = ba.HomogeneousMaterial("Substrate", 6e-06, 2e-08) - material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) # Define form factors - ff = ba.FormFactorSawtoothRippleBox(100.0*nm, 20.0*nm, 4.0*nm, -3.0*nm) + ff = ba.FormFactorSawtoothRippleBox(100*nm, 20*nm, 4*nm, -3*nm) # Define particles particle = ba.Particle(material_Particle, ff) # Define 2D lattices - lattice = ba.BasicLattice2D(200.0*nm, 50.0*nm, 90.0*deg, 0.0*deg) + lattice = ba.BasicLattice2D(200*nm, 50*nm, 90*deg, 0*deg) # Define interference functions iff = ba.InterferenceFunction2DLattice(lattice) iff_pdf = ba.FTDecayFunction2DGauss(159.154943092*nm, 15.9154943092*nm, - 0.0*deg) + 0*deg) iff.setDecayFunction(iff_pdf) # Define particle layouts layout = ba.ParticleLayout() - layout.addParticle(particle, 1.0) + layout.addParticle(particle, 1) layout.setInterferenceFunction(iff) layout.setWeight(1) layout.setTotalParticleSurfaceDensity(0.0001) @@ -53,7 +53,7 @@ def get_sample(): def get_simulation(sample): - beam = ba.Beam(1.0, 0.16*nm, ba.Direction(0.3*deg, 0*deg)) + beam = ba.Beam(1, 0.16*nm, ba.Direction(0.3*deg, 0*deg)) detector = ba.SphericalDetector(200, -1.5*deg, 1.5*deg, 200, 0*deg, 2.5*deg) simulation = ba.GISASSimulation(beam, sample, detector) return simulation diff --git a/Examples/scatter2d/TwoTypesOfCylindersWithSizeDistribution.py b/Examples/scatter2d/TwoTypesOfCylindersWithSizeDistribution.py index e3089e34e46825f1b1911f5c328a730ca98bb63c..48b1a5b7ae5fb7a3b79b000cae90ccd295bd2fa0 100644 --- a/Examples/scatter2d/TwoTypesOfCylindersWithSizeDistribution.py +++ b/Examples/scatter2d/TwoTypesOfCylindersWithSizeDistribution.py @@ -14,25 +14,25 @@ def get_sample(): # Define materials material_Particle = ba.HomogeneousMaterial("Particle", 0.0006, 2e-08) - material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) # Define form factors - ff_1 = ba.FormFactorCylinder(5.0*nm, 5.0*nm) - ff_2 = ba.FormFactorCylinder(10.0*nm, 10.0*nm) + ff_1 = ba.FormFactorCylinder(5*nm, 5*nm) + ff_2 = ba.FormFactorCylinder(10*nm, 10*nm) # Define particles particle_1 = ba.Particle(material_Particle, ff_1) particle_2 = ba.Particle(material_Particle, ff_2) # Define particles with parameter following a distribution - distr_1 = ba.DistributionGaussian(5.0*nm, 1.0*nm) + distr_1 = ba.DistributionGaussian(5*nm, 1*nm) par_distr_1 = ba.ParameterDistribution("/Particle/Cylinder/Radius", - distr_1, 150, 3.0, + distr_1, 150, 3, ba.RealLimits.nonnegative()) particle_distrib_1 = ba.ParticleDistribution(particle_1, par_distr_1) - distr_2 = ba.DistributionGaussian(10.0*nm, 0.2*nm) + distr_2 = ba.DistributionGaussian(10*nm, 0.2*nm) par_distr_2 = ba.ParameterDistribution("/Particle/Cylinder/Radius", - distr_2, 150, 3.0, + distr_2, 150, 3, ba.RealLimits.nonnegative()) particle_distrib_2 = ba.ParticleDistribution(particle_2, par_distr_2) @@ -55,7 +55,7 @@ def get_sample(): def get_simulation(sample): - beam = ba.Beam(1.0, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) + beam = ba.Beam(1, 0.1*nm, ba.Direction(0.2*deg, 0*deg)) detector = ba.SphericalDetector(200, 2*deg, 1*deg, 1*deg) simulation = ba.GISASSimulation(beam, sample, detector) return simulation diff --git a/Examples/specular/BeamAngularDivergence.py b/Examples/specular/BeamAngularDivergence.py index 27f9d9c4e63b8610d6e2a20790d3f42975b6b24c..f4d19657e32ba027db29dff57a5dab2435d74c26 100644 --- a/Examples/specular/BeamAngularDivergence.py +++ b/Examples/specular/BeamAngularDivergence.py @@ -12,8 +12,8 @@ from matplotlib import pyplot as plt # input parameters wavelength = 1.54*ba.angstrom -alpha_i_min = 0.0*ba.deg # min incident angle, deg -alpha_i_max = 2.0*ba.deg # max incident angle, rad +alpha_i_min = 0*ba.deg # min incident angle, deg +alpha_i_max = 2*ba.deg # max incident angle, rad beam_sample_ratio = 0.01 # beam-to-sample size ratio # convolution parameters @@ -35,10 +35,10 @@ d_ti = 30*ba.angstrom def get_sample(): # defining materials - m_vacuum = ba.MaterialBySLD("Vacuum", 0.0, 0.0) - m_ni = ba.MaterialBySLD("Ni", ni_sld_real, 0.0) - m_ti = ba.MaterialBySLD("Ti", ti_sld_real, 0.0) - m_substrate = ba.MaterialBySLD("SiSubstrate", si_sld_real, 0.0) + m_vacuum = ba.MaterialBySLD("Vacuum", 0, 0) + m_ni = ba.MaterialBySLD("Ni", ni_sld_real, 0) + m_ti = ba.MaterialBySLD("Ti", ti_sld_real, 0) + m_substrate = ba.MaterialBySLD("SiSubstrate", si_sld_real, 0) vacuum_layer = ba.Layer(m_vacuum) ni_layer = ba.Layer(m_ni, d_ni) diff --git a/Examples/specular/BeamFullDivergence.py b/Examples/specular/BeamFullDivergence.py index 2aac626629cb72ae1390789a1f2d1a0fd5eec631..38706183bc01419536e950bd308d007c587d9a21 100644 --- a/Examples/specular/BeamFullDivergence.py +++ b/Examples/specular/BeamFullDivergence.py @@ -8,8 +8,8 @@ import bornagain as ba # input parameters wavelength = 1.54*ba.angstrom -alpha_i_min = 0.0*ba.deg # min incident angle, deg -alpha_i_max = 2.0*ba.deg # max incident angle, rad +alpha_i_min = 0*ba.deg # min incident angle, deg +alpha_i_max = 2*ba.deg # max incident angle, rad # convolution parameters d_wl = 0.01*wavelength # spread width for wavelength @@ -33,10 +33,10 @@ def get_sample(): # defining materials # this example implies beam divergence in the wavelength, # thus MaterialBySLD must be used to provide correct result - m_vacuum = ba.MaterialBySLD("Vacuum", 0.0, 0.0) - m_ni = ba.MaterialBySLD("Ni", ni_sld_real, 0.0) - m_ti = ba.MaterialBySLD("Ti", ti_sld_real, 0.0) - m_substrate = ba.MaterialBySLD("SiSubstrate", si_sld_real, 0.0) + m_vacuum = ba.MaterialBySLD("Vacuum", 0, 0) + m_ni = ba.MaterialBySLD("Ni", ni_sld_real, 0) + m_ti = ba.MaterialBySLD("Ti", ti_sld_real, 0) + m_substrate = ba.MaterialBySLD("SiSubstrate", si_sld_real, 0) vacuum_layer = ba.Layer(m_vacuum) ni_layer = ba.Layer(m_ni, d_ni) diff --git a/Examples/specular/TOFRWithResolution.py b/Examples/specular/TOFRWithResolution.py index f7d3783571cf8373fce71e153eca66c5237e7186..654cd03059ff871ea9ed0f056c21f7dcb9573ef1 100644 --- a/Examples/specular/TOFRWithResolution.py +++ b/Examples/specular/TOFRWithResolution.py @@ -21,10 +21,10 @@ def get_sample(): """ # creating materials - m_ambient = ba.MaterialBySLD("Ambient", 0.0, 0.0) - m_ti = ba.MaterialBySLD("Ti", -1.9493e-06, 0.0) - m_ni = ba.MaterialBySLD("Ni", 9.4245e-06, 0.0) - m_substrate = ba.MaterialBySLD("SiSubstrate", 2.0704e-06, 0.0) + m_ambient = ba.MaterialBySLD("Ambient", 0, 0) + m_ti = ba.MaterialBySLD("Ti", -1.9493e-06, 0) + m_ni = ba.MaterialBySLD("Ni", 9.4245e-06, 0) + m_substrate = ba.MaterialBySLD("SiSubstrate", 2.0704e-06, 0) # creating layers ambient_layer = ba.Layer(m_ambient) @@ -48,7 +48,7 @@ def get_simulation(sample, scan_size=500): Defines and returns specular simulation with a qz-defined beam """ - qzs = np.linspace(0.01, 1.0, scan_size) # qz-values + qzs = np.linspace(0.01, 1, scan_size) # qz-values dq = 0.03*qzs n_sig = 2.0 n_samples = 25 diff --git a/Examples/specular/TimeOfFlightReflectometry.py b/Examples/specular/TimeOfFlightReflectometry.py index d81eace85f511678342a8e38410747520f889d59..7335778a2807c9fa7478aec2d400848a29537cd5 100644 --- a/Examples/specular/TimeOfFlightReflectometry.py +++ b/Examples/specular/TimeOfFlightReflectometry.py @@ -19,10 +19,10 @@ def get_sample(): """ # creating materials - m_ambient = ba.MaterialBySLD("Ambient", 0.0, 0.0) - m_ti = ba.MaterialBySLD("Ti", -1.9493e-06, 0.0) - m_ni = ba.MaterialBySLD("Ni", 9.4245e-06, 0.0) - m_substrate = ba.MaterialBySLD("SiSubstrate", 2.0704e-06, 0.0) + m_ambient = ba.MaterialBySLD("Ambient", 0, 0) + m_ti = ba.MaterialBySLD("Ti", -1.9493e-06, 0) + m_ni = ba.MaterialBySLD("Ni", 9.4245e-06, 0) + m_substrate = ba.MaterialBySLD("SiSubstrate", 2.0704e-06, 0) # creating layers ambient_layer = ba.Layer(m_ambient) @@ -46,7 +46,7 @@ def get_simulation(sample, scan_size=500): Defines and returns specular simulation with a qz-defined beam """ - qzs = np.linspace(0.01, 1.0, scan_size) # qz-values + qzs = np.linspace(0.01, 1, scan_size) # qz-values scan = ba.QSpecScan(qzs) simulation = ba.SpecularSimulation() simulation.setScan(scan) diff --git a/Examples/varia/AccessingSimulationResults.py b/Examples/varia/AccessingSimulationResults.py index b99f011444883dd83c53cc6668ee137002566024..332b0172168d154cae3d82b423907901ba07dc67 100644 --- a/Examples/varia/AccessingSimulationResults.py +++ b/Examples/varia/AccessingSimulationResults.py @@ -20,17 +20,17 @@ def get_sample(): # Define materials material_Particle = ba.HomogeneousMaterial("Particle", 0.0006, 2e-08) material_Substrate = ba.HomogeneousMaterial("Substrate", 6e-06, 2e-08) - material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) # Define form factors - ff = ba.FormFactorCylinder(5.0*nm, 5.0*nm) + ff = ba.FormFactorCylinder(5*nm, 5*nm) # Define particles particle = ba.Particle(material_Particle, ff) # Define particle layouts layout = ba.ParticleLayout() - layout.addParticle(particle, 1.0) + layout.addParticle(particle, 1) layout.setWeight(1) layout.setTotalParticleSurfaceDensity(0.01) @@ -51,7 +51,7 @@ def get_simulation(sample): """ Returns a GISAXS simulation with beam and detector defined. """ - beam = ba.Beam(1e5, 1.0*angstrom, ba.Direction(0.2*deg, 0*deg)) + beam = ba.Beam(1e5, 1*angstrom, ba.Direction(0.2*deg, 0*deg)) det = ba.SphericalDetector(201, -2*deg, 2*deg, 201, 0*deg, 2*deg) simulation = ba.GISASSimulation(beam, sample, det) return simulation @@ -95,7 +95,7 @@ def plot_slices(hist): noisy = get_noisy_image(hist) # projection along Y, slice at fixed x-value - proj1 = noisy.projectionY(0.0) + proj1 = noisy.projectionY(0) plt.semilogy(proj1.binCenters(), proj1.binValues(), label=r'$\phi=0.0^{\circ}$') @@ -113,7 +113,7 @@ def plot_slices(hist): label=r'$<\phi>=0.5^{\circ}$') plt.xlim(proj1.getXmin(), proj1.getXmax()) - plt.ylim(proj2.getMinimum(), proj1.getMaximum()*10.0) + plt.ylim(proj2.getMinimum(), proj1.getMaximum()*10) plt.xlabel(r'$\alpha_f ^{\circ}$', fontsize=16) plt.legend(loc='upper right') plt.tight_layout() @@ -131,7 +131,7 @@ def plot(hist): plt.title("Intensity as colormap") plt.subplot(2, 2, 2) - crop = hist.crop(-1.0, 0.5, 1.0, 1.0) + crop = hist.crop(-1, 0.5, 1, 1) ba_plot.plot_histogram(crop) plt.title("Cropping") diff --git a/Examples/varia/AllFormFactorsAvailable.py b/Examples/varia/AllFormFactorsAvailable.py index b7ecd5bd3fef118fe9a939b4526d187c997d06cd..6cac90a8be3d6759725344255332f91993a956cd 100644 --- a/Examples/varia/AllFormFactorsAvailable.py +++ b/Examples/varia/AllFormFactorsAvailable.py @@ -8,32 +8,32 @@ import ba_plot from bornagain import deg, angstrom from matplotlib import pyplot as plt -phi_min, phi_max = -2.0, 2.0 -alpha_min, alpha_max = 0.0, 2.0 +phi_min, phi_max = -2, 2.0 +alpha_min, alpha_max = 0, 2.0 formfactors = [ - ba.FormFactorAnisoPyramid(20.0, 16.0, 13.0, 60.0*deg), - ba.FormFactorBox(20.0, 16.0, 13.0), - ba.FormFactorCantellatedCube(15.0, 6.0), - ba.FormFactorCone(10.0, 13.0, 60.0*deg), - ba.FormFactorCone6(10.0, 13.0, 60.0*deg), - ba.FormFactorCuboctahedron(20.0, 13.0, 0.7, 60.0*deg), - ba.FormFactorCylinder(8.0, 16.0), - ba.FormFactorDodecahedron(5.0), - ba.FormFactorEllipsoidalCylinder(8.0, 13.0, 16.0), - ba.FormFactorFullSphere(8.0), - ba.FormFactorFullSpheroid(10.0, 13.0), - ba.FormFactorHemiEllipsoid(10.0, 6.0, 8.0), - ba.FormFactorIcosahedron(8.0), - ba.FormFactorPrism3(10.0, 13.0), - ba.FormFactorPrism6(5.0, 11.0), - ba.FormFactorPyramid(18.0, 13.0, 60.0*deg), - ba.FormFactorCosineRippleBox(27.0, 20.0, 14.0), - ba.FormFactorSawtoothRippleBox(36.0, 25.0, 14.0, 3.0), - ba.FormFactorTetrahedron(15.0, 6.0, 60.0*deg), - ba.FormFactorTruncatedCube(15.0, 6.0), - ba.FormFactorTruncatedSphere(5.0, 7.0, 0), - ba.FormFactorTruncatedSpheroid(7.5, 9.0, 1.2, 0), + ba.FormFactorAnisoPyramid(20, 16, 13, 60*deg), + ba.FormFactorBox(20, 16, 13), + ba.FormFactorCantellatedCube(15, 6), + ba.FormFactorCone(10, 13, 60*deg), + ba.FormFactorCone6(10, 13, 60*deg), + ba.FormFactorCuboctahedron(20, 13, 0.7, 60*deg), + ba.FormFactorCylinder(8, 16), + ba.FormFactorDodecahedron(5), + ba.FormFactorEllipsoidalCylinder(8, 13, 16), + ba.FormFactorFullSphere(8), + ba.FormFactorFullSpheroid(10, 13), + ba.FormFactorHemiEllipsoid(10, 6, 8), + ba.FormFactorIcosahedron(8), + ba.FormFactorPrism3(10, 13), + ba.FormFactorPrism6(5, 11), + ba.FormFactorPyramid(18, 13, 60*deg), + ba.FormFactorCosineRippleBox(27, 20, 14), + ba.FormFactorSawtoothRippleBox(36, 25, 14, 3), + ba.FormFactorTetrahedron(15, 6, 60*deg), + ba.FormFactorTruncatedCube(15, 6), + ba.FormFactorTruncatedSphere(5, 7, 0), + ba.FormFactorTruncatedSpheroid(7.5, 9, 1.2, 0), ] @@ -42,13 +42,13 @@ def get_sample(formfactor): Returns a one-layer sample that contains particles with given form factor. """ # defining materials - m_vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + m_vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) m_particle = ba.HomogeneousMaterial("Particle", 6e-4, 2e-8) # collection of particles particle = ba.Particle(m_particle, formfactor) particle_layout = ba.ParticleLayout() - particle_layout.addParticle(particle, 1.0) + particle_layout.addParticle(particle, 1) vacuum_layer = ba.Layer(m_vacuum) vacuum_layer.addLayout(particle_layout) @@ -65,7 +65,7 @@ def get_simulation(sample): 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) + simulation.setBeamParameters(1*angstrom, 0.2*deg, 0*deg) simulation.setSample(sample) return simulation @@ -103,7 +103,7 @@ def simulate_and_plot(): plt.tick_params(axis='both', which='major', labelsize=8) plt.tick_params(axis='both', which='minor', labelsize=6) - plt.xticks(numpy.arange(phi_min, phi_max + 0.0001, 1.0)) + plt.xticks(numpy.arange(phi_min, phi_max + 0.0001, 1)) plt.text(-0.1, 2.15, name, diff --git a/Examples/varia/AxesInDifferentUnits.py b/Examples/varia/AxesInDifferentUnits.py index 09d0919d796732c9ca8f0ed598493542f45028c8..41ef48517e9835d1d80b144483d06d671d5188b4 100644 --- a/Examples/varia/AxesInDifferentUnits.py +++ b/Examples/varia/AxesInDifferentUnits.py @@ -18,17 +18,17 @@ def get_sample(): # Define materials material_Particle = ba.HomogeneousMaterial("Particle", 0.0006, 2e-08) material_Substrate = ba.HomogeneousMaterial("Substrate", 6e-06, 2e-08) - material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) # Define form factors - ff = ba.FormFactorCylinder(5.0*nm, 5.0*nm) + ff = ba.FormFactorCylinder(5*nm, 5*nm) # Define particles particle = ba.Particle(material_Particle, ff) # Define particle layouts layout = ba.ParticleLayout() - layout.addParticle(particle, 1.0) + layout.addParticle(particle, 1) layout.setWeight(1) layout.setTotalParticleSurfaceDensity(0.01) @@ -46,7 +46,7 @@ def get_sample(): def get_simulation(sample): - beam = ba.Beam(1.0, 1.0*angstrom, ba.Direction(0.2*deg, 0.0*deg)) + beam = ba.Beam(1, 1*angstrom, ba.Direction(0.2*deg, 0*deg)) # PILATUS detector detector_distance = 2000.0 # in mm @@ -55,7 +55,7 @@ def get_simulation(sample): width = pilatus_npx*pilatus_pixel_size height = pilatus_npy*pilatus_pixel_size detector = ba.RectangularDetector(pilatus_npx, width, pilatus_npy, height) - detector.setPerpendicularToSampleX(detector_distance, width/2., 0.0) + detector.setPerpendicularToSampleX(detector_distance, width/2., 0) simulation = ba.GISASSimulation(beam, sample, detector) return simulation diff --git a/Examples/varia/BasicPolarizedReflectometry.py b/Examples/varia/BasicPolarizedReflectometry.py index 1783e0672aacdb044ddec1152f42e0363cdce778..230465be77fee04d1a764a03e0acd620eec28cd5 100644 --- a/Examples/varia/BasicPolarizedReflectometry.py +++ b/Examples/varia/BasicPolarizedReflectometry.py @@ -16,14 +16,14 @@ def get_sample(): """ # Define materials - material_Ambient = ba.MaterialBySLD("Ambient", 0.0, 0.0) + material_Ambient = ba.MaterialBySLD("Ambient", 0, 0) magnetic_field = kvector_t(0, 100000000, 0) material_Layer = ba.MaterialBySLD("Layer", 0.0001, 1e-08, magnetic_field) material_Substrate = ba.MaterialBySLD("Substrate", 7e-05, 2e-06) # Define layers layer_1 = ba.Layer(material_Ambient) - layer_2 = ba.Layer(material_Layer, 10.0*nm) + layer_2 = ba.Layer(material_Layer, 10*nm) layer_3 = ba.Layer(material_Substrate) # Define sample @@ -40,7 +40,7 @@ def get_simulation(sample, scan_size=500): Defines and returns a specular simulation. """ simulation = ba.SpecularSimulation() - scan = ba.AngularSpecScan(1.54*angstrom, scan_size, 0.0*deg, 5.0*deg) + scan = ba.AngularSpecScan(1.54*angstrom, scan_size, 0*deg, 5*deg) simulation.setScan(scan) simulation.setSample(sample) return simulation @@ -56,7 +56,7 @@ def run_simulation(polarization=ba.kvector_t(0, 1, 0), # adding polarization and analyzer operator simulation.beam().setPolarization(polarization) - simulation.detector().setAnalyzerProperties(analyzer, 1.0, 0.5) + simulation.detector().setAnalyzerProperties(analyzer, 1, 0.5) simulation.runSimulation() return simulation.result() diff --git a/Examples/varia/CustomFormFactor.py b/Examples/varia/CustomFormFactor.py index 2f962490866ed49d3c75595893f008227efe5a9d..d185d6e52030d1ad97a20346790345bc472976ae 100644 --- a/Examples/varia/CustomFormFactor.py +++ b/Examples/varia/CustomFormFactor.py @@ -50,15 +50,15 @@ def get_sample(): Returns a sample with particles, having a custom form factor, on a substrate. """ # defining materials - m_vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + m_vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) m_substrate = ba.HomogeneousMaterial("Substrate", 6e-6, 2e-8) m_particle = ba.HomogeneousMaterial("Particle", 6e-4, 2e-8) # collection of particles - ff = CustomFormFactor(20.0*nm, 15.0*nm) + ff = CustomFormFactor(20*nm, 15*nm) particle = ba.Particle(m_particle, ff) particle_layout = ba.ParticleLayout() - particle_layout.addParticle(particle, 1.0) + particle_layout.addParticle(particle, 1) vacuum_layer = ba.Layer(m_vacuum) vacuum_layer.addLayout(particle_layout) substrate_layer = ba.Layer(m_substrate) @@ -71,7 +71,7 @@ def get_sample(): def get_simulation(sample): - beam = ba.Beam(1.0, 1.0*angstrom, ba.Direction(0.2*deg, 0.0*deg)) + beam = ba.Beam(1, 1*angstrom, ba.Direction(0.2*deg, 0*deg)) det = ba.SphericalDetector(100, -1*deg, 1*deg, 100, 0*deg, 2*deg) simulation = ba.GISASSimulation(beam, sample, det) simulation.getOptions().setNumberOfThreads( diff --git a/Examples/varia/DepthProbe.py b/Examples/varia/DepthProbe.py index c954d3dc36b65319c1f8d84387d606a2bf8783ea..5651adef0f4bd9d04654ebd7de3027a8bf485e85 100644 --- a/Examples/varia/DepthProbe.py +++ b/Examples/varia/DepthProbe.py @@ -28,14 +28,14 @@ import bornagain as ba from bornagain import angstrom, deg, nm, nm2, kvector_t # layer thicknesses in angstroms -t_Ti = 130.0*angstrom -t_Pt = 320.0*angstrom -t_Ti_top = 100.0*angstrom -t_TiO2 = 30.0*angstrom +t_Ti = 130*angstrom +t_Pt = 320*angstrom +t_Ti_top = 100*angstrom +t_TiO2 = 30*angstrom # beam data -ai_min = 0.0*deg # minimum incident angle -ai_max = 1.0*deg # maximum incident angle +ai_min = 0*deg # minimum incident angle +ai_max = 1*deg # maximum incident angle n_ai_bins = 5000 # number of bins in incident angle axis beam_sample_ratio = 0.01 # beam-to-sample size ratio wl = 10*angstrom # wavelength in angstroms @@ -59,16 +59,16 @@ def get_sample(): # Define materials material_D2O = ba.HomogeneousMaterial("D2O", 0.00010116, 1.809e-12) material_Pt = ba.HomogeneousMaterial("Pt", 0.00010117, 3.01822e-08) - material_Si = ba.HomogeneousMaterial("Si", 3.3009e-05, 0.0) + material_Si = ba.HomogeneousMaterial("Si", 3.3009e-05, 0) material_Ti = ba.HomogeneousMaterial("Ti", -3.0637e-05, 1.5278e-08) material_TiO2 = ba.HomogeneousMaterial("TiO2", 4.1921e-05, 8.1293e-09) # Define layers layer_1 = ba.Layer(material_Si) - layer_2 = ba.Layer(material_Ti, 13.0*nm) - layer_3 = ba.Layer(material_Pt, 32.0*nm) - layer_4 = ba.Layer(material_Ti, 10.0*nm) - layer_5 = ba.Layer(material_TiO2, 3.0*nm) + layer_2 = ba.Layer(material_Ti, 13*nm) + layer_3 = ba.Layer(material_Pt, 32*nm) + layer_4 = ba.Layer(material_Ti, 10*nm) + layer_5 = ba.Layer(material_TiO2, 3*nm) layer_6 = ba.Layer(material_D2O) # Define sample @@ -87,7 +87,7 @@ def get_simulation(sample): """ Returns a depth-probe simulation. """ - alpha_distr = ba.DistributionGaussian(0.0, d_ang) + alpha_distr = ba.DistributionGaussian(0, d_ang) footprint = ba.FootprintSquare(beam_sample_ratio) simulation = ba.DepthProbeSimulation() simulation.setBeamParameters(wl, n_ai_bins, ai_min, ai_max, footprint) diff --git a/Examples/varia/FindPeaks.py b/Examples/varia/FindPeaks.py index e312c82980f9c971f2d5e730780a8848120a51da..996d66e4c8cb958942a5fc2855f3f62d594008e0 100644 --- a/Examples/varia/FindPeaks.py +++ b/Examples/varia/FindPeaks.py @@ -10,14 +10,14 @@ import ba_plot from matplotlib import pyplot as plt -def get_sample(lattice_rotation_angle=0.0*deg): +def get_sample(lattice_rotation_angle=0*deg): """ Returns a sample with a grating on a substrate. lattice_rotation_angle = 0 - beam parallel to grating lines lattice_rotation_angle = 90*deg - beam perpendicular to grating lines """ # defining materials - m_vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + m_vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) m_si = ba.HomogeneousMaterial("Si", 5.78164736e-6, 1.02294578e-7) box_length, box_width, box_height = 50*micrometer, 70*nm, 50*nm @@ -25,16 +25,16 @@ def get_sample(lattice_rotation_angle=0.0*deg): # collection of particles interference = ba.InterferenceFunction1DLattice( - lattice_length, 90.0*deg - lattice_rotation_angle) + lattice_length, 90*deg - lattice_rotation_angle) - pdf = ba.FTDecayFunction1DGauss(450.0) + pdf = ba.FTDecayFunction1DGauss(450) interference.setDecayFunction(pdf) box_ff = ba.FormFactorLongBoxLorentz(box_length, box_width, box_height) box = ba.Particle(m_si, box_ff) particle_layout = ba.ParticleLayout() - particle_layout.addParticle(box, 1.0, ba.kvector_t(0.0, 0.0, 0.0), + particle_layout.addParticle(box, 1, ba.kvector_t(0, 0, 0), ba.RotationZ(lattice_rotation_angle)) particle_layout.setInterferenceFunction(interference) @@ -44,9 +44,9 @@ def get_sample(lattice_rotation_angle=0.0*deg): substrate_layer = ba.Layer(m_si) roughness = ba.LayerRoughness() - roughness.setSigma(5.0*nm) + roughness.setSigma(5*nm) roughness.setHurstParameter(0.5) - roughness.setLatteralCorrLength(10.0*nm) + roughness.setLatteralCorrLength(10*nm) multi_layer = ba.MultiLayer() multi_layer.addLayer(vacuum_layer) @@ -55,7 +55,7 @@ def get_sample(lattice_rotation_angle=0.0*deg): def get_simulation(sample): - beam = ba.Beam(1e8, 1.34*angstrom, ba.Direction(0.4*deg, 0.0*deg)) + beam = ba.Beam(1e8, 1.34*angstrom, ba.Direction(0.4*deg, 0*deg)) det = ba.SphericalDetector(200, -0.5*deg, 0.5*deg, 200, 0*deg, 0.6*deg) simulation = ba.GISASSimulation(beam, sample, det) simulation.getOptions().setMonteCarloIntegration(True, 100) diff --git a/Examples/varia/FootprintCorrection.py b/Examples/varia/FootprintCorrection.py index 12d46ac9471a5a27090fd1e02f115f314adbccba..f280ede7619290b893dd484d4df4d4473fcf1951 100644 --- a/Examples/varia/FootprintCorrection.py +++ b/Examples/varia/FootprintCorrection.py @@ -15,10 +15,10 @@ def get_sample(): """ # creating materials - m_ambient = ba.MaterialBySLD("Ambient", 0.0, 0.0) - m_ti = ba.MaterialBySLD("Ti", -1.9493e-06, 0.0) - m_ni = ba.MaterialBySLD("Ni", 9.4245e-06, 0.0) - m_substrate = ba.MaterialBySLD("SiSubstrate", 2.0704e-06, 0.0) + m_ambient = ba.MaterialBySLD("Ambient", 0, 0) + m_ti = ba.MaterialBySLD("Ti", -1.9493e-06, 0) + m_ni = ba.MaterialBySLD("Ni", 9.4245e-06, 0) + m_substrate = ba.MaterialBySLD("SiSubstrate", 2.0704e-06, 0) # creating layers ambient_layer = ba.Layer(m_ambient) @@ -42,7 +42,7 @@ def get_simulation(footprint): Defines and returns a specular simulation. """ simulation = ba.SpecularSimulation() - scan = ba.AngularSpecScan(1.54*angstrom, 500, 0.0*deg, 0.6*deg) + scan = ba.AngularSpecScan(1.54*angstrom, 500, 0*deg, 0.6*deg) scan.setFootprintFactor(footprint) simulation.setScan(scan) return simulation diff --git a/Examples/varia/GratingMC.py b/Examples/varia/GratingMC.py index d2cee7b4c29ae1e94674b44510a2a2434b2ad406..a51a10c110e074c5cc6a1596481fad6da594d4c3 100644 --- a/Examples/varia/GratingMC.py +++ b/Examples/varia/GratingMC.py @@ -10,14 +10,14 @@ import ba_plot from matplotlib import pyplot as plt -def get_sample(lattice_rotation_angle=0.0*deg): +def get_sample(lattice_rotation_angle=0*deg): """ Returns a sample with a grating on a substrate. lattice_rotation_angle = 0 - beam parallel to grating lines lattice_rotation_angle = 90*deg - beam perpendicular to grating lines """ # defining materials - m_vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + m_vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) m_si = ba.HomogeneousMaterial("Si", 5.78164736e-6, 1.02294578e-7) box_length, box_width, box_height = 50*micrometer, 70*nm, 50*nm @@ -25,16 +25,16 @@ def get_sample(lattice_rotation_angle=0.0*deg): # collection of particles interference = ba.InterferenceFunction1DLattice( - lattice_length, 90.0*deg - lattice_rotation_angle) + lattice_length, 90*deg - lattice_rotation_angle) - pdf = ba.FTDecayFunction1DGauss(450.0) + pdf = ba.FTDecayFunction1DGauss(450) interference.setDecayFunction(pdf) box_ff = ba.FormFactorLongBoxLorentz(box_length, box_width, box_height) box = ba.Particle(m_si, box_ff) particle_layout = ba.ParticleLayout() - particle_layout.addParticle(box, 1.0, ba.kvector_t(0.0, 0.0, 0.0), + particle_layout.addParticle(box, 1, ba.kvector_t(0, 0, 0), ba.RotationZ(lattice_rotation_angle)) particle_layout.setInterferenceFunction(interference) @@ -44,9 +44,9 @@ def get_sample(lattice_rotation_angle=0.0*deg): substrate_layer = ba.Layer(m_si) roughness = ba.LayerRoughness() - roughness.setSigma(5.0*nm) + roughness.setSigma(5*nm) roughness.setHurstParameter(0.5) - roughness.setLatteralCorrLength(10.0*nm) + roughness.setLatteralCorrLength(10*nm) multi_layer = ba.MultiLayer() multi_layer.addLayer(vacuum_layer) @@ -58,7 +58,7 @@ def get_simulation(sample): """ Create and return GISAXS simulation with beam and detector defined """ - beam = ba.Beam(1e8, 1.34*angstrom, ba.Direction(0.4*deg, 0.0*deg)) + beam = ba.Beam(1e8, 1.34*angstrom, ba.Direction(0.4*deg, 0*deg)) det = ba.SphericalDetector(200, -0.5*deg, 0.5*deg, 200, 0*deg, 0.6*deg) simulation = ba.GISASSimulation(beam, sample, det) simulation.getOptions().setMonteCarloIntegration(True, 100) diff --git a/Examples/varia/Interference1DLattice.py b/Examples/varia/Interference1DLattice.py index ee0e49a2b3a22594a4ea95e9c9e258268dd8f3e6..b06858fe1f1b6d029f8dbebd597b5bebac92830e 100644 --- a/Examples/varia/Interference1DLattice.py +++ b/Examples/varia/Interference1DLattice.py @@ -17,24 +17,24 @@ def get_sample(): # Define materials material_Particle = ba.HomogeneousMaterial("Particle", 0.0006, 2e-08) material_Substrate = ba.HomogeneousMaterial("Substrate", 6e-06, 2e-08) - material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) # Define form factors - ff = ba.FormFactorBox(10.0*nm, 10000.0*nm, 10.0*nm) + ff = ba.FormFactorBox(10*nm, 10000*nm, 10*nm) # Define particles particle = ba.Particle(material_Particle, ff) - particle_rotation = ba.RotationZ(45.0*deg) + particle_rotation = ba.RotationZ(45*deg) particle.setRotation(particle_rotation) # Define interference functions - iff = ba.InterferenceFunction1DLattice(30.0*nm, 45.0*deg) - iff_pdf = ba.FTDecayFunction1DCauchy(1000.0*nm) + iff = ba.InterferenceFunction1DLattice(30*nm, 45*deg) + iff_pdf = ba.FTDecayFunction1DCauchy(1000*nm) iff.setDecayFunction(iff_pdf) # Define particle layouts layout = ba.ParticleLayout() - layout.addParticle(particle, 1.0) + layout.addParticle(particle, 1) layout.setInterferenceFunction(iff) layout.setWeight(1) layout.setTotalParticleSurfaceDensity(0.01) @@ -53,7 +53,7 @@ def get_sample(): def get_simulation(sample): - beam = ba.Beam(1.0, 1.0*angstrom, ba.Direction(0.2*deg, 0.0*deg)) + beam = ba.Beam(1, 1*angstrom, ba.Direction(0.2*deg, 0*deg)) det = ba.SphericalDetector(200, -1*deg, 1*deg, 200, 0*deg, 2*deg) simulation = ba.GISASSimulation(beam, sample, det) simulation.getOptions().setMonteCarloIntegration(True, 100) diff --git a/Examples/varia/LargeParticlesFormFactor.py b/Examples/varia/LargeParticlesFormFactor.py index 219737a9900f0d62a2234f7ed0b2326a84371e64..33d555af113ee319df3b758d6cc048434dc45380 100644 --- a/Examples/varia/LargeParticlesFormFactor.py +++ b/Examples/varia/LargeParticlesFormFactor.py @@ -21,7 +21,7 @@ def get_sample(cylinder_radius, cylinder_height): Returns a sample with cylindrical particles on a substrate. """ # defining materials - m_vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + m_vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) m_substrate = ba.HomogeneousMaterial("Substrate", 6e-6, 2e-8) m_particle = ba.HomogeneousMaterial("Particle", 6e-4, 2e-8) @@ -29,7 +29,7 @@ def get_sample(cylinder_radius, cylinder_height): cylinder_ff = ba.FormFactorCylinder(cylinder_radius, cylinder_height) cylinder = ba.Particle(m_particle, cylinder_ff) particle_layout = ba.ParticleLayout() - particle_layout.addParticle(cylinder, 1.0) + particle_layout.addParticle(cylinder, 1) vacuum_layer = ba.Layer(m_vacuum) vacuum_layer.addLayout(particle_layout) @@ -46,7 +46,7 @@ def get_simulation(sample, integration_flag): Returns a GISAXS simulation with defined beam and detector. If integration_flag=True, the simulation will integrate over detector bins. """ - beam = ba.Beam(1, 1.0*angstrom, ba.Direction(0.2*deg, 0*deg)) + beam = ba.Beam(1, 1*angstrom, ba.Direction(0.2*deg, 0*deg)) det = ba.SphericalDetector(200, -2*deg, 2*deg, 200, 0*deg, 2*deg) simulation = ba.GISASSimulation(beam, sample, det) simulation.getOptions().setMonteCarloIntegration(integration_flag, 50) @@ -109,7 +109,7 @@ def simulate_and_plot(): zmax = condition['zmax'] ba_plot.plot_colormap(result, intensity_min=zmin, intensity_max=zmax) - plt.text(0.0, + plt.text(0, 2.1, conditions[i_plot]['title'], horizontalalignment='center', diff --git a/Examples/varia/MaterialProfile.py b/Examples/varia/MaterialProfile.py index 82bd3391d5b824983bdf72d55146b16b8c279868..440d41e5d8a61d5cf905ec7d34e4b57a8873fe6b 100644 --- a/Examples/varia/MaterialProfile.py +++ b/Examples/varia/MaterialProfile.py @@ -15,10 +15,10 @@ def get_sample(): """ # creating materials - m_ambient = ba.MaterialBySLD("Ambient", 0.0, 0.0) - m_ti = ba.MaterialBySLD("Ti", -1.9493e-06, 0.0) - m_ni = ba.MaterialBySLD("Ni", 9.4245e-06, 0.0) - m_substrate = ba.MaterialBySLD("SiSubstrate", 2.0704e-06, 0.0) + m_ambient = ba.MaterialBySLD("Ambient", 0, 0) + m_ti = ba.MaterialBySLD("Ti", -1.9493e-06, 0) + m_ni = ba.MaterialBySLD("Ni", 9.4245e-06, 0) + m_substrate = ba.MaterialBySLD("SiSubstrate", 2.0704e-06, 0) # creating layers ambient_layer = ba.Layer(m_ambient) diff --git a/Examples/varia/MaterialProfileWithParticles.py b/Examples/varia/MaterialProfileWithParticles.py index 02f7b25910ea4c8e7715113b84a8d0348ca66cb6..f3df2bfd0c16e693f4888614b8054ad7fc1fb4a6 100644 --- a/Examples/varia/MaterialProfileWithParticles.py +++ b/Examples/varia/MaterialProfileWithParticles.py @@ -16,11 +16,11 @@ def get_sample(): """ # creating materials - m_ambient = ba.MaterialBySLD("Ambient", 0.0, 0.0) - m_ti = ba.MaterialBySLD("Ti", -1.9493e-06, 0.0) - m_ni = ba.MaterialBySLD("Ni", 9.4245e-06, 0.0) - m_particle = ba.MaterialBySLD("Particle", 5e-6, 0.0) - m_substrate = ba.MaterialBySLD("SiSubstrate", 2.0704e-06, 0.0) + m_ambient = ba.MaterialBySLD("Ambient", 0, 0) + m_ti = ba.MaterialBySLD("Ti", -1.9493e-06, 0) + m_ni = ba.MaterialBySLD("Ni", 9.4245e-06, 0) + m_particle = ba.MaterialBySLD("Particle", 5e-6, 0) + m_substrate = ba.MaterialBySLD("SiSubstrate", 2.0704e-06, 0) # creating layers ambient_layer = ba.Layer(m_ambient) diff --git a/Examples/varia/OffSpecularSimulation.py b/Examples/varia/OffSpecularSimulation.py index 023e03050a11be786df1ea19141f3d0e6c978931..93928e4b23246c70d7b6b7bfa26f47c62a0e30ec 100644 --- a/Examples/varia/OffSpecularSimulation.py +++ b/Examples/varia/OffSpecularSimulation.py @@ -5,9 +5,9 @@ Long boxes at 1D lattice, ba.OffSpecular simulation import bornagain as ba from bornagain import angstrom, deg, nm, nm2, kvector_t -phi_f_min, phi_f_max = -1.0, 1.0 -alpha_f_min, alpha_f_max = 0.0, 10.0 -alpha_i_min, alpha_i_max = 0.0, 10.0 # incoming beam +phi_f_min, phi_f_max = -1, 1.0 +alpha_f_min, alpha_f_max = 0, 10.0 +alpha_i_min, alpha_i_max = 0, 10.0 # incoming beam def get_sample(): @@ -19,24 +19,24 @@ def get_sample(): # Define materials material_Particle = ba.HomogeneousMaterial("Particle", 0.0006, 2e-08) material_Substrate = ba.HomogeneousMaterial("Substrate", 6e-06, 2e-08) - material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0) # Define form factors - ff = ba.FormFactorBox(1000.0*nm, 20.0*nm, 10.0*nm) + ff = ba.FormFactorBox(1000*nm, 20*nm, 10*nm) # Define particles particle = ba.Particle(material_Particle, ff) - particle_rotation = ba.RotationZ(90.0*deg) + particle_rotation = ba.RotationZ(90*deg) particle.setRotation(particle_rotation) # Define interference functions - iff = ba.InterferenceFunction1DLattice(100.0*nm, 0.0*deg) - iff_pdf = ba.FTDecayFunction1DCauchy(1000000.0*nm) + iff = ba.InterferenceFunction1DLattice(100*nm, 0*deg) + iff_pdf = ba.FTDecayFunction1DCauchy(1000000*nm) iff.setDecayFunction(iff_pdf) # Define particle layouts layout = ba.ParticleLayout() - layout.addParticle(particle, 1.0) + layout.addParticle(particle, 1) layout.setInterferenceFunction(iff) layout.setWeight(1) layout.setTotalParticleSurfaceDensity(0.01) @@ -64,7 +64,7 @@ def get_simulation(sample): # define the beam with alpha_i varied between alpha_i_min and alpha_i_max alpha_i_axis = ba.FixedBinAxis("alpha_i", 200, alpha_i_min*deg, alpha_i_max*deg) - simulation.setBeamParameters(1.0*angstrom, alpha_i_axis, 0.0*deg) + simulation.setBeamParameters(1*angstrom, alpha_i_axis, 0*deg) simulation.beam().setIntensity(1e9) simulation.setSample(sample) return simulation @@ -74,4 +74,4 @@ if __name__ == '__main__': import ba_plot sample = get_sample() simulation = get_simulation(sample) - ba_plot.run_and_plot(simulation, intensity_min=1.0) + ba_plot.run_and_plot(simulation, intensity_min=1) diff --git a/Examples/varia/PolarizedNoAnalyzer.py b/Examples/varia/PolarizedNoAnalyzer.py index 6c1ec76a7839fbfecc689d2b166fcaa65047749f..756d281a05c6d4b218a31fcdbe1fd543ba668ebf 100644 --- a/Examples/varia/PolarizedNoAnalyzer.py +++ b/Examples/varia/PolarizedNoAnalyzer.py @@ -16,14 +16,14 @@ def get_sample(): """ # Define materials - material_Ambient = ba.MaterialBySLD("Ambient", 0.0, 0.0) + material_Ambient = ba.MaterialBySLD("Ambient", 0, 0) magnetic_field = kvector_t(50000000, 86602540.3784, 0) material_Layer = ba.MaterialBySLD("Layer", 0.0001, 1e-08, magnetic_field) material_Substrate = ba.MaterialBySLD("Substrate", 7e-05, 2e-06) # Define layers layer_1 = ba.Layer(material_Ambient) - layer_2 = ba.Layer(material_Layer, 10.0*nm) + layer_2 = ba.Layer(material_Layer, 10*nm) layer_3 = ba.Layer(material_Substrate) # Define sample @@ -40,13 +40,13 @@ def get_simulation(sample, scan_size=500): Defines and returns a specular simulation. """ simulation = ba.SpecularSimulation() - scan = ba.AngularSpecScan(1.54*angstrom, scan_size, 0.0*deg, 5.0*deg) + scan = ba.AngularSpecScan(1.54*angstrom, scan_size, 0*deg, 5*deg) simulation.setScan(scan) simulation.setSample(sample) return simulation -def run_simulation(polarization=ba.kvector_t(0.0, 1.0, 0.0), analyzer=None): +def run_simulation(polarization=ba.kvector_t(0, 1, 0), analyzer=None): """ Runs simulation and returns its result. """ @@ -56,7 +56,7 @@ def run_simulation(polarization=ba.kvector_t(0.0, 1.0, 0.0), analyzer=None): # adding polarization and analyzer operator simulation.beam().setPolarization(polarization) if analyzer: - simulation.detector().setAnalyzerProperties(analyzer, 1.0, 0.5) + simulation.detector().setAnalyzerProperties(analyzer, 1, 0.5) simulation.runSimulation() result = simulation.result() diff --git a/Examples/varia/PolarizedNonperfectAnalyzerPolarizer.py b/Examples/varia/PolarizedNonperfectAnalyzerPolarizer.py index 5c47342d9fd32d08ad8c9dbb85b388e8c41d4490..ea4bd39714cb46cd4448c83689090367355f3c97 100644 --- a/Examples/varia/PolarizedNonperfectAnalyzerPolarizer.py +++ b/Examples/varia/PolarizedNonperfectAnalyzerPolarizer.py @@ -27,7 +27,7 @@ def get_sample(*, magnetization=magnetizationVector): """ # create materials - mat_vacuum = ba.MaterialBySLD("Vacuum", 0.0, 0.0) + mat_vacuum = ba.MaterialBySLD("Vacuum", 0, 0) mat_Pd = ba.MaterialBySLD("Pd", *sldPd) mat_Fe = ba.MaterialBySLD("Fe", *sldFe, magnetizationVector) mat_substrate = ba.MaterialBySLD("MgO", *sldMgO) diff --git a/Examples/varia/PolarizedSANS.py b/Examples/varia/PolarizedSANS.py index 7c07918c1acfc59f5fe319c43ccb2cda701c965d..424cf73976c5461dce010ac14e5a464e6a8d2daf 100644 --- a/Examples/varia/PolarizedSANS.py +++ b/Examples/varia/PolarizedSANS.py @@ -8,7 +8,7 @@ import bornagain as ba from bornagain import angstrom, deg, nm, nm2, kvector_t # Magnetization of the particle's core material (A/m) -magnetization_core = kvector_t(0.0, 0.0, 1e7) +magnetization_core = kvector_t(0, 0, 1e7) def get_sample(): @@ -20,15 +20,15 @@ def get_sample(): magnetic_field = kvector_t(0, 0, 10000000) material_Core = ba.HomogeneousMaterial("Core", 6e-06, 2e-08, magnetic_field) material_Shell = ba.HomogeneousMaterial("Shell", 1e-07, 2e-08) - material_Solvent = ba.HomogeneousMaterial("Solvent", 5e-06, 0.0) + material_Solvent = ba.HomogeneousMaterial("Solvent", 5e-06, 0) # Define form factors - ff_1 = ba.FormFactorFullSphere(10.0*nm) - ff_2 = ba.FormFactorFullSphere(12.0*nm) + ff_1 = ba.FormFactorFullSphere(10*nm) + ff_2 = ba.FormFactorFullSphere(12*nm) # Define particles particle_1 = ba.Particle(material_Core, ff_1) - particle_1_position = kvector_t(0.0*nm, 0.0*nm, 2.0*nm) + particle_1_position = kvector_t(0*nm, 0*nm, 2*nm) particle_1.setPosition(particle_1_position) particle_2 = ba.Particle(material_Shell, ff_2) @@ -37,7 +37,7 @@ def get_sample(): # Define particle layouts layout = ba.ParticleLayout() - layout.addParticle(particle_3, 1.0) + layout.addParticle(particle_3, 1) layout.setWeight(1) layout.setTotalParticleSurfaceDensity(0.01) @@ -59,18 +59,18 @@ def get_simulation(sample): simulation = ba.GISASSimulation() # Defining detector - simulation.setDetectorParameters(200, -3.0*deg, 3.0*deg, 200, -3.0*deg, - 3.0*deg) + simulation.setDetectorParameters(200, -3*deg, 3*deg, 200, -3*deg, + 3*deg) # Defining beam parameters - simulation.setBeamParameters(0.5*nm, 0.0*deg, 0.0*deg) + simulation.setBeamParameters(0.5*nm, 0*deg, 0*deg) simulation.beam().setIntensity(1e12) # Defining beam polarization and polarization analysis for spin-flip channel - analyzer_dir = kvector_t(0.0, 0.0, -1.0) - beampol = kvector_t(0.0, 0.0, 1.0) + analyzer_dir = kvector_t(0, 0, -1) + beampol = kvector_t(0, 0, 1) simulation.beam().setPolarization(beampol) - simulation.detector().setAnalyzerProperties(analyzer_dir, 1.0, 0.5) + simulation.detector().setAnalyzerProperties(analyzer_dir, 1, 0.5) simulation.setSample(sample) return simulation diff --git a/Examples/varia/PolarizedSpinAsymmetry.py b/Examples/varia/PolarizedSpinAsymmetry.py index b5e4d71c057e61e922c65a4a8fa8c663b84f97d5..5caeac35afbc5c8ac8b3f253dcdd3dcf58432ddd 100644 --- a/Examples/varia/PolarizedSpinAsymmetry.py +++ b/Examples/varia/PolarizedSpinAsymmetry.py @@ -52,7 +52,7 @@ def get_sample(params): magnetizationMagnitude*numpy.sin(angle*deg), magnetizationMagnitude*numpy.cos(angle*deg), 0) - mat_vacuum = ba.MaterialBySLD("Vacuum", 0.0, 0.0) + mat_vacuum = ba.MaterialBySLD("Vacuum", 0, 0) mat_layer = ba.MaterialBySLD("(Mg,Al,Fe)3O4", params["rho_Mafo"]*1e-6, 0, magnetizationVector) mat_substrate = ba.MaterialBySLD("MgAl2O4", *sldMao) @@ -93,7 +93,7 @@ def get_simulation(q_axis, parameters, polarization, analyzer): scan.setAbsoluteQResolution(distr, parameters["q_res"]) simulation.beam().setPolarization(polarization) - simulation.detector().setAnalyzerProperties(analyzer, 1.0, 0.5) + simulation.detector().setAnalyzerProperties(analyzer, 1, 0.5) simulation.setScan(scan) return simulation diff --git a/Examples/varia/PolarizedSpinFlip.py b/Examples/varia/PolarizedSpinFlip.py index c393b7bf5cd1e324d6964a6fabd2917c981af2be..b400f56cd94c33481f18d57d403b679dcfb80d1b 100644 --- a/Examples/varia/PolarizedSpinFlip.py +++ b/Examples/varia/PolarizedSpinFlip.py @@ -15,14 +15,14 @@ def get_sample(): """ # Define materials - material_Ambient = ba.MaterialBySLD("Ambient", 0.0, 0.0) + material_Ambient = ba.MaterialBySLD("Ambient", 0, 0) magnetic_field = kvector_t(50000000, 86602540.3784, 0) material_Layer = ba.MaterialBySLD("Layer", 0.0001, 1e-08, magnetic_field) material_Substrate = ba.MaterialBySLD("Substrate", 7e-05, 2e-06) # Define layers layer_1 = ba.Layer(material_Ambient) - layer_2 = ba.Layer(material_Layer, 10.0*nm) + layer_2 = ba.Layer(material_Layer, 10*nm) layer_3 = ba.Layer(material_Substrate) # Define sample @@ -39,7 +39,7 @@ def get_simulation(sample, scan_size=500): Defines and returns a specular simulation. """ simulation = ba.SpecularSimulation() - scan = ba.AngularSpecScan(1.54*angstrom, scan_size, 0.0*deg, 5.0*deg) + scan = ba.AngularSpecScan(1.54*angstrom, scan_size, 0*deg, 5*deg) simulation.setScan(scan) simulation.setSample(sample) return simulation @@ -55,7 +55,7 @@ def run_simulation(polarization=ba.kvector_t(0, 1, 0), # adding polarization and analyzer operator simulation.beam().setPolarization(polarization) - simulation.detector().setAnalyzerProperties(analyzer, 1.0, 0.5) + simulation.detector().setAnalyzerProperties(analyzer, 1, 0.5) simulation.runSimulation() return simulation.result() diff --git a/Examples/varia/RoughnessModel.py b/Examples/varia/RoughnessModel.py index 3950e9750546ed84593c4761e9b49ee8234613ad..a9728ba853879ebf2da0d6935731027ea59462ca 100644 --- a/Examples/varia/RoughnessModel.py +++ b/Examples/varia/RoughnessModel.py @@ -16,10 +16,10 @@ def get_sample(roughness_model): """ # creating materials - m_ambient = ba.MaterialBySLD("Ambient", 0.0, 0.0) - m_ti = ba.MaterialBySLD("Ti", -1.9493e-06, 0.0) - m_ni = ba.MaterialBySLD("Ni", 9.4245e-06, 0.0) - m_substrate = ba.MaterialBySLD("SiSubstrate", 2.0704e-06, 0.0) + m_ambient = ba.MaterialBySLD("Ambient", 0, 0) + m_ti = ba.MaterialBySLD("Ti", -1.9493e-06, 0) + m_ni = ba.MaterialBySLD("Ni", 9.4245e-06, 0) + m_substrate = ba.MaterialBySLD("SiSubstrate", 2.0704e-06, 0) # creating layers ambient_layer = ba.Layer(m_ambient) @@ -29,7 +29,7 @@ def get_sample(roughness_model): # defining roughness roughness = ba.LayerRoughness() - roughness.setSigma(1.0*nm) + roughness.setSigma(1*nm) # creating multilayer multi_layer = ba.MultiLayer() @@ -49,7 +49,7 @@ def get_simulation(sample, scan_size=500): Defines and returns a specular simulation. """ simulation = ba.SpecularSimulation() - scan = ba.AngularSpecScan(1.54*angstrom, scan_size, 0.0*deg, 2.0*deg) + scan = ba.AngularSpecScan(1.54*angstrom, scan_size, 0*deg, 2*deg) simulation.setScan(scan) simulation.setSample(sample) return simulation diff --git a/Examples/varia/SpecularSimulationWithRoughness.py b/Examples/varia/SpecularSimulationWithRoughness.py index 72d9c59b6027abd1226dd2799b51ceb15f15d577..53290102b38518621b368c03c1ff7571e97ee366 100644 --- a/Examples/varia/SpecularSimulationWithRoughness.py +++ b/Examples/varia/SpecularSimulationWithRoughness.py @@ -14,10 +14,10 @@ def get_sample(): """ # creating materials - m_ambient = ba.MaterialBySLD("Ambient", 0.0, 0.0) - m_ti = ba.MaterialBySLD("Ti", -1.9493e-06, 0.0) - m_ni = ba.MaterialBySLD("Ni", 9.4245e-06, 0.0) - m_substrate = ba.MaterialBySLD("SiSubstrate", 2.0704e-06, 0.0) + m_ambient = ba.MaterialBySLD("Ambient", 0, 0) + m_ti = ba.MaterialBySLD("Ti", -1.9493e-06, 0) + m_ni = ba.MaterialBySLD("Ni", 9.4245e-06, 0) + m_substrate = ba.MaterialBySLD("SiSubstrate", 2.0704e-06, 0) # creating layers ambient_layer = ba.Layer(m_ambient) @@ -27,7 +27,7 @@ def get_sample(): # defining roughness roughness = ba.LayerRoughness() - roughness.setSigma(1.0*nm) + roughness.setSigma(1*nm) # creating multilayer multi_layer = ba.MultiLayer() @@ -45,7 +45,7 @@ def get_simulation(sample, scan_size=500): Defines and returns a specular simulation. """ simulation = ba.SpecularSimulation() - scan = ba.AngularSpecScan(1.54*angstrom, scan_size, 0.0*deg, 2.0*deg) + scan = ba.AngularSpecScan(1.54*angstrom, scan_size, 0*deg, 2*deg) simulation.setScan(scan) simulation.setSample(sample) return simulation diff --git a/Tests/Functional/PyCore/histogram2d.py b/Tests/Functional/PyCore/histogram2d.py index c9df823fc106c1d7ae2f36d2d6c95e1131af61fb..972ed0bb9baf6e897905d328f7e72f034d920280 100644 --- a/Tests/Functional/PyCore/histogram2d.py +++ b/Tests/Functional/PyCore/histogram2d.py @@ -14,16 +14,16 @@ class Histogram2DTest(unittest.TestCase): hist = ba.Histogram2D(arr) self.assertEqual(hist.getNbinsX(), 5) - self.assertEqual(hist.getXmin(), 0.0) - self.assertEqual(hist.getXmax(), 5.0) + self.assertEqual(hist.getXmin(), 0) + self.assertEqual(hist.getXmax(), 5) self.assertEqual(hist.getNbinsY(), 3) - self.assertEqual(hist.getYmin(), 0.0) - self.assertEqual(hist.getYmax(), 3.0) + self.assertEqual(hist.getYmin(), 0) + self.assertEqual(hist.getYmax(), 3) - self.assertEqual(hist.binContent(0, 0), 11.0) - self.assertEqual(hist.binContent(0, 1), 6.0) - self.assertEqual(hist.binContent(4, 2), 5.0) + self.assertEqual(hist.binContent(0, 0), 11) + self.assertEqual(hist.binContent(0, 1), 6) + self.assertEqual(hist.binContent(4, 2), 5) arr_from_hist = hist.getArray() @@ -35,22 +35,22 @@ class Histogram2DTest(unittest.TestCase): Testing construction of 2D histogram from numpy array """ arr = numpy.array( - [[1.0, 2.0, 3.0, 4.0, 5.0], [6.0, 7.0, 8.0, 9.0, 10.0], - [11.0, 12.0, 13.0, 14.0, 15.0]], + [[1, 2, 3, 4, 5.0], [6, 7, 8, 9, 10.0], + [11, 12, 13, 14, 15.0]], dtype=numpy.float64) hist = ba.Histogram2D(arr) self.assertEqual(hist.getNbinsX(), 5) - self.assertEqual(hist.getXmin(), 0.0) - self.assertEqual(hist.getXmax(), 5.0) + self.assertEqual(hist.getXmin(), 0) + self.assertEqual(hist.getXmax(), 5) self.assertEqual(hist.getNbinsY(), 3) - self.assertEqual(hist.getYmin(), 0.0) - self.assertEqual(hist.getYmax(), 3.0) + self.assertEqual(hist.getYmin(), 0) + self.assertEqual(hist.getYmax(), 3) - self.assertEqual(hist.binContent(0, 0), 11.0) - self.assertEqual(hist.binContent(0, 1), 6.0) - self.assertEqual(hist.binContent(4, 2), 5.0) + self.assertEqual(hist.binContent(0, 0), 11) + self.assertEqual(hist.binContent(0, 1), 6) + self.assertEqual(hist.binContent(4, 2), 5) arr_from_hist = hist.getArray() @@ -71,15 +71,15 @@ class Histogram2DTest(unittest.TestCase): arr_from_hist = hist.getArray() for (x, y), element in numpy.ndenumerate(arr): - self.assertEqual(element*2.0, arr_from_hist[x][y]) + self.assertEqual(element*2, arr_from_hist[x][y]) def test_constructAndAddFromNumpyDouble(self): """ Adding to the histogram content from numpy array """ arr = numpy.array( - [[1.0, 2.0, 3.0, 4.0, 5.0], [6.0, 7.0, 8.0, 9.0, 10.0], - [11.0, 12.0, 13.0, 14.0, 15.0]], + [[1, 2, 3, 4, 5.0], [6, 7, 8, 9, 10.0], + [11, 12, 13, 14, 15.0]], dtype=numpy.float64) hist = ba.Histogram2D(arr) # adding same content once again @@ -87,7 +87,7 @@ class Histogram2DTest(unittest.TestCase): arr_from_hist = hist.getArray() for (x, y), element in numpy.ndenumerate(arr): - self.assertEqual(element*2.0, arr_from_hist[x][y]) + self.assertEqual(element*2, arr_from_hist[x][y]) def create_histogram(self, arr): """ @@ -113,8 +113,8 @@ class Histogram2DTest(unittest.TestCase): Testing newly create object """ arr = numpy.array( - [[1.0, 2.0, 3.0, 4.0, 5.0], [6.0, 7.0, 8.0, 9.0, 10.0], - [11.0, 12.0, 13.0, 14.0, 15.0]], + [[1, 2, 3, 4, 5.0], [6, 7, 8, 9, 10.0], + [11, 12, 13, 14, 15.0]], dtype=numpy.float64) hist = self.create_histogram(arr) arr_from_hist = hist.getArray() diff --git a/Tests/Functional/PyCore/intensitydata.py b/Tests/Functional/PyCore/intensitydata.py index e32620b5761b4456c2321d1fef2327618f7427ef..d108ef3e6699df52a6581a89fc9bfc3e817d00ab 100644 --- a/Tests/Functional/PyCore/intensitydata.py +++ b/Tests/Functional/PyCore/intensitydata.py @@ -29,10 +29,10 @@ class IntensityDataTest(unittest.TestCase): numpy.testing.assert_allclose(input, output) def test_create_1d_object(self): - axis0 = ba.FixedBinAxis("angle", 20, 0.0, 20.) + axis0 = ba.FixedBinAxis("angle", 20, 0, 20.) self.assertEqual(20, axis0.size()) - self.assertEqual(0.0, axis0.lowerBound()) - self.assertEqual(20.0, axis0.upperBound()) + self.assertEqual(0, axis0.lowerBound()) + self.assertEqual(20, axis0.upperBound()) data = ba.IntensityData() data.addAxis(axis0) self.assertEqual(20, data.getAllocatedSize()) @@ -41,20 +41,20 @@ class IntensityDataTest(unittest.TestCase): def test_create_2d_object(self): data = ba.IntensityData() - data.addAxis("axis0", 10, 0.0, 10.0) - data.addAxis("axis1", 20, 0.0, 20.0) + data.addAxis("axis0", 10, 0, 10) + data.addAxis("axis1", 20, 0, 20) self.assertEqual(200, data.getAllocatedSize()) self.assertEqual(2, data.rank()) self.assertEqual(0, data.totalSum()) - data.setAllTo(1.0) - self.assertEqual(200.0, data.totalSum()) + data.setAllTo(1) + self.assertEqual(200, data.totalSum()) for i in range(0, data.getAllocatedSize()): data[i] = data[i]* -1.0 - self.assertEqual(-200.0, data.totalSum()) + self.assertEqual(-200, data.totalSum()) def test_access_simulation_intensity(self): simulation = ba.GISASSimulation() - simulation.setDetectorParameters(10, -1.0, 1.0, 100, 0.0, 2.0) + simulation.setDetectorParameters(10, -1, 1, 100, 0, 2) data = simulation.result().histogram2d() self.assertEqual(1000, data.getTotalNumberOfBins()) self.assertEqual(2, data.rank()) @@ -63,8 +63,8 @@ class IntensityDataTest(unittest.TestCase): def test_numpy_array(self): data = ba.IntensityData() - data.addAxis("axis0", 10, 0.0, 10.0) - data.addAxis("axis1", 20, 0.0, 20.0) + data.addAxis("axis0", 10, 0, 10) + data.addAxis("axis1", 20, 0, 20) data.setAllTo(1) self.assertEqual((20, 10), data.getArray().shape) self.assertEqual((data.totalSum()), numpy.sum(data.getArray())) diff --git a/Tests/Functional/PyCore/intensitydata_io.py b/Tests/Functional/PyCore/intensitydata_io.py index 476285466cdae0c82773c72972283e1a7ba3ee22..b77fbebd28a0b2b70c93fa13554cb57db52feba7 100644 --- a/Tests/Functional/PyCore/intensitydata_io.py +++ b/Tests/Functional/PyCore/intensitydata_io.py @@ -49,7 +49,7 @@ class OutputDataIOTest(unittest.TestCase): """ def test_01_FixedBinAxis_1D(self): data = ba.IntensityData() - data.addAxis(ba.FixedBinAxis("axis0", 10, -1.00000001, 1.0)) + data.addAxis(ba.FixedBinAxis("axis0", 10, -1.00000001, 1)) fill_data(data) ba.IntensityDataIOFactory.writeOutputData(data, "tmp.int") newdata = ba.IntensityDataIOFactory.readOutputData("tmp.int") @@ -57,8 +57,8 @@ class OutputDataIOTest(unittest.TestCase): def test_02_FixedBinAxis_2D(self): data = ba.IntensityData() - data.addAxis(ba.FixedBinAxis("axis0", 9, -1.00000001, 1.0)) - data.addAxis(ba.FixedBinAxis("axis1", 3, -4.0, 5.0)) + data.addAxis(ba.FixedBinAxis("axis0", 9, -1.00000001, 1)) + data.addAxis(ba.FixedBinAxis("axis1", 3, -4, 5)) fill_data(data) ba.IntensityDataIOFactory.writeOutputData(data, "tmp.int") newdata = ba.IntensityDataIOFactory.readOutputData("tmp.int") @@ -66,9 +66,9 @@ class OutputDataIOTest(unittest.TestCase): def test_03_FixedBinAxis_3D(self): data = ba.IntensityData() - data.addAxis(ba.FixedBinAxis("axis0", 9, -1.00000001, 1.0)) - data.addAxis(ba.FixedBinAxis("axis1", 1, -4.0, 5.0)) - data.addAxis(ba.FixedBinAxis("axis2", 3, 0.0, 1.0)) + data.addAxis(ba.FixedBinAxis("axis0", 9, -1.00000001, 1)) + data.addAxis(ba.FixedBinAxis("axis1", 1, -4, 5)) + data.addAxis(ba.FixedBinAxis("axis2", 3, 0, 1)) fill_data(data) ba.IntensityDataIOFactory.writeOutputData(data, "tmp.int") newdata = ba.IntensityDataIOFactory.readOutputData("tmp.int") @@ -99,7 +99,7 @@ class OutputDataIOTest(unittest.TestCase): def test_06_VariableAndFixedMix(self): data = ba.IntensityData() - data.addAxis(ba.FixedBinAxis("axis0", 10, -5.0, 5.0)) + data.addAxis(ba.FixedBinAxis("axis0", 10, -5, 5)) data.addAxis( ba.VariableBinAxis("axis1", 3, get_boundaries_flat_in_sin(3, 0*deg, 2*deg))) @@ -110,8 +110,8 @@ class OutputDataIOTest(unittest.TestCase): def test_07_ConstKBinAxis_2D(self): data = ba.IntensityData() - data.addAxis(ba.ConstKBinAxis("axis0", 9, -1.00000001*deg, 1.0*deg)) - data.addAxis(ba.ConstKBinAxis("axis1", 3, -4.0*deg, 5.0*deg)) + data.addAxis(ba.ConstKBinAxis("axis0", 9, -1.00000001*deg, 1*deg)) + data.addAxis(ba.ConstKBinAxis("axis1", 3, -4*deg, 5*deg)) fill_data(data) ba.IntensityDataIOFactory.writeOutputData(data, "tmp.int") newdata = ba.IntensityDataIOFactory.readOutputData("tmp.int") @@ -119,8 +119,8 @@ class OutputDataIOTest(unittest.TestCase): def test_08_CustomBinAxis_2D(self): data = ba.IntensityData() - data.addAxis(ba.CustomBinAxis("axis0", 9, -1.00000001*deg, 1.0*deg)) - data.addAxis(ba.CustomBinAxis("axis1", 3, -4.0*deg, 5.0*deg)) + data.addAxis(ba.CustomBinAxis("axis0", 9, -1.00000001*deg, 1*deg)) + data.addAxis(ba.CustomBinAxis("axis1", 3, -4*deg, 5*deg)) fill_data(data) ba.IntensityDataIOFactory.writeOutputData(data, "tmp.int") newdata = ba.IntensityDataIOFactory.readOutputData("tmp.int") @@ -128,8 +128,8 @@ class OutputDataIOTest(unittest.TestCase): def test_SaveToINT(self): data = ba.IntensityData() - data.addAxis(ba.FixedBinAxis("axis0", 10, 0.0, 10.0)) - data.addAxis(ba.FixedBinAxis("axis1", 5, 0.0, 5.0)) + data.addAxis(ba.FixedBinAxis("axis0", 10, 0, 10)) + data.addAxis(ba.FixedBinAxis("axis1", 5, 0, 5)) fill_data(data) ba.IntensityDataIOFactory.writeOutputData(data, "tmp.int") @@ -146,8 +146,8 @@ class OutputDataIOTest(unittest.TestCase): def test_SaveToTXT(self): data = ba.IntensityData() - data.addAxis(ba.FixedBinAxis("axis0", 10, 0.0, 10.0)) - data.addAxis(ba.FixedBinAxis("axis1", 5, 0.0, 5.0)) + data.addAxis(ba.FixedBinAxis("axis0", 10, 0, 10)) + data.addAxis(ba.FixedBinAxis("axis1", 5, 0, 5)) fill_data(data) ba.IntensityDataIOFactory.writeOutputData(data, "tmp.txt") @@ -155,15 +155,15 @@ class OutputDataIOTest(unittest.TestCase): self.assertTrue(is_the_same_data(data, newdata)) def test_SaveNumpyArray_ReadOutputData(self): - arr = numpy.array([[0.0, 1.0, 2.0, 3.0], [4.0, 5.0, 6.0, 7.0], - [8.0, 9.0, 10.0, 11.0]]) + arr = numpy.array([[0, 1, 2, 3.0], [4, 5, 6, 7.0], + [8, 9, 10, 11.0]]) numpy.savetxt('tmp.txt', arr) newdata = ba.IntensityDataIOFactory.readOutputData("tmp.txt") self.assertTrue(numpy.array_equal(newdata.getArray(), arr)) def test_SaveNumpyArray_ReadRawDataVector(self): - arr = numpy.array([[0.0, 1.0, 2.0, 3.0], [4.0, 5.0, 6.0, 7.0], - [8.0, 9.0, 10.0, 11.0]]) + arr = numpy.array([[0, 1, 2, 3.0], [4, 5, 6, 7.0], + [8, 9, 10, 11.0]]) numpy.savetxt('tmp.txt', arr) newdata = numpy.array( ba.IntensityDataIOFactory.readOutputData( @@ -174,8 +174,8 @@ class OutputDataIOTest(unittest.TestCase): def test_SaveOutputData_ReadNumpyArray(self): data = ba.IntensityData() - data.addAxis(ba.FixedBinAxis("axis0", 10, 0.0, 10.0)) - data.addAxis(ba.FixedBinAxis("axis1", 5, 0.0, 5.0)) + data.addAxis(ba.FixedBinAxis("axis0", 10, 0, 10)) + data.addAxis(ba.FixedBinAxis("axis1", 5, 0, 5)) fill_data(data) ba.IntensityDataIOFactory.writeOutputData(data, "tmp.txt") diff --git a/Tests/Functional/PyCore/intensitydata_io_tiff.py b/Tests/Functional/PyCore/intensitydata_io_tiff.py index 4b6e0f29ea8276f31dca5e720182f4d7b66aad09..7c15a56f5a24a00831206a54acf2ff9f07ce0764 100644 --- a/Tests/Functional/PyCore/intensitydata_io_tiff.py +++ b/Tests/Functional/PyCore/intensitydata_io_tiff.py @@ -35,8 +35,8 @@ class OutputDataIOTiffTest(unittest.TestCase): """ def test_SaveToTiff(self): data = ba.IntensityData() - data.addAxis(ba.FixedBinAxis("x", 10, 0.0, 10.0)) - data.addAxis(ba.FixedBinAxis("y", 5, 0.0, 5.0)) + data.addAxis(ba.FixedBinAxis("x", 10, 0, 10)) + data.addAxis(ba.FixedBinAxis("y", 5, 0, 5)) fill_data(data) ba.IntensityDataIOFactory.writeOutputData(data, "tmp.tif") diff --git a/Tests/Functional/PyCore/mesocrystal1.py b/Tests/Functional/PyCore/mesocrystal1.py index b4c5de2b1cce321074322ccfc349d8d3dc1be658..b9acbc0a94d1af117cece85f610b3162aeaf1f1b 100644 --- a/Tests/Functional/PyCore/mesocrystal1.py +++ b/Tests/Functional/PyCore/mesocrystal1.py @@ -64,12 +64,12 @@ class MySampleBuilder(ISampleBuilder): numpy.sqrt(self.surface_filling_ratio.value*avg_n_squared_meso + 1.0 - self.surface_filling_ratio.value)) n_particle_adapted = complex( - numpy.sqrt(n_avg*n_avg + n_particle*n_particle - 1.0)) + numpy.sqrt(n_avg*n_avg + n_particle*n_particle - 1)) ff = FormFactorCylinder(self.meso_radius.value, self.meso_height.value) # Create multilayer p_multi_layer = MultiLayer() - n_air = complex(1.0, 0.0) + n_air = complex(1, 0) n_substrate = complex(1.0 - 7.57e-6, 1.73e-7) p_vacuum_material = HomogeneousMaterial("Vacuum", n_air) @@ -83,8 +83,8 @@ class MySampleBuilder(ISampleBuilder): n_max_phi_rotation_steps = 2 n_alpha_rotation_steps = 1 - alpha_step = 5.0*deg/n_alpha_rotation_steps - alpha_start = -(n_alpha_rotation_steps/2.0)*alpha_step + alpha_step = 5*deg/n_alpha_rotation_steps + alpha_start = -(n_alpha_rotation_steps/2)*alpha_step phi_step = 2*numpy.pi/3.0/n_max_phi_rotation_steps phi_start = 0.0 @@ -95,8 +95,8 @@ class MySampleBuilder(ISampleBuilder): meso = self.createMesoCrystal(self.lattice_length_a.value, self.lattice_length_c.value, n_particle_adapted, ff) - meso.setPosition(0.0, 0.0, -self.meso_height.value) - particle_layout.addParticle(meso, 1.0, kvector_t(0, 0, 0), + meso.setPosition(0, 0, -self.meso_height.value) + particle_layout.addParticle(meso, 1, kvector_t(0, 0, 0), total_transform) particle_layout.setTotalParticleSurfaceDensity(surface_density) @@ -104,7 +104,7 @@ class MySampleBuilder(ISampleBuilder): avg_layer.addLayout(particle_layout) - roughness = LayerRoughness(self.roughness.value, 0.3, 500.0*nm) + roughness = LayerRoughness(self.roughness.value, 0.3, 500*nm) p_multi_layer.addLayer(vacuum_layer) p_multi_layer.addLayer(avg_layer) @@ -128,9 +128,9 @@ class MySampleBuilder(ISampleBuilder): self.nanoparticle_radius.value, self.sigma_nanoparticle_radius.value) particle = Particle(mParticle, ff) - position_0 = kvector_t(0.0, 0.0, 0.0) - position_1 = 1.0/3.0*(2.0*bas_a + bas_b + bas_c) - position_2 = 1.0/3.0*(bas_a + 2.0*bas_b + 2.0*bas_c) + position_0 = kvector_t(0, 0, 0) + position_1 = 1.0/3*(2*bas_a + bas_b + bas_c) + position_2 = 1.0/3*(bas_a + 2*bas_b + 2*bas_c) positions = [position_0, position_1, position_2] basis = ParticleComposition() basis.addParticles(particle, positions) @@ -144,8 +144,8 @@ class MySampleBuilder(ISampleBuilder): # create lattice # ------------------------------------------------------------------------- def createLattice(self, stacking_radius_a, stacking_radius_c): - result = HexagonalLattice(stacking_radius_a*2.0, - stacking_radius_c*2.0*2.3) + result = HexagonalLattice(stacking_radius_a*2, + stacking_radius_c*2*2.3) result.setSelectionRule(SimpleSelectionRule(-1, 1, 1, 3)) return result @@ -175,9 +175,9 @@ def runTest(): # create simulation def createSimulation(): simulation = GISASSimulation() - simulation.setBeamParameters(1.77*angstrom, 0.4*deg, 0.0*deg) + simulation.setBeamParameters(1.77*angstrom, 0.4*deg, 0*deg) simulation.beam().setIntensity(5.0090e+12) - simulation.setDetectorParameters(50, 0.2*deg, 2.5*deg, 50, 0.0*deg, 2.5*deg) + simulation.setDetectorParameters(50, 0.2*deg, 2.5*deg, 50, 0*deg, 2.5*deg) return simulation diff --git a/Tests/Functional/PyCore/parameterpool.py b/Tests/Functional/PyCore/parameterpool.py index d61107d8fa06697b54d28a9354fbd02cf84b40db..b85d3851c0748581b3041461ebc72dbb5b5953ec 100644 --- a/Tests/Functional/PyCore/parameterpool.py +++ b/Tests/Functional/PyCore/parameterpool.py @@ -9,9 +9,9 @@ class ParameterPoolTest(unittest.TestCase): Checks values in particle's parameter pool """ ff = ba.FormFactorCylinder(5*nm, 6*nm) - particle = ba.Particle(ba.HomogeneousMaterial("Vacuum", 0.0, 0.0), ff) - particle.setAbundance(1.0) - particle.setPosition(2.0, 3.0, 4.0) + particle = ba.Particle(ba.HomogeneousMaterial("Vacuum", 0, 0), ff) + particle.setAbundance(1) + particle.setPosition(2, 3, 4) # print(particle.parametersToString()) # print(particle.treeToString()) @@ -22,9 +22,9 @@ class ParameterPoolTest(unittest.TestCase): ('Abundance', 'PositionX', 'PositionY', 'PositionZ')) expected = { - 'Abundance': 1.0, - 'PositionX': 2.0, - 'PositionY': 3.0, + 'Abundance': 1, + 'PositionX': 2, + 'PositionY': 3, 'PositionZ': 4.0 } for par in pool: @@ -36,19 +36,19 @@ class ParameterPoolTest(unittest.TestCase): Modification of particle parameters via parameter pool """ ff = ba.FormFactorCylinder(5*nm, 6*nm) - particle = ba.Particle(ba.HomogeneousMaterial("Vacuum", 0.0, 0.0), ff) - particle.setAbundance(1.0) - particle.setPosition(2.0, 3.0, 4.0) + particle = ba.Particle(ba.HomogeneousMaterial("Vacuum", 0, 0), ff) + particle.setAbundance(1) + particle.setPosition(2, 3, 4) pool = particle.parameterPool() - pool.setParameterValue('Abundance', 10.0) - pool[1].setValue(20.0) # PositionX - pool.parameter('PositionY').setValue(30.0) + pool.setParameterValue('Abundance', 10) + pool[1].setValue(20) # PositionX + pool.parameter('PositionY').setValue(30) expected = { - 'Abundance': 10.0, - 'PositionX': 20.0, - 'PositionY': 30.0, + 'Abundance': 10, + 'PositionX': 20, + 'PositionY': 30, 'PositionZ': 4.0 } @@ -61,18 +61,18 @@ class ParameterPoolTest(unittest.TestCase): particle and its children (in given case, form factor of cylinder) """ ff = ba.FormFactorCylinder(5*nm, 6*nm) - particle = ba.Particle(ba.HomogeneousMaterial("Vacuum", 0.0, 0.0), ff) - particle.setAbundance(1.0) - particle.setPosition(2.0, 3.0, 4.0) + particle = ba.Particle(ba.HomogeneousMaterial("Vacuum", 0, 0), ff) + particle.setAbundance(1) + particle.setPosition(2, 3, 4) pool = particle.createParameterTree() expected = { - '/Particle/Abundance': 1.0, - '/Particle/PositionX': 2.0, - '/Particle/PositionY': 3.0, - '/Particle/PositionZ': 4.0, - '/Particle/Cylinder/Radius': 5.0, + '/Particle/Abundance': 1, + '/Particle/PositionX': 2, + '/Particle/PositionY': 3, + '/Particle/PositionZ': 4, + '/Particle/Cylinder/Radius': 5, '/Particle/Cylinder/Height': 6.0 } @@ -84,25 +84,25 @@ class ParameterPoolTest(unittest.TestCase): Modifies values of particle's parameter tree. """ ff = ba.FormFactorCylinder(5*nm, 6*nm) - particle = ba.Particle(ba.HomogeneousMaterial("Vacuum", 0.0, 0.0), ff) - particle.setAbundance(1.0) - particle.setPosition(2.0, 3.0, 4.0) + particle = ba.Particle(ba.HomogeneousMaterial("Vacuum", 0, 0), ff) + particle.setAbundance(1) + particle.setPosition(2, 3, 4) # print(particle.parametersToString()) # print(particle.treeToString()) pool = particle.createParameterTree() - pool.setParameterValue('/Particle/Abundance', 10.0) - pool[1].setValue(20.0) # PositionX - pool.parameter('/Particle/PositionY').setValue(30.0) - pool.setMatchedParametersValue('*Cylinder*', 50.0) + pool.setParameterValue('/Particle/Abundance', 10) + pool[1].setValue(20) # PositionX + pool.parameter('/Particle/PositionY').setValue(30) + pool.setMatchedParametersValue('*Cylinder*', 50) expected = { - '/Particle/Abundance': 10.0, - '/Particle/PositionX': 20.0, - '/Particle/PositionY': 30.0, - '/Particle/PositionZ': 4.0, - '/Particle/Cylinder/Radius': 50.0, + '/Particle/Abundance': 10, + '/Particle/PositionX': 20, + '/Particle/PositionY': 30, + '/Particle/PositionZ': 4, + '/Particle/Cylinder/Radius': 50, '/Particle/Cylinder/Height': 50.0 } @@ -114,16 +114,16 @@ class ParameterPoolTest(unittest.TestCase): Modification of particle's parameters without intermediate access to parameter pool """ ff = ba.FormFactorCylinder(5*nm, 6*nm) - particle = ba.Particle(ba.HomogeneousMaterial("Vacuum", 0.0, 0.0), ff) - particle.setAbundance(1.0) - particle.setPosition(2.0, 3.0, 4.0) + particle = ba.Particle(ba.HomogeneousMaterial("Vacuum", 0, 0), ff) + particle.setAbundance(1) + particle.setPosition(2, 3, 4) - particle.setParameterValue('/Particle/Abundance', 10.0) - particle.setParameterValue('PositionZ', 40.0) - particle.setParameterValue('*Cylinder*', 50.0) + particle.setParameterValue('/Particle/Abundance', 10) + particle.setParameterValue('PositionZ', 40) + particle.setParameterValue('*Cylinder*', 50) - self.assertEqual(particle.abundance(), 10.0) - self.assertEqual(particle.position().z(), 40.0) + self.assertEqual(particle.abundance(), 10) + self.assertEqual(particle.position().z(), 40) if __name__ == '__main__': diff --git a/Tests/Functional/PyCore/polmagcylinders1.py b/Tests/Functional/PyCore/polmagcylinders1.py index 81646345cde2e65b802f461309ec4b044f86840c..096fd8ec0e33b01d554ff43135e11261feb7908d 100644 --- a/Tests/Functional/PyCore/polmagcylinders1.py +++ b/Tests/Functional/PyCore/polmagcylinders1.py @@ -11,7 +11,7 @@ from bornagain import nm, angstrom, deg # ---------------------------------- def runSimulation(): # defining materials - mAmbience = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + mAmbience = ba.HomogeneousMaterial("Vacuum", 0, 0) mSubstrate = ba.HomogeneousMaterial("Substrate", 6e-6, 2e-8) magnetic_field = ba.kvector_t(0, 0, 0) @@ -23,7 +23,7 @@ def runSimulation(): cylinder = ba.Particle(magParticle, cylinder_ff) particle_layout = ba.ParticleLayout() - particle_layout.addParticle(cylinder, 1.0) + particle_layout.addParticle(cylinder, 1) interference = ba.InterferenceFunctionNone() particle_layout.setInterferenceFunction(interference) @@ -37,8 +37,8 @@ def runSimulation(): # build and run experiment simulation = ba.GISASSimulation() - simulation.setDetectorParameters(100, 0*deg, 2.0*deg, 100, 0.0*deg, 2.0*deg) - simulation.setBeamParameters(1.0*angstrom, 0.2*deg, 0.0*deg) + simulation.setDetectorParameters(100, 0*deg, 2*deg, 100, 0*deg, 2*deg) + simulation.setBeamParameters(1*angstrom, 0.2*deg, 0*deg) simulation.setSample(multi_layer) simulation.beam().setIntensity(1e2) simulation.runSimulation() diff --git a/Tests/Functional/PyCore/polmagcylinders2.py b/Tests/Functional/PyCore/polmagcylinders2.py index 88c16b2103aa7689829a4c542eeeeb958c51270d..c60c728966a32ad46a9ee0737b73956c9198b541 100644 --- a/Tests/Functional/PyCore/polmagcylinders2.py +++ b/Tests/Functional/PyCore/polmagcylinders2.py @@ -15,18 +15,18 @@ from bornagain import * def getSimulationIntensity(rho_beam, efficiency): print("- simulate", flush=True) # defining materials - mAmbience = HomogeneousMaterial("Vacuum", 0.0, 0.0) - mSubstrate = HomogeneousMaterial("Substrate", 15e-6, 0.0) + mAmbience = HomogeneousMaterial("Vacuum", 0, 0) + mSubstrate = HomogeneousMaterial("Substrate", 15e-6, 0) magnetization = kvector_t(0, 1e6, 0) - magParticle = HomogeneousMaterial("magParticle", 5e-6, 0.0, magnetization) + magParticle = HomogeneousMaterial("magParticle", 5e-6, 0, magnetization) # collection of particles cylinder_ff = FormFactorCylinder(5*nm, 5*nm) cylinder = Particle(magParticle, cylinder_ff) particle_layout = ParticleLayout() - particle_layout.addParticle(cylinder, 1.0) + particle_layout.addParticle(cylinder, 1) interference = InterferenceFunctionNone() particle_layout.setInterferenceFunction(interference) @@ -40,11 +40,11 @@ def getSimulationIntensity(rho_beam, efficiency): # build and run experiment simulation = GISASSimulation() - simulation.setDetectorParameters(100, -1*deg, 1.0*deg, 100, 0.0*deg, - 2.0*deg) - zplus = kvector_t(0.0, 0.0, 1.0) + simulation.setDetectorParameters(100, -1*deg, 1*deg, 100, 0*deg, + 2*deg) + zplus = kvector_t(0, 0, 1) simulation.detector().setAnalyzerProperties(zplus, efficiency, 0.5) - simulation.setBeamParameters(1.0*angstrom, 0.2*deg, 0.0*deg) + simulation.setBeamParameters(1*angstrom, 0.2*deg, 0*deg) simulation.beam().setPolarization(rho_beam) simulation.setSample(multi_layer) simulation.beam().setIntensity(1e9) @@ -70,25 +70,25 @@ def get_reference_data(filename): # -------------------------------------------------------------- def run_test(): print("run test", flush=True) - zplus = kvector_t(0.0, 0.0, 1.0) - zmin = kvector_t(0.0, 0.0, -1.0) + zplus = kvector_t(0, 0, 1) + zmin = kvector_t(0, 0, -1) - # IntensityDataIOFactory.writeIntensityData(getSimulationIntensity(zplus, 1.0), 'polmagcylinders2_reference_00.int') - # IntensityDataIOFactory.writeIntensityData(getSimulationIntensity(zplus, -1.0), 'polmagcylinders2_reference_01.int') - # IntensityDataIOFactory.writeIntensityData(getSimulationIntensity(zmin, 1.0), 'polmagcylinders2_reference_10.int') - # IntensityDataIOFactory.writeIntensityData(getSimulationIntensity(zmin, -1.0), 'polmagcylinders2_reference_11.int') + # IntensityDataIOFactory.writeIntensityData(getSimulationIntensity(zplus, 1), 'polmagcylinders2_reference_00.int') + # IntensityDataIOFactory.writeIntensityData(getSimulationIntensity(zplus, -1), 'polmagcylinders2_reference_01.int') + # IntensityDataIOFactory.writeIntensityData(getSimulationIntensity(zmin, 1), 'polmagcylinders2_reference_10.int') + # IntensityDataIOFactory.writeIntensityData(getSimulationIntensity(zmin, -1), 'polmagcylinders2_reference_11.int') diff = 0.0 diff += get_difference( - getSimulationIntensity(zplus, 1.0).array(), + getSimulationIntensity(zplus, 1).array(), get_reference_data('polmagcylinders2_reference_00.int.gz').getArray()) diff += get_difference( - getSimulationIntensity(zplus, -1.0).array(), + getSimulationIntensity(zplus, -1).array(), get_reference_data('polmagcylinders2_reference_01.int.gz').getArray()) diff += get_difference( - getSimulationIntensity(zmin, 1.0).array(), + getSimulationIntensity(zmin, 1).array(), get_reference_data('polmagcylinders2_reference_10.int.gz').getArray()) diff += get_difference( - getSimulationIntensity(zmin, -1.0).array(), + getSimulationIntensity(zmin, -1).array(), get_reference_data('polmagcylinders2_reference_11.int.gz').getArray()) diff /= 4.0 diff --git a/Tests/Functional/PyCore/samplebuilder.py b/Tests/Functional/PyCore/samplebuilder.py index a8628a3f00297a5e1b1a6eb86271849546ba1c85..104516a04fb92b33b0405fdfe4de54614e9890d2 100644 --- a/Tests/Functional/PyCore/samplebuilder.py +++ b/Tests/Functional/PyCore/samplebuilder.py @@ -63,8 +63,8 @@ class SampleBuilderTest(unittest.TestCase): builder = SampleBuilder() self.assertEqual(builder.m_width.value, initial_width) - builder.setParameterValue("width", 43.0) - self.assertEqual(builder.m_width.value, 43.0) + builder.setParameterValue("width", 43) + self.assertEqual(builder.m_width.value, 43) def test_parameterString(self): """ @@ -79,13 +79,13 @@ class SampleBuilderTest(unittest.TestCase): """ builder = SampleBuilder() self.assertEqual(builder.m_onchange_counter, 0) - builder.setParameterValue("width", 43.0) + builder.setParameterValue("width", 43) self.assertEqual(builder.m_onchange_counter, 1) - builder.setParameterValue("width", 44.0) + builder.setParameterValue("width", 44) self.assertEqual(builder.m_onchange_counter, 2) # setting same value, onChange shouldn't be triggered - builder.setParameterValue("width", 44.0) + builder.setParameterValue("width", 44) self.assertEqual(builder.m_onchange_counter, 2) def test_registerPrototype(self): @@ -94,8 +94,8 @@ class SampleBuilderTest(unittest.TestCase): self.assertEqual(builder.m_onchange_counter, 0) self.assertEqual(builder.m_length, initial_length) - builder.setParameterValue("length", 43.0) - self.assertEqual(builder.m_length, 43.0) + builder.setParameterValue("length", 43) + self.assertEqual(builder.m_length, 43) self.assertEqual(builder.m_onchange_counter, 1) diff --git a/Tests/Functional/PyCore/shape2d.py b/Tests/Functional/PyCore/shape2d.py index 794763c866023c585212b9d63a17d86795ad9937..875f5018c262787422b3e43236271990b688e259 100644 --- a/Tests/Functional/PyCore/shape2d.py +++ b/Tests/Functional/PyCore/shape2d.py @@ -9,21 +9,21 @@ class Shape2DTest(unittest.TestCase): """ # initializing from list - x = [-1.0, 2.0, 2.0, -1.0] + x = [-1, 2, 2, -1.0] y = [-0.5, -0.5, 1.5, 1.5] p = ba.Polygon(x, y) self.assertTrue(p.contains(-0.75, -0.25)) - self.assertTrue(p.contains(1.5, 1.0)) + self.assertTrue(p.contains(1.5, 1)) # initializing from list inline - p2 = ba.Polygon([-1.0, 2.0, 2.0, -1.0], [-0.5, -0.5, 1.5, 1.5]) + p2 = ba.Polygon([-1, 2, 2, -1.0], [-0.5, -0.5, 1.5, 1.5]) self.assertTrue(p2.contains(-0.75, -0.25)) - self.assertTrue(p2.contains(1.5, 1.0)) + self.assertTrue(p2.contains(1.5, 1)) # initialization from 2D list inline - p3 = ba.Polygon([[-1.0, -0.5], [2.0, -0.5], [2.0, 1.5], [-1.0, 1.5]]) + p3 = ba.Polygon([[-1, -0.5], [2, -0.5], [2, 1.5], [-1, 1.5]]) self.assertTrue(p3.contains(-0.75, -0.25)) - self.assertTrue(p3.contains(1.5, 1.0)) + self.assertTrue(p3.contains(1.5, 1)) def test_constructPolygonFromNumpy(self): """ @@ -31,12 +31,12 @@ class Shape2DTest(unittest.TestCase): """ # initialization from numpy array - points = numpy.array([[-1.0, -0.5], [2.0, -0.5], [2.0, 1.5], - [-1.0, 1.5]]) + points = numpy.array([[-1, -0.5], [2, -0.5], [2, 1.5], + [-1, 1.5]]) p = ba.Polygon(points) self.assertTrue(p.contains(-0.75, -0.25)) - self.assertTrue(p.contains(1.5, 1.0)) + self.assertTrue(p.contains(1.5, 1)) if __name__ == '__main__': diff --git a/Tests/Functional/PyCore/sliced_composition.py b/Tests/Functional/PyCore/sliced_composition.py index 000d06191248be57bb7c7eb73d33b0f5e8bfe9f0..a6e1055ced71aab33ae84e7f9d93d8456d3f2aad 100644 --- a/Tests/Functional/PyCore/sliced_composition.py +++ b/Tests/Functional/PyCore/sliced_composition.py @@ -11,7 +11,7 @@ import bornagain as ba from bornagain import deg, kvector_t, nm mSubstrate = ba.HomogeneousMaterial("Substrate", 3.212e-6, 3.244e-8) -mAmbience = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) +mAmbience = ba.HomogeneousMaterial("Vacuum", 0, 0) mParticle = ba.HomogeneousMaterial("Ag", 1.245e-5, 5.419e-7) sphere_radius = 10.0 bottom_cup_height = 4.0 @@ -65,8 +65,8 @@ class SlicedSpheresTest(unittest.TestCase): # origin of resulting sphere will be at the bottom result = ba.ParticleComposition() - result.addParticle(topCup, kvector_t(0.0, 0.0, bottom_cup_height)) - result.addParticle(bottomCup, kvector_t(0.0, 0.0, 0.0)) + result.addParticle(topCup, kvector_t(0, 0, bottom_cup_height)) + result.addParticle(bottomCup, kvector_t(0, 0, 0)) return result @@ -89,8 +89,8 @@ class SlicedSpheresTest(unittest.TestCase): # origin of resulting sphere will be at the bottom result = ba.ParticleComposition() - result.addParticle(topCup, kvector_t(0.0, 0.0, bottom_cup_height)) - result.addParticle(bottomCup, kvector_t(0.0, 0.0, bottom_cup_height)) + result.addParticle(topCup, kvector_t(0, 0, bottom_cup_height)) + result.addParticle(bottomCup, kvector_t(0, 0, bottom_cup_height)) return result diff --git a/Tests/Functional/PyCore/sliced_spheres.py b/Tests/Functional/PyCore/sliced_spheres.py index dfe8561fa10a64c16590804f967f3d86348de6a2..1e51b8d561ee886749c02b625f4111c771df0f5f 100644 --- a/Tests/Functional/PyCore/sliced_spheres.py +++ b/Tests/Functional/PyCore/sliced_spheres.py @@ -11,7 +11,7 @@ import bornagain as ba from bornagain import deg, kvector_t mSubstrate = ba.HomogeneousMaterial("Substrate", 3.212e-6, 3.244e-8) -mAmbience = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) +mAmbience = ba.HomogeneousMaterial("Vacuum", 0, 0) class SlicedSpheresTest(unittest.TestCase): diff --git a/Tests/Functional/PyCore/transform_BoxComposition.py b/Tests/Functional/PyCore/transform_BoxComposition.py index e84f88b13cb076856461d57ec36b306463699337..9ed632d38848e686c8f9edc6c3526a9e65ff496e 100644 --- a/Tests/Functional/PyCore/transform_BoxComposition.py +++ b/Tests/Functional/PyCore/transform_BoxComposition.py @@ -22,7 +22,7 @@ particle_material = HomogeneousMaterial("Ag", 1.245e-5, 5.419e-7) class TransformBoxCompositionTest(unittest.TestCase): def get_sample(self, particle): - mAmbience = HomogeneousMaterial("Vacuum", 0.0, 0.0) + mAmbience = HomogeneousMaterial("Vacuum", 0, 0) mMiddle = HomogeneousMaterial("Teflon", 2.900e-6, 6.019e-9) mSubstrate = HomogeneousMaterial("Substrate", 3.212e-6, 3.244e-8) @@ -57,20 +57,20 @@ class TransformBoxCompositionTest(unittest.TestCase): height = 10.0 particle = Particle(particle_material, FormFactorBox(length, width, height)) - particle.setPosition(kvector_t(0, 0, -layer_thickness/2.0 - height/2.0)) + particle.setPosition(kvector_t(0, 0, -layer_thickness/2.0 - height/2)) reference_data = self.get_result(particle) #IntensityDataIOFactory.writeIntensityData(reference_data, "ref_BoxComposition.int") # composition box = Particle(particle_material, - FormFactorBox(com_length/2.0, com_width, com_height)) + FormFactorBox(com_length/2, com_width, com_height)) composition = ParticleComposition() # composition = ParticleComposition(box, positions) - composition.addParticle(box, kvector_t(0.0, 0.0, 0.0)) - composition.addParticle(box, kvector_t(com_length/2.0, 0.0, 0.0)) + composition.addParticle(box, kvector_t(0, 0, 0)) + composition.addParticle(box, kvector_t(com_length/2, 0, 0)) composition.setPosition( - kvector_t(0.0, 0.0, -layer_thickness/2.0 - com_height/2.0)) + kvector_t(0, 0, -layer_thickness/2.0 - com_height/2)) data = self.get_result(composition) @@ -89,19 +89,19 @@ class TransformBoxCompositionTest(unittest.TestCase): height = 20.0 particle = Particle(particle_material, FormFactorBox(length, width, height)) - particle.setPosition(kvector_t(0, 0, -layer_thickness/2.0 - height/2.0)) + particle.setPosition(kvector_t(0, 0, -layer_thickness/2.0 - height/2)) reference_data = self.get_result(particle) #IntensityDataIOFactory.writeIntensityData(reference_data, "ref_BoxCompositionRotateX.int") # composition box = Particle(particle_material, - FormFactorBox(com_length/2.0, com_width, com_height)) + FormFactorBox(com_length/2, com_width, com_height)) composition = ParticleComposition() - composition.addParticle(box, kvector_t(0.0, 0.0, 0.0)) - composition.addParticle(box, kvector_t(com_length/2.0, 0.0, 0.0)) + composition.addParticle(box, kvector_t(0, 0, 0)) + composition.addParticle(box, kvector_t(com_length/2, 0, 0)) composition.setRotation(RotationX(90*deg)) - composition.setPosition(kvector_t(0.0, 0.0, -layer_thickness/2.)) + composition.setPosition(kvector_t(0, 0, -layer_thickness/2.)) data = self.get_result(composition) @@ -120,20 +120,20 @@ class TransformBoxCompositionTest(unittest.TestCase): height = 50.0 particle = Particle(particle_material, FormFactorBox(length, width, height)) - particle.setPosition(kvector_t(0, 0, -layer_thickness/2.0 - height/2.0)) + particle.setPosition(kvector_t(0, 0, -layer_thickness/2.0 - height/2)) reference_data = self.get_result(particle) #IntensityDataIOFactory.writeIntensityData(reference_data, "ref_BoxCompositionRotateY.int") # composition box = Particle(particle_material, - FormFactorBox(com_length/2.0, com_width, com_height)) + FormFactorBox(com_length/2, com_width, com_height)) composition = ParticleComposition() - composition.addParticle(box, kvector_t(0.0, 0.0, 0.0)) - composition.addParticle(box, kvector_t(com_length/2.0, 0.0, 0.0)) + composition.addParticle(box, kvector_t(0, 0, 0)) + composition.addParticle(box, kvector_t(com_length/2, 0, 0)) composition.setRotation(RotationY(90*deg)) composition.setPosition( - kvector_t(0.0, 0.0, -layer_thickness/2. + com_length/4.)) + kvector_t(0, 0, -layer_thickness/2. + com_length/4.)) data = self.get_result(composition) @@ -153,20 +153,20 @@ class TransformBoxCompositionTest(unittest.TestCase): particle = Particle(particle_material, FormFactorBox(length, width, height)) particle.setPosition( - kvector_t(0.0, 0.0, -layer_thickness/2.0 - height/2.0)) + kvector_t(0, 0, -layer_thickness/2.0 - height/2)) reference_data = self.get_result(particle) #IntensityDataIOFactory.writeIntensityData(reference_data, "ref_BoxCompositionRotateZ.int") # composition box = Particle(particle_material, - FormFactorBox(com_length/2.0, com_width, com_height)) + FormFactorBox(com_length/2, com_width, com_height)) composition = ParticleComposition() - composition.addParticle(box, kvector_t(0.0, 0.0, 0.0)) - composition.addParticle(box, kvector_t(com_length/2.0, 0.0, 0.0)) + composition.addParticle(box, kvector_t(0, 0, 0)) + composition.addParticle(box, kvector_t(com_length/2, 0, 0)) composition.setRotation(RotationZ(90*deg)) composition.setPosition( - kvector_t(0.0, 0.0, -layer_thickness/2.0 - com_height/2.0)) + kvector_t(0, 0, -layer_thickness/2.0 - com_height/2)) data = self.get_result(composition) @@ -186,20 +186,20 @@ class TransformBoxCompositionTest(unittest.TestCase): particle = Particle(particle_material, FormFactorBox(length, width, height)) particle.setPosition( - kvector_t(0.0, 0.0, -layer_thickness/2.0 - height/2.0)) + kvector_t(0, 0, -layer_thickness/2.0 - height/2)) reference_data = self.get_result(particle) #IntensityDataIOFactory.writeIntensityData(reference_data, "ref_BoxCompositionRotateZandY.int") # composition box = Particle(particle_material, - FormFactorBox(com_length/2.0, com_width, com_height)) + FormFactorBox(com_length/2, com_width, com_height)) composition = ParticleComposition() - composition.addParticle(box, kvector_t(0.0, 0.0, 0.0)) - composition.addParticle(box, kvector_t(com_length/2.0, 0.0, 0.0)) + composition.addParticle(box, kvector_t(0, 0, 0)) + composition.addParticle(box, kvector_t(com_length/2, 0, 0)) composition.setRotation(RotationZ(90*deg)) composition.rotate(RotationY(90*deg)) - composition.setPosition(kvector_t(0.0, 0.0, -layer_thickness/2.)) + composition.setPosition(kvector_t(0, 0, -layer_thickness/2.)) data = self.get_result(composition) @@ -219,7 +219,7 @@ class TransformBoxCompositionTest(unittest.TestCase): particle = Particle(particle_material, FormFactorBox(length, width, height)) particle.setPosition( - kvector_t(0.0, 0.0, -layer_thickness/2.0 - height/2.0)) + kvector_t(0, 0, -layer_thickness/2.0 - height/2)) reference_data = self.get_result(particle) #IntensityDataIOFactory.writeIntensityData(reference_data, "ref_BoxStackComposition.int") @@ -241,12 +241,12 @@ class TransformBoxCompositionTest(unittest.TestCase): box2 = Particle(particle_material, FormFactorBox(box2_length, box2_width, box2_height)) box2.setRotation(RotationY(90*deg)) - box2.setPosition(kvector_t(-box2_height/2.0, 0.0, box2_length/2.0)) + box2.setPosition(kvector_t(-box2_height/2, 0, box2_length/2)) - composition.addParticle(box1, kvector_t(0.0, 0.0, 0.0)) - composition.addParticle(box2, kvector_t(0.0, 0.0, box1_height)) + composition.addParticle(box1, kvector_t(0, 0, 0)) + composition.addParticle(box2, kvector_t(0, 0, box1_height)) composition.setRotation(RotationY(90*deg)) - composition.setPosition(kvector_t(0.0, 0.0, -layer_thickness/2.)) + composition.setPosition(kvector_t(0, 0, -layer_thickness/2.)) data = self.get_result(composition) diff --git a/Tests/Functional/PyCore/transform_CoreShellBox.py b/Tests/Functional/PyCore/transform_CoreShellBox.py index f280ced529f06ca0dbb4214e78b470214c1ba2c8..f1de3a2edc4abb37b8db450b7f94199d097c4ae0 100644 --- a/Tests/Functional/PyCore/transform_CoreShellBox.py +++ b/Tests/Functional/PyCore/transform_CoreShellBox.py @@ -17,7 +17,7 @@ layer_thickness = 100.0 class TransformCoreShellBoxTest(unittest.TestCase): def get_sample(self, particle): - mAmbience = HomogeneousMaterial("Vacuum", 0.0, 0.0) + mAmbience = HomogeneousMaterial("Vacuum", 0, 0) mMiddle = HomogeneousMaterial("Teflon", 2.900e-6, 6.019e-9) mSubstrate = HomogeneousMaterial("Substrate", 3.212e-6, 3.244e-8) @@ -54,7 +54,7 @@ class TransformCoreShellBoxTest(unittest.TestCase): particle = Particle( mCore, FormFactorBox(shell_length, shell_width, shell_height)) particle.setPosition( - kvector_t(0.0, 0.0, -layer_thickness/2.0 - shell_height/2.0)) + kvector_t(0, 0, -layer_thickness/2.0 - shell_height/2)) reference_data = self.get_result(particle) @@ -66,9 +66,9 @@ class TransformCoreShellBoxTest(unittest.TestCase): core = Particle(mCore, FormFactorBox(core_length, core_width, core_height)) coreshell = ParticleCoreShell( - shell, core, kvector_t(0.0, 0.0, (shell_height - core_height)/2.0)) + shell, core, kvector_t(0, 0, (shell_height - core_height)/2)) coreshell.setPosition( - kvector_t(0.0, 0.0, -layer_thickness/2.0 - shell_height/2.0)) + kvector_t(0, 0, -layer_thickness/2.0 - shell_height/2)) data = self.get_result(coreshell) @@ -99,11 +99,11 @@ class TransformCoreShellBoxTest(unittest.TestCase): mShell, FormFactorBox(shell_length, shell_width, shell_height)) coreshell_ref = ParticleCoreShell( shell_ref, core_ref, - kvector_t(0.0, 0.0, (shell_height - core_height)/2.0)) + kvector_t(0, 0, (shell_height - core_height)/2)) coreshell_ref.setPosition( kvector_t( - 0.0, 0.0, -layer_thickness/2.0 - - shell_height/2.0)) # center of coreshell in center of the layer + 0, 0, -layer_thickness/2.0 - + shell_height/2)) # center of coreshell in center of the layer reference_data = self.get_result(coreshell_ref) @@ -120,11 +120,11 @@ class TransformCoreShellBoxTest(unittest.TestCase): shell = Particle(mShell, FormFactorBox(shell_length, shell_width, shell_height)) coreshell = ParticleCoreShell( - shell, core, kvector_t(0.0, 0.0, (shell_height - core_height)/2.0)) - coreshell.setRotation(RotationZ(90.0*deg)) + shell, core, kvector_t(0, 0, (shell_height - core_height)/2)) + coreshell.setRotation(RotationZ(90*deg)) coreshell.setPosition( - kvector_t(0.0, 0.0, -layer_thickness/2.0 - shell_height/ - 2.0)) # center of coreshell in center of the layer + kvector_t(0, 0, -layer_thickness/2.0 - shell_height/ + 2)) # center of coreshell in center of the layer data = self.get_result(coreshell) @@ -155,11 +155,11 @@ class TransformCoreShellBoxTest(unittest.TestCase): mShell, FormFactorBox(shell_length, shell_width, shell_height)) coreshell_ref = ParticleCoreShell( shell_ref, core_ref, - kvector_t(0.0, 0.0, (shell_height - core_height)/2.0)) + kvector_t(0, 0, (shell_height - core_height)/2)) coreshell_ref.setPosition( kvector_t( - 0.0, 0.0, -layer_thickness/2.0 - - shell_height/2.0)) # center of coreshell in center of the layer + 0, 0, -layer_thickness/2.0 - + shell_height/2)) # center of coreshell in center of the layer reference_data = self.get_result(coreshell_ref) @@ -176,11 +176,11 @@ class TransformCoreShellBoxTest(unittest.TestCase): shell = Particle(mShell, FormFactorBox(shell_length, shell_width, shell_height)) coreshell = ParticleCoreShell( - shell, core, kvector_t(0.0, 0.0, (shell_height - core_height)/2.0)) + shell, core, kvector_t(0, 0, (shell_height - core_height)/2)) coreshell.setRotation(RotationY(90.*deg)) coreshell.setPosition( - kvector_t(0.0, 0.0, -layer_thickness/ - 2.0)) # center of coreshell in center of the layer + kvector_t(0, 0, -layer_thickness/ + 2)) # center of coreshell in center of the layer data = self.get_result(coreshell) @@ -211,11 +211,11 @@ class TransformCoreShellBoxTest(unittest.TestCase): mShell, FormFactorBox(shell_length, shell_width, shell_height)) coreshell_ref = ParticleCoreShell( shell_ref, core_ref, - kvector_t(0.0, 0.0, (shell_height - core_height)/2.0)) + kvector_t(0, 0, (shell_height - core_height)/2)) coreshell_ref.setPosition( kvector_t( - 0.0, 0.0, -layer_thickness/2.0 - - shell_height/2.0)) # center of coreshell in center of the layer + 0, 0, -layer_thickness/2.0 - + shell_height/2)) # center of coreshell in center of the layer reference_data = self.get_result(coreshell_ref) #IntensityDataIOFactory.writeIntensityData(reference_data, "ref_CoreShellBoxRotateZandY.int") @@ -233,13 +233,13 @@ class TransformCoreShellBoxTest(unittest.TestCase): shell = Particle(mShell, FormFactorBox(shell_length, shell_width, shell_height)) coreshell = ParticleCoreShell( - shell, core, kvector_t(0.0, 0.0, (shell_height - core_height)/2.0)) - coreshell.setRotation(RotationZ(90.0*deg)) - coreshell.rotate(RotationY(90.0*deg)) + shell, core, kvector_t(0, 0, (shell_height - core_height)/2)) + coreshell.setRotation(RotationZ(90*deg)) + coreshell.rotate(RotationY(90*deg)) # rotation changes reference point, which now coincide with center of the volume coreshell.setPosition( - kvector_t(0.0, 0.0, -layer_thickness/ - 2.0)) # center of coreshell in center of the layer + kvector_t(0, 0, -layer_thickness/ + 2)) # center of coreshell in center of the layer data = self.get_result(coreshell) diff --git a/Tests/Functional/PyCore/transform_box.py b/Tests/Functional/PyCore/transform_box.py index 60cb7fc8a066042e5482dc425fb754bcd5fd78de..8f15e4b2cf905e7ba736b7cfe3f45d4cec795b64 100644 --- a/Tests/Functional/PyCore/transform_box.py +++ b/Tests/Functional/PyCore/transform_box.py @@ -16,7 +16,7 @@ layer_thickness = 100 class BoxTransformationsTest(unittest.TestCase): def get_sample(self, particle): - mAmbience = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) + mAmbience = ba.HomogeneousMaterial("Vacuum", 0, 0) mMiddle = ba.HomogeneousMaterial("Teflon", 2.900e-6, 6.019e-9) mSubstrate = ba.HomogeneousMaterial("Substrate", 3.212e-6, 3.244e-8) diff --git a/Tests/Functional/PyCore/transform_cube.py b/Tests/Functional/PyCore/transform_cube.py index 907cd5a770b49824f8b5a361f8d99a49a1911c0b..73e9cb63c375c1592ee3489feaaec488f6f2dd80 100644 --- a/Tests/Functional/PyCore/transform_cube.py +++ b/Tests/Functional/PyCore/transform_cube.py @@ -20,7 +20,7 @@ class RotationsCubeTest(unittest.TestCase): layout_rot=None, layout_pos=None, add_to="Vacuum"): - mAmbience = HomogeneousMaterial("Vacuum", 0.0, 0.0) + mAmbience = HomogeneousMaterial("Vacuum", 0, 0) mParticle = HomogeneousMaterial("Particle", 6e-4, 2e-8) mMiddle = HomogeneousMaterial("MidleLayer", 5e-5, 2e-8) mSubstrate = HomogeneousMaterial("Substrate", 6e-6, 2e-8) @@ -33,16 +33,16 @@ class RotationsCubeTest(unittest.TestCase): layout = ParticleLayout() if layout_rot and layout_pos: - layout.addParticle(particle, 1.0, layout_pos, layout_rot) + layout.addParticle(particle, 1, layout_pos, layout_rot) elif layout_rot and not layout_pos: - layout.addParticle(particle, 1.0, kvector_t(0, 0, 0), layout_rot) + layout.addParticle(particle, 1, kvector_t(0, 0, 0), layout_rot) elif not layout_rot and layout_pos: - layout.addParticle(particle, 1.0, layout_pos) + layout.addParticle(particle, 1, layout_pos) else: layout.addParticle(particle) vacuum_layer = Layer(mAmbience) - middle_layer = Layer(mSubstrate, 50.0) + middle_layer = Layer(mSubstrate, 50) substrate = Layer(mSubstrate) if add_to == "Vacuum": @@ -112,14 +112,14 @@ class RotationsCubeTest(unittest.TestCase): data_to_test = [ # ff rot pos layout_rot layout_pos (box, None, None, None, None), # reference - (box, RotationY(90.*deg), kvector_t(0, 0, 5.0), None, + (box, RotationY(90.*deg), kvector_t(0, 0, 5), None, None), # rotating and translating (box, None, None, RotationY(90.*deg), - kvector_t(0, 0, 5.0)), # rotating and translating + kvector_t(0, 0, 5)), # rotating and translating (box, RotationY(90.*deg), None, None, - kvector_t(0, 0, 5.0)), # rotating and translating - (box, RotationY(45.*deg), kvector_t(0, 0, 0.0), RotationY(45.*deg), - kvector_t(0, 0, 5.0)), # rotating and translating + kvector_t(0, 0, 5)), # rotating and translating + (box, RotationY(45.*deg), kvector_t(0, 0, 0), RotationY(45.*deg), + kvector_t(0, 0, 5)), # rotating and translating ] reference_data = self.get_result(data_to_test[0]) @@ -143,14 +143,14 @@ class RotationsCubeTest(unittest.TestCase): data_to_test = [ # ff rot pos layout_rot layout_pos (box, None, None, None, None), # reference - (box, RotationX(90.*deg), kvector_t(0, 0, 5.0), None, + (box, RotationX(90.*deg), kvector_t(0, 0, 5), None, None), # rotating and translating (box, None, None, RotationX(90.*deg), - kvector_t(0, 0, 5.0)), # rotating and translating + kvector_t(0, 0, 5)), # rotating and translating (box, RotationX(90.*deg), None, None, - kvector_t(0, 0, 5.0)), # rotating and translating - (box, RotationX(45.*deg), kvector_t(0, 0, 0.0), RotationX(45.*deg), - kvector_t(0, 0, 5.0)), # rotating and translating + kvector_t(0, 0, 5)), # rotating and translating + (box, RotationX(45.*deg), kvector_t(0, 0, 0), RotationX(45.*deg), + kvector_t(0, 0, 5)), # rotating and translating ] reference_data = self.get_result(data_to_test[0]) @@ -171,8 +171,8 @@ class RotationsCubeTest(unittest.TestCase): data_to_test = [ # ff rot pos layout_rot layout_pos - (box, None, kvector_t(0, 0, -25.0), None, None), # reference - (box, RotationX(90.*deg), kvector_t(0, 0, -20.0), None, + (box, None, kvector_t(0, 0, -25), None, None), # reference + (box, RotationX(90.*deg), kvector_t(0, 0, -20), None, None), # rotating and translating ] diff --git a/Tests/Functional/PyFit/fitobjective_api.py b/Tests/Functional/PyFit/fitobjective_api.py index 27ebf571de6cc73fdfd4f2e160efe1f58c15cf39..606dde5d791d764a7f8585c23e5f9395fe48b188 100644 --- a/Tests/Functional/PyFit/fitobjective_api.py +++ b/Tests/Functional/PyFit/fitobjective_api.py @@ -23,14 +23,14 @@ class SimulationBuilder: self.m_pars = dict(pars) ml = ba.MultiLayer() - material = ba.HomogeneousMaterial("Shell", 0.0, 0.0) + material = ba.HomogeneousMaterial("Shell", 0, 0) ml.addLayer(ba.Layer(material)) ml.addLayer(ba.Layer(material)) simulation = ba.GISASSimulation() simulation.setSample(ml) - simulation.setDetectorParameters(self.m_ncol, 0.0, 1.0, self.m_nrow, - 0.0, 1.0) + simulation.setDetectorParameters(self.m_ncol, 0, 1, self.m_nrow, + 0, 1) return simulation def create_data(self): @@ -53,15 +53,15 @@ class FitObjectiveAPITest(unittest.TestCase): Testing simulation construction using Python callback """ pars = ba.Parameters() - pars.add(ba.Parameter("par0", 0.0)) - pars.add(ba.Parameter("par1", 1.0)) + pars.add(ba.Parameter("par0", 0)) + pars.add(ba.Parameter("par1", 1)) builder = SimulationBuilder() data = builder.create_data() # adding simulation callback and experimental data objective = ba.FitObjective() - objective.addSimulationAndData(builder.build_simulation, data, 1.0) + objective.addSimulationAndData(builder.build_simulation, data, 1) self.assertEqual(builder.m_ncalls, 0) self.assertEqual(objective.numberOfFitElements(), 0) @@ -69,15 +69,15 @@ class FitObjectiveAPITest(unittest.TestCase): objective.evaluate(pars) self.assertEqual(builder.m_ncalls, 1) self.assertEqual(objective.numberOfFitElements(), builder.size()) - self.assertEqual(builder.m_pars["par0"], 0.0) - self.assertEqual(builder.m_pars["par1"], 1.0) + self.assertEqual(builder.m_pars["par0"], 0) + self.assertEqual(builder.m_pars["par1"], 1) # checking arrays of experimental and simulated data expected_sim = [] expected_data = [] for i in range(0, builder.size()): - expected_sim.append(0.0) - expected_data.append(1.0) + expected_sim.append(0) + expected_data.append(1) self.assertEqual(expected_sim, list(objective.simulation_array())) self.assertEqual(expected_data, list(objective.experimental_array())) @@ -86,14 +86,14 @@ class FitObjectiveAPITest(unittest.TestCase): Testing simulation construction using Python callback """ pars = ba.Parameters() - pars.add(ba.Parameter("par0", 0.0)) - pars.add(ba.Parameter("par1", 1.0)) + pars.add(ba.Parameter("par0", 0)) + pars.add(ba.Parameter("par1", 1)) # adding simulation callback and experimental data builder = SimulationBuilder() data = builder.create_data() objective = ba.FitObjective() - objective.addSimulationAndData(builder.build_simulation, data, 1.0) + objective.addSimulationAndData(builder.build_simulation, data, 1) # adding observer observer = FitObserver() @@ -112,15 +112,15 @@ class FitObjectiveAPITest(unittest.TestCase): """ params = ba.Parameters() - params.add("bbb", 1.0) - params.add("aaa", 2.0) + params.add("bbb", 1) + params.add("aaa", 2) info = ba.IterationInfo() - info.update(params, 3.0) + info.update(params, 3) par_map = info.parameterMap() expected_names = ["aaa", "bbb"] - expected_values = [2.0, 1.0] + expected_values = [2, 1.0] names = [] values = [] for key in par_map: diff --git a/Tests/Functional/PyFit/minimizer_api.py b/Tests/Functional/PyFit/minimizer_api.py index ee5bbe4d0136bfb16bf6743e7823bd24317a4f6b..2f66adb0c23b5f1cae863379fddb187c3912eb0f 100644 --- a/Tests/Functional/PyFit/minimizer_api.py +++ b/Tests/Functional/PyFit/minimizer_api.py @@ -23,10 +23,10 @@ class MinimizerAPITest(unittest.TestCase): """ Testing p.value attribute """ - par = ba.Parameter("par", 1.0) - self.assertEqual(par.value, 1.0) + par = ba.Parameter("par", 1) + self.assertEqual(par.value, 1) par.value = 42.0 - self.assertEqual(par.value, 42.0) + self.assertEqual(par.value, 42) def test_ParametersSetIterator(self): """ @@ -36,8 +36,8 @@ class MinimizerAPITest(unittest.TestCase): pars = ba.Parameters() self.assertEqual(pars.size(), 0) - pars.add(ba.Parameter("par0", 1.0, ba.AttLimits.limitless())) - pars.add(ba.Parameter("par1", 2.0, ba.AttLimits.limitless())) + pars.add(ba.Parameter("par0", 1, ba.AttLimits.limitless())) + pars.add(ba.Parameter("par1", 2, ba.AttLimits.limitless())) expected_names = ["par0", "par1"] for index, p in enumerate(pars): self.assertEqual(p.name(), expected_names[index]) @@ -48,21 +48,21 @@ class MinimizerAPITest(unittest.TestCase): """ params = ba.Parameters() - params.add("par0", 0.0) - params.add("par1", 1.0, min=1.0) - params.add("par2", 2.0, max=2.0) - params.add("par3", 3.0, min=1.0, max=2.0) - params.add("par4", 4.0, vary=False) + params.add("par0", 0) + params.add("par1", 1, min=1) + params.add("par2", 2, max=2) + params.add("par3", 3, min=1, max=2) + params.add("par4", 4, vary=False) self.assertTrue(params["par0"].limits().isLimitless()) self.assertTrue(params["par1"].limits().isLowerLimited()) - self.assertEqual(params["par1"].limits().lowerLimit(), 1.0) + self.assertEqual(params["par1"].limits().lowerLimit(), 1) self.assertTrue(params["par2"].limits().isUpperLimited()) - self.assertEqual(params["par2"].limits().upperLimit(), 2.0) + self.assertEqual(params["par2"].limits().upperLimit(), 2) self.assertTrue(params["par3"].limits().isLimited()) - self.assertEqual(params["par3"].limits().lowerLimit(), 1.0) - self.assertEqual(params["par3"].limits().upperLimit(), 2.0) + self.assertEqual(params["par3"].limits().lowerLimit(), 1) + self.assertEqual(params["par3"].limits().upperLimit(), 2) self.assertTrue(params["par4"].limits().isFixed()) @@ -71,22 +71,22 @@ class MinimizerAPITest(unittest.TestCase): minimizer.setMinimizer("Test") pars = ba.Parameters() - pars.add(ba.Parameter("par0", 0.0)) - pars.add(ba.Parameter("par1", 1.0)) - pars.add(ba.Parameter("par2", 2.0)) + pars.add(ba.Parameter("par0", 0)) + pars.add(ba.Parameter("par1", 1)) + pars.add(ba.Parameter("par2", 2)) helper = TestMinimizerHelper() result = minimizer.minimize(helper.objective_function, pars) # return value of objective function was propagated to MinimizerResult - self.assertEqual(result.minValue(), 42.0) + self.assertEqual(result.minValue(), 42) # objective function was called twice #(once by test minimizer, and second time during return type deduction) self.assertEqual(helper.m_ncalls, 2) # starting values of fit parameters were correctly send to objective func - self.assertEqual(list(helper.m_pars.values()), [0.0, 1.0, 2.0]) + self.assertEqual(list(helper.m_pars.values()), [0, 1, 2.0]) if __name__ == '__main__': diff --git a/Tests/Functional/PyFit/standalone_fits.py b/Tests/Functional/PyFit/standalone_fits.py index e3518b757cac750dc8047eafa1643a1f736fccd8..5b15d2c7a13f173b31fe03f20860184c3b0bc469 100644 --- a/Tests/Functional/PyFit/standalone_fits.py +++ b/Tests/Functional/PyFit/standalone_fits.py @@ -11,7 +11,7 @@ import numpy as np class Rosenbrock: def __init__(self): self.m_expected_minimum = 0.0 - self.m_expected_params = [1.0, 1.0] + self.m_expected_params = [1, 1.0] pass def objective_function(self, params): @@ -35,13 +35,13 @@ def decaying_sin(params, x): class DecayingSin: def __init__(self): - self.m_x = np.linspace(0.0, 10.0, 100) + self.m_x = np.linspace(0, 10, 100) self.m_params = ba.Parameters() - self.m_params.add(ba.Parameter('amp', 10.0)) + self.m_params.add(ba.Parameter('amp', 10)) self.m_params.add(ba.Parameter('decay', 0.05)) - self.m_params.add(ba.Parameter('phase', 1.0)) - self.m_params.add(ba.Parameter('frequency', 4.0)) - self.m_eps_data = np.linspace(0.0, 10.0, 100) + self.m_params.add(ba.Parameter('phase', 1)) + self.m_params.add(ba.Parameter('frequency', 4)) + self.m_eps_data = np.linspace(0, 10, 100) self.m_eps_data.fill(0.01) self.m_data = decaying_sin(self.m_params, self.m_x) @@ -57,8 +57,8 @@ class StandaloneFitTest(unittest.TestCase): """ params = ba.Parameters() params.add( - ba.Parameter("x", -1.2, ba.AttLimits.limited(-5.0, 5.0), 0.01)) - params.add(ba.Parameter("y", 1.0, ba.AttLimits.limited(-5.0, 5.0), + ba.Parameter("x", -1.2, ba.AttLimits.limited(-5, 5), 0.01)) + params.add(ba.Parameter("y", 1, ba.AttLimits.limited(-5, 5), 0.01)) model = Rosenbrock() @@ -79,8 +79,8 @@ class StandaloneFitTest(unittest.TestCase): params = ba.Parameters() params.add(ba.Parameter('amp', 1, ba.AttLimits.positive())) params.add(ba.Parameter('decay', 0.1, ba.AttLimits.positive())) - params.add(ba.Parameter('phase', 0.1, ba.AttLimits.limited(0.0, 3.1))) - params.add(ba.Parameter('frequency', 1.0, ba.AttLimits.positive())) + params.add(ba.Parameter('phase', 0.1, ba.AttLimits.limited(0, 3.1))) + params.add(ba.Parameter('frequency', 1, ba.AttLimits.positive())) model = DecayingSin() minimizer = ba.Minimizer() diff --git a/Tests/Performance/Python/test_performance.py b/Tests/Performance/Python/test_performance.py index 6efeeef3c5af1deaf3aacdbe019a1305fb0872d5..1dc7092360d0f2131e889dfda896c883927f10aa 100755 --- a/Tests/Performance/Python/test_performance.py +++ b/Tests/Performance/Python/test_performance.py @@ -42,8 +42,8 @@ except: get_cpu_time = lambda: None # globals used in custom form factor -phi_min, phi_max = -1.0, 1.0 -alpha_min, alpha_max = 0.0, 2.0 +phi_min, phi_max = -1, 1.0 +alpha_min, alpha_max = 0, 2.0 # user-defined custom form factor @@ -158,15 +158,15 @@ class CustomTest(FactoryTest): Build and return the sample to calculate custom form factor in Distorted Wave Born Approximation. """ # defining materials - m_vacuum = HomogeneousMaterial("Vacuum", 0.0, 0.0) + m_vacuum = HomogeneousMaterial("Vacuum", 0, 0) m_substrate = HomogeneousMaterial("Substrate", 6e-6, 2e-8) m_particle = HomogeneousMaterial("Particle", 6e-4, 2e-8) # collection of particles - ff = CustomFormFactor(343.0*nm, 7.0*nm) + ff = CustomFormFactor(343*nm, 7*nm) particle = Particle(m_particle, ff) particle_layout = ParticleLayout() - particle_layout.addParticle(particle, 1.0) + particle_layout.addParticle(particle, 1) vacuum_layer = Layer(m_vacuum) vacuum_layer.addLayout(particle_layout) substrate_layer = Layer(m_substrate) @@ -187,7 +187,7 @@ class CustomTest(FactoryTest): simulation.getOptions().setNumberOfThreads(-1) 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) + simulation.setBeamParameters(1*angstrom, 0.2*deg, 0*deg) return simulation diff --git a/Wrap/Python/ba_fitmonitor.py b/Wrap/Python/ba_fitmonitor.py index 890d8a868c40cc859f483e4f93a120b1fe3b17f4..4b01ec3c56624c4d38625df552002930e9be4042 100644 --- a/Wrap/Python/ba_fitmonitor.py +++ b/Wrap/Python/ba_fitmonitor.py @@ -211,7 +211,7 @@ class PlotterSpecular(Plotter): colLabels=labels, cellLoc='center', loc='bottom left', - bbox=[0.0, 0.0, 1.0, 1.0]) + bbox=[0, 0, 1, 1.0]) def plot_graph(self, fit_objective): # retrieving data from fit suite