#!/usr/bin/env python3
"""
DWBA simulation of a GISAS experiment, including the specular peak.
Based on Cylinders.py.
"""
import bornagain as ba
from bornagain import ba_plot as bp, deg, nm


def get_sample():
    """
    Standard sample model: dilute random assembly of cylinders on a substrate.
    """
    from bornagain import std_samples
    return std_samples.cylinders()


def get_simulation(sample):
    # Beam
    wavelength = 0.1*nm
    alpha_i = 0.2*deg
    beam = ba.Beam(1e9, wavelength, alpha_i)

    # Detector
    n = <%= test_mode ? 11 : 200 %>
    detector = ba.SphericalDetector(n, -2*deg, 2*deg, n, 0., 3*deg)

    simulation = ba.ScatteringSimulation(beam, sample, detector)
    simulation.options().setIncludeSpecular(True)
    return simulation


<%= include_partial("template/main/runsim_unitaspect.py",
    "ba.showSample3D(sample, sample_size=120*nm, seed=0)") -%>
