Skip to content
Snippets Groups Projects
Commit c618e5a0 authored by Mikhail Svechnikov's avatar Mikhail Svechnikov
Browse files

[m.regenerate] Regenerate examples ()

Merging branch 'm.regenerate'  into 'main'.

See merge request !2575
parents 4d28e9f3 8fb67157
No related branches found
No related tags found
1 merge request!2575Regenerate examples
Pipeline #145032 passed
#!/usr/bin/env python3
"""
"""
import numpy as np
import bornagain as ba
from bornagain import ba_plot as bp, nm
def get_sample():
# Materials
material_A = ba.MaterialBySLD("A", 5e-06, 0)
material_substrate = ba.MaterialBySLD("Substrate", 2e-06, 0)
# Layers
ambient_layer = ba.Layer(ba.Vacuum())
film = ba.Layer(material_A, 30*nm)
substrate_layer = ba.Layer(material_substrate)
# Sample
sample = ba.MultiLayer()
sample.addLayer(ambient_layer)
sample.addLayer(film)
sample.addLayer(substrate_layer)
return sample
def get_simulation(sample):
"Specular simulation with a qz-defined beam"
n = 500
qzs = np.linspace(0.01, 1, n) # qz-values
scan = ba.QzScan(qzs)
return ba.SpecularSimulation(scan, sample)
if __name__ == '__main__':
sample = get_sample()
simulation = get_simulation(sample)
result = simulation.simulate()
bp.plot_simulation_result(result)
#!/usr/bin/env python3
"""
Depth profile of an opaque sample.
"""
import bornagain as ba
from bornagain import angstrom, ba_plot as bp, deg, nm
# beam data
ai_min = 0 # minimum incident angle
ai_max = 1*deg # maximum incident angle
wl = 0.03*nm # wavelength in angstroms
# depth position span
z_min = -400*nm
z_max = 100*nm
def get_sample():
# Define materials
material_vac = ba.RefractiveMaterial("Vac", 0, 0)
material_A = ba.RefractiveMaterial("A", 1e-5, 3e-6)
# Define layers
layer_top = ba.Layer(material_vac)
layer_1 = ba.Layer(material_A, 300*nm)
layer_bot = ba.Layer(material_vac)
# Define sample
sample = ba.MultiLayer()
sample.addLayer(layer_top)
sample.addLayer(layer_1)
sample.addLayer(layer_bot)
return sample
def get_simulation(sample):
"""
Returns a depth-probe simulation.
"""
nz = bp.simargs['n']
na = 10*nz
scan = ba.AlphaScan(na, ai_min, ai_max)
scan.setWavelength(wl)
footprint = ba.FootprintSquare(0.01)
scan.setFootprint(footprint)
z_axis = ba.FixedBinAxis("z", nz, z_min, z_max)
simulation = ba.DepthprobeSimulation(scan, sample, z_axis)
return simulation
if __name__ == '__main__':
bp.parse_args(sim_n=500, aspect='auto', intensity_max=1, intensity_min=1e-200)
sample = get_sample()
simulation = get_simulation(sample)
result = simulation.simulate()
bp.plot_simulation_result(result)
#!/usr/bin/env python3
"""
"""
import numpy as np
import bornagain as ba
from bornagain import ba_plot as bp, nm
def get_sample():
# Materials
material_A = ba.MaterialBySLD("A", 5e-06, 0)
material_substrate = ba.MaterialBySLD("Substrate", 2e-06, 0)
# Layers
ambient_layer = ba.Layer(ba.Vacuum())
film = ba.Layer(material_A, 30*nm)
substrate_layer = ba.Layer(material_substrate)
# Sample
sample = ba.MultiLayer()
sample.addLayer(ambient_layer)
sample.addLayer(film)
sample.addLayer(substrate_layer)
return sample
def get_simulation(sample):
"Specular simulation with a qz-defined beam"
n = 50
qzs = np.linspace(0.01, 1, n) # qz-values
scan = ba.QzScan(qzs)
return ba.SpecularSimulation(scan, sample)
if __name__ == '__main__':
sample = get_sample()
simulation = get_simulation(sample)
result = simulation.simulate()
bp.plot_simulation_result(result)
#!/usr/bin/env python3
"""
Depth profile of an opaque sample.
"""
import bornagain as ba
from bornagain import angstrom, ba_plot as bp, deg, nm
# beam data
ai_min = 0 # minimum incident angle
ai_max = 1*deg # maximum incident angle
wl = 0.03*nm # wavelength in angstroms
# depth position span
z_min = -400*nm
z_max = 100*nm
def get_sample():
# Define materials
material_vac = ba.RefractiveMaterial("Vac", 0, 0)
material_A = ba.RefractiveMaterial("A", 1e-5, 3e-6)
# Define layers
layer_top = ba.Layer(material_vac)
layer_1 = ba.Layer(material_A, 300*nm)
layer_bot = ba.Layer(material_vac)
# Define sample
sample = ba.MultiLayer()
sample.addLayer(layer_top)
sample.addLayer(layer_1)
sample.addLayer(layer_bot)
return sample
def get_simulation(sample):
"""
Returns a depth-probe simulation.
"""
nz = bp.simargs['n']
na = 10*nz
scan = ba.AlphaScan(na, ai_min, ai_max)
scan.setWavelength(wl)
footprint = ba.FootprintSquare(0.01)
scan.setFootprint(footprint)
z_axis = ba.FixedBinAxis("z", nz, z_min, z_max)
simulation = ba.DepthprobeSimulation(scan, sample, z_axis)
return simulation
if __name__ == '__main__':
bp.parse_args(sim_n=500, aspect='auto', intensity_max=1, intensity_min=1e-200)
sample = get_sample()
simulation = get_simulation(sample)
result = simulation.simulate()
bp.plot_simulation_result(result)
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