Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/validate_bornagain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
run: |
python3 -m pip install --upgrade pip
python3 -m pip install cython pytest build wheel setuptools
python3 -m pip install numpy==1.26.4 matplotlib auditwheel
# python3 -m pip install numpy==1.26.4 matplotlib auditwheel

- name: Install BornAgain
run: |
Expand Down
22 changes: 14 additions & 8 deletions validation/scripts/test_bornagain.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import bornagain as ba
from bornagain import angstrom, nm
from bornagain.numpyutil import Arrayf64Converter as dac


def get_sample(slabs):
Expand All @@ -13,16 +12,19 @@ def get_sample(slabs):
"""
# creating materials
multi_layer = ba.Sample()
color = (0.1, 0.1, 0.1)

ambient = ba.MaterialBySLD("ma", slabs[0, 1] * 1e-6, 0)
ambient = ba.SLDMaterial("ma", color, slabs[0, 1] * 1e-6, 0)
layer = ba.Layer(ambient)
multi_layer.addLayer(layer)

# use erf transition between layers:
transient = ba.ErfTransient()

for slab in slabs[1:-1]:
material = ba.MaterialBySLD("stuff", slab[1] * 1e-6, slab[2] * 1e-6)
material = ba.SLDMaterial(
"stuff", color, slab[1] * 1e-6, slab[2] * 1e-6
)

# sig: (
# SelfAffineFractalModel self,
Expand All @@ -32,15 +34,19 @@ def get_sample(slabs):
# double maxSpatFrequency=0.5
# ) -> SelfAffineFractalModel

r_autocorr = ba.SelfAffineFractalModel(slab[3] * angstrom, 1.0, 1000 * nm)
r_autocorr = ba.SelfAffineFractalModel(
slab[3] * angstrom, 1.0, 1000 * nm
)
roughness = ba.Roughness(r_autocorr, transient)
layer = ba.Layer(material, slab[0] * angstrom, roughness)

multi_layer.addLayer(layer)

substrate = ba.MaterialBySLD("msub", slabs[-1, 1] * 1e-6, 0)
substrate = ba.SLDMaterial("msub", color, slabs[-1, 1] * 1e-6, 0)

r_autocorr = ba.SelfAffineFractalModel(slabs[-1, 3] * angstrom, 1.0, 1000 * nm)
r_autocorr = ba.SelfAffineFractalModel(
slabs[-1, 3] * angstrom, 1.0, 1000 * nm
)

roughness = ba.Roughness(r_autocorr, transient)
layer = ba.Layer(substrate, roughness)
Expand Down Expand Up @@ -116,7 +122,7 @@ def resolution_test(slabs, data):
simulation = get_simulation_smeared(data[:, 0], data[:, -1], sample)

res = simulation.simulate()
R = dac.npArray(res.dataArray())
R = res.intensities()

assert R.shape == data[:, 1].shape

Expand All @@ -137,7 +143,7 @@ def kernel_test(slabs, data):
sample = get_sample(slabs)
simulation = get_simulation(data[:, 0], sample)
res = simulation.simulate()
R = dac.npArray(res.dataArray())
R = res.intensities()

assert R.shape == data[:, 1].shape

Expand Down
Loading