Skip to content
Snippets Groups Projects
Commit a64c3774 authored by Yurov, Dmitry's avatar Yurov, Dmitry
Browse files

Run PyPersistance tests on spec with regenerating simulations

parent d35e138a
No related branches found
No related tags found
No related merge requests found
...@@ -34,12 +34,12 @@ def get_sample(): ...@@ -34,12 +34,12 @@ def get_sample():
return multi_layer return multi_layer
def get_simulation(): def get_simulation(scan_size=500):
""" """
Defines and returns a specular simulation. Defines and returns a specular simulation.
""" """
simulation = ba.SpecularSimulation() simulation = ba.SpecularSimulation()
scan = ba.AngularSpecScan(1.54 * angstrom, 500, scan = ba.AngularSpecScan(1.54 * angstrom, scan_size,
0.0 * deg, 2.0 * deg) 0.0 * deg, 2.0 * deg)
simulation.setScan(scan) simulation.setScan(scan)
return simulation return simulation
......
...@@ -13,7 +13,6 @@ wavelength = 1.54 * ba.angstrom ...@@ -13,7 +13,6 @@ wavelength = 1.54 * ba.angstrom
alpha_i_min = 0.0 * ba.deg # min incident angle, deg alpha_i_min = 0.0 * ba.deg # min incident angle, deg
alpha_i_max = 2.0 * ba.deg # max incident angle, rad alpha_i_max = 2.0 * ba.deg # max incident angle, rad
beam_sample_ratio = 0.01 # beam-to-sample size ratio beam_sample_ratio = 0.01 # beam-to-sample size ratio
n_bins = 500 # number of bins in the reflectivity curve
# convolution parameters # convolution parameters
d_ang = 0.01 * ba.deg # spread width for incident angle d_ang = 0.01 * ba.deg # spread width for incident angle
...@@ -67,7 +66,7 @@ def create_real_data(): ...@@ -67,7 +66,7 @@ def create_real_data():
return ax_values, real_data return ax_values, real_data
def get_simulation(): def get_simulation(scan_size=500):
""" """
Returns a specular simulation with beam and detector defined. Returns a specular simulation with beam and detector defined.
""" """
...@@ -76,7 +75,7 @@ def get_simulation(): ...@@ -76,7 +75,7 @@ def get_simulation():
# exception is thrown. # exception is thrown.
footprint = ba.FootprintFactorSquare(beam_sample_ratio) footprint = ba.FootprintFactorSquare(beam_sample_ratio)
scan = ba.AngularSpecScan(wavelength, n_bins, alpha_i_min, alpha_i_max) scan = ba.AngularSpecScan(wavelength, scan_size, alpha_i_min, alpha_i_max)
scan.setFootprintFactor(footprint) scan.setFootprintFactor(footprint)
simulation = ba.SpecularSimulation() simulation = ba.SpecularSimulation()
......
...@@ -9,7 +9,6 @@ import bornagain as ba ...@@ -9,7 +9,6 @@ import bornagain as ba
wavelength = 1.54 * ba.angstrom wavelength = 1.54 * ba.angstrom
alpha_i_min = 0.0 * ba.deg # min incident angle, deg alpha_i_min = 0.0 * ba.deg # min incident angle, deg
alpha_i_max = 2.0 * ba.deg # max incident angle, rad alpha_i_max = 2.0 * ba.deg # max incident angle, rad
n_bins = 500 # number of bins in the reflectivity curve
# convolution parameters # convolution parameters
d_wl = 0.01 * wavelength # spread width for wavelength d_wl = 0.01 * wavelength # spread width for wavelength
...@@ -51,7 +50,7 @@ def get_sample(): ...@@ -51,7 +50,7 @@ def get_sample():
return multi_layer return multi_layer
def get_simulation(): def get_simulation(scan_size=500):
""" """
Returns a specular simulation with beam and detector defined. Returns a specular simulation with beam and detector defined.
""" """
...@@ -62,7 +61,7 @@ def get_simulation(): ...@@ -62,7 +61,7 @@ def get_simulation():
alpha_distr = ba.DistributionGaussian(0.0, d_ang) alpha_distr = ba.DistributionGaussian(0.0, d_ang)
wavelength_distr = ba.DistributionGaussian(wavelength, d_wl) wavelength_distr = ba.DistributionGaussian(wavelength, d_wl)
simulation = ba.SpecularSimulation() simulation = ba.SpecularSimulation()
scan = ba.AngularSpecScan(wavelength, n_bins, alpha_i_min, alpha_i_max) scan = ba.AngularSpecScan(wavelength, scan_size, alpha_i_min, alpha_i_max)
simulation.setScan(scan) simulation.setScan(scan)
simulation.addParameterDistribution("*/Beam/InclinationAngle", simulation.addParameterDistribution("*/Beam/InclinationAngle",
alpha_distr, n_points, n_sig) alpha_distr, n_points, n_sig)
......
...@@ -25,13 +25,7 @@ def get_simulation_SpecularSimulation(): ...@@ -25,13 +25,7 @@ def get_simulation_SpecularSimulation():
""" """
Returns custom simulation for SpecularSimulation.py. Returns custom simulation for SpecularSimulation.py.
""" """
simulation = example.get_simulation() simulation = example.get_simulation(scan_size=10)
beam = simulation.getInstrument().getBeam()
wavelength = beam.getWavelength()
axis = simulation.coordinateAxis()
footprint = simulation.footprintFactor()
simulation.setBeamParameters(
wavelength, 10, axis.getMin(), axis.getMax(), footprint)
return simulation return simulation
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment