RectangularDetector replacement after release 22.0
Dear BornAgain team,
thanks for providing this excellent contribution to the GISAXS community, I have worked with BornAgain using python scripts for a while now.
Release 22.0 has seemingly removed support for RectangularDetector (or FlatDetector) and I cannot find any obvious replacement to calculate the scattering for flat detectors in the documentation. Will there be a replacement any time soon or does a workaround (except for expensive oversampling and rebinning) for flat panel detectors exist?
Edit: TL;DR: SphericalDetector is actually calculated as a flat panel detector.
Here is a code snippet that I am using to convert the old RectangularDetector definition to the SphericalDetector one:
import numpy as np
import bornagain as ba
ba_config = {'NbinsX': 119, 'Width': 122.808,
'NbinsY': 82, 'Height': 141.04,
'wavelength': (12.39842 / 94.6) * 0.1,
'Distance': 6508.0,
'v0(vertBeamPos)': -0.516, 'u0(horizontBeamPos)': 65.877,
'alpha_i' : np.deg2rad(0.09)}
phi_min = np.arctan(-ba_config['u0(horizontBeamPos)'] / ba_config['Distance']) # there is a small error here, which increases with alpha_i
phi_max = np.arctan((ba_config['Width'] - ba_config['u0(horizontBeamPos)']) / ba_config['Distance'])
alpha_min_p = np.arctan(-ba_config['v0(vertBeamPos)'] / ba_config['Distance'])
alpha_max_p = np.arctan((ba_config['Height'] - ba_config['v0(vertBeamPos)']) / ba_config['Distance'])
alpha_min = np.arcsin( np.cos(alpha_i)*np.sin(alpha_min_p) - np.sin(alpha_i)*np.cos(alpha_min_p) ) # convert angles from primary beam reference frame to surface reference frame
alpha_max = np.arcsin( np.cos(alpha_i)*np.sin(alpha_max_p) - np.sin(alpha_i)*np.cos(alpha_max_p) )
detector = ba.SphericalDetector(int(ba_config['NbinsX']) , phi_min, phi_max, int(ba_config['NbinsY']), alpha_min, alpha_max)
Thanks, Timo Fuchs
Edited by Timo Fuchs