Commit 7cffc9b2 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

Merge branch 'ex2' into 'develop'

Examples; round parameters, etc

See merge request !10
parents 6a6a3f87 8cb37c04
Pipeline #33418 passed with stage
in 19 minutes and 17 seconds
......@@ -58,7 +58,7 @@ def get_sample():
ff = CustomFormFactor(20*nm, 15*nm)
particle = ba.Particle(m_particle, ff)
particle_layout = ba.ParticleLayout()
particle_layout.addParticle(particle, 1)
particle_layout.addParticle(particle)
vacuum_layer = ba.Layer(m_vacuum)
vacuum_layer.addLayout(particle_layout)
substrate_layer = ba.Layer(m_substrate)
......
......@@ -102,4 +102,4 @@ if __name__ == '__main__':
import ba_plot
sample = get_sample()
simulation = get_simulation(sample)
ba_plot.run_and_plot(simulation)
ba_plot.run_and_plot(simulation, aspect='auto')
......@@ -18,7 +18,7 @@ def get_sample(lattice_rotation_angle=0*deg):
"""
# defining materials
m_vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0)
m_si = ba.HomogeneousMaterial("Si", 5.78164736e-6, 1.02294578e-7)
m_si = ba.HomogeneousMaterial("Si", 5.7816e-6, 1.0229e-7)
box_length, box_width, box_height = 50*micrometer, 70*nm, 50*nm
lattice_length = 150*nm
......
File mode changed from 100644 to 100755
......@@ -18,7 +18,7 @@ def get_sample(lattice_rotation_angle=0*deg):
"""
# defining materials
m_vacuum = ba.HomogeneousMaterial("Vacuum", 0, 0)
m_si = ba.HomogeneousMaterial("Si", 5.78164736e-6, 1.02294578e-7)
m_si = ba.HomogeneousMaterial("Si", 5.7816e-6, 1.0229e-7)
box_length, box_width, box_height = 50*micrometer, 70*nm, 50*nm
lattice_length = 150*nm
......
......@@ -34,9 +34,8 @@ def get_sample():
# Define particle layouts
layout = ba.ParticleLayout()
layout.addParticle(particle, 1)
layout.addParticle(particle)
layout.setInterferenceFunction(iff)
layout.setWeight(1)
layout.setTotalParticleSurfaceDensity(0.01)
# Define layers
......
......@@ -17,24 +17,23 @@ default_cylinder_height = 20*nm
def get_sample(cylinder_radius, cylinder_height):
"""
Returns a sample with cylindrical particles on a substrate.
"""
# defining materials
# Define materials
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
# Define particle layout
cylinder_ff = ba.FormFactorCylinder(cylinder_radius, cylinder_height)
cylinder = ba.Particle(m_particle, cylinder_ff)
particle_layout = ba.ParticleLayout()
particle_layout.addParticle(cylinder, 1)
particle_layout.addParticle(cylinder)
# Define layers
vacuum_layer = ba.Layer(m_vacuum)
vacuum_layer.addLayout(particle_layout)
substrate_layer = ba.Layer(m_substrate)
# Define sample
multi_layer = ba.MultiLayer()
multi_layer.addLayer(vacuum_layer)
multi_layer.addLayer(substrate_layer)
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -31,14 +31,13 @@ def get_sample():
# Define interference functions
iff = ba.InterferenceFunction1DLattice(100*nm, 0)
iff_pdf = ba.FTDecayFunction1DCauchy(1000000*nm)
iff_pdf = ba.FTDecayFunction1DCauchy(1e6*nm)
iff.setDecayFunction(iff_pdf)
# Define particle layouts
layout = ba.ParticleLayout()
layout.addParticle(particle, 1)
layout.addParticle(particle)
layout.setInterferenceFunction(iff)
layout.setWeight(1)
layout.setTotalParticleSurfaceDensity(0.01)
# Define layers
......
......@@ -8,7 +8,7 @@ import matplotlib.pyplot as plt
import bornagain as ba
from bornagain import angstrom, deg, nm, nm2, kvector_t
from math import sqrt
def get_sample():
"""
......@@ -17,7 +17,8 @@ def get_sample():
# Define materials
material_Ambient = ba.MaterialBySLD("Ambient", 0, 0)
magnetic_field = kvector_t(50000000, 86602540.3784, 0)
h = 1e8
magnetic_field = kvector_t(1/2*h, sqrt(3)/2*h, 0)
material_Layer = ba.MaterialBySLD("Layer", 0.0001, 1e-08,
magnetic_field)
material_Substrate = ba.MaterialBySLD("Substrate", 7e-05, 2e-06)
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -7,7 +7,7 @@ import numpy
import bornagain as ba
from bornagain import angstrom, deg, nm, nm2, kvector_t
import matplotlib.pyplot as plt
from math import sqrt
def get_sample():
"""
......@@ -16,7 +16,8 @@ def get_sample():
# Define materials
material_Ambient = ba.MaterialBySLD("Ambient", 0, 0)
magnetic_field = kvector_t(50000000, 86602540.3784, 0)
h = 1e8
magnetic_field = kvector_t(1/2*h, sqrt(3)/2*h, 0)
material_Layer = ba.MaterialBySLD("Layer", 0.0001, 1e-08,
magnetic_field)
material_Substrate = ba.MaterialBySLD("Substrate", 7e-05, 2e-06)
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -13,7 +13,7 @@
# ************************************************************************** #
import bornagain as ba
import ba_plot
import ba_plot as bp
try: # workaround for build servers
import numpy as np
from matplotlib import pyplot as plt
......@@ -85,10 +85,10 @@ class PlotterGISAS(Plotter):
zmax = np.amax(arr) if self._zmax is None else self._zmax
zmin = zmax*1e-6 if self._zmin is None else self._zmin
ba.plot_colormap(real_data,
bp.plot_colormap(real_data,
title="Experimental data",
zmin=zmin,
zmax=zmax,
intensity_min=zmin,
intensity_max=zmax,
units=self._units,
xlabel=self._xlabel,
ylabel=self._ylabel,
......@@ -96,10 +96,10 @@ class PlotterGISAS(Plotter):
aspect=self._aspect)
self.make_subplot(2)
ba.plot_colormap(sim_data,
bp.plot_colormap(sim_data,
title="Simulated data",
zmin=zmin,
zmax=zmax,
intensity_min=zmin,
intensity_max=zmax,
units=self._units,
xlabel=self._xlabel,
ylabel=self._ylabel,
......@@ -107,10 +107,10 @@ class PlotterGISAS(Plotter):
aspect=self._aspect)
self.make_subplot(3)
ba.plot_colormap(diff,
bp.plot_colormap(diff,
title="Difference",
zmin=zmin,
zmax=zmax,
intensity_min=zmin,
intensity_max=zmax,
units=self._units,
xlabel=self._xlabel,
ylabel=self._ylabel,
......
......@@ -107,6 +107,7 @@ def plot_array(array, axes_limits=None, **kwargs):
title = kwargs.pop('title', None)
aspect = kwargs.pop('aspect', 'equal')
cmap = kwargs.pop('cmap', CMAP)
withCBar = kwargs.pop('with_cb', True)
im = plt.imshow(array,
cmap=cmap,
......@@ -114,7 +115,8 @@ def plot_array(array, axes_limits=None, **kwargs):
aspect=aspect,
extent=axes_limits,
**kwargs)
cb = plt.colorbar(im, pad=0.025)
if withCBar:
cb = plt.colorbar(im, pad=0.025)
if xlabel:
plt.xlabel(xlabel, fontsize=label_fontsize)
......@@ -126,6 +128,8 @@ def plot_array(array, axes_limits=None, **kwargs):
if title:
plt.title(title)
return im
def plot_histogram(hist, **kwargs):
"""
......@@ -172,7 +176,7 @@ def plot_colormap(result, **kwargs):
if not 'ylabel' in kwargs:
kwargs['ylabel'] = axes_labels[1]
plot_array(result.array(), axes_limits=axes_limits, **kwargs)
return plot_array(result.array(), axes_limits=axes_limits, **kwargs)
def plot_specular_simulation_result(result, **kwargs):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment