AngularConversion

Class to perform angular conversion. As conversion parameters it expects the “historic detector group” DG parameters. See Different Parameter Sets for a more detailed description of the different detector parameters.

class AngularConversion

Public Functions

inline AngularConversion(std::shared_ptr<MythenDetector> mythen_detector_)
inline AngularConversion(std::shared_ptr<MythenDetector> mythen_detector_, double histogram_bin_width_, std::tuple<double, double> angular_range_)
std::pair<double, double> photon_count_correction(double photon_counts, const double exposure_time, const uint64_t I0, const size_t global_strip_index) const

calculate the corrected photon counts (flatfield, rate, incident intensity)

Parameters:
  • photon_counts – photon counts

  • global_strip_index – strip index of photon counts

  • I0 – incident intensity

  • exposure_time – exposure time of acquisition [s]

Returns:

pair {corrected photon counts, propagated_error}

void process_photon_counts(const size_t module_index, const NDView<uint32_t, 1> frame, const double detector_angle, const double exposure_time, const uint64_t incident_intensity, NDView<double, 2> weighted_moments, NDView<size_t, 1> num_contributing_photons)

correct and redistributes photon counts around designated region to fixed angle width bins

Parameters:
  • module_index – index of module

  • frame – data from acquisition (storing detector position and photon counts)

  • detector_angle – detector axis motor position [degrees]

  • exposure_time – exposure time [seconds]

  • incident_intensity – incident intensity [photons/second]

  • weighted_moments – accumulated weighted photon counts of order 0-2 per fixed angle width bin

  • num_contributing_photons – accumulated number of photons contributing to each fixed angle width bin

~AngularConversion() = default
NDArray<double, 2> convert(const NDView<uint32_t, 2> photon_counts, const NDView<double, 1> detector_angles, const NDView<uint64_t, 1> incident_intensities, const double exposure_time)

convert frames of photon counts to a diffraction pattern

Note

the photon counts are corrected for flatfield, rate and incident intensity and solid angle, redistributed to fixed angle width bins and averaged

Parameters:
  • photon_counts – photon counts of each frame (num_frames, num_strips)

  • detector_angles – detector angle of each frame [degrees]

  • incident_intensities – incident intensity of each frame

  • exposure_time – exposure time of the frames [s]

Returns:

returns resulting diffraction pattern given in the range [min_angle, max_angle] (values of -1.0 denote bins with insufficient coverage or which are denoted by a bad channel) (first dimension corresponds to redistributed photon counts, second dimension corresponds to std of redistributed photon counts)

NDArray<double, 2> convert(const NDView<uint32_t, 1> photon_counts, const double detector_angle, const uint64_t incident_intensity, const double exposure_time)
ssize_t num_fixed_angle_width_bins() const
inline double get_histogram_bin_width() const
inline double get_scale_factor() const
inline void set_scale_factor(const double scale_factor_)
inline std::tuple<double, double> get_angular_range() const
inline void set_FlatField(NDView<const double, 2> flatfield_)
inline NDView<double, 2> get_FlatField()
inline void set_bad_channels(const NDView<bool, 1> bad_channels_)
inline NDView<bool, 1> get_bad_channels()

Private Functions

NDArray<double, 2> computeErrorandMean(const NDView<double, 2> weighted_moments, const NDView<size_t, 1> num_contributing_photons) const

Private Members

std::shared_ptr<MythenDetector> m_mythen_detector
double histogram_bin_width = 0.0036

bin width of fixed angle bin histogram [degrees]

double m_min_angle = -180.0

minimum angle for angular conversion [degrees]

double m_max_angle = 180.0

maximum angle for angular conversion [degrees]

double m_scale_factor = {1.0}

scale factor to scale everything to a reasonable scale e.g. can be incident_intensity of first acquisition (default: 1.0)

NDArray<double, 2> flatfield = {}

flatfield correction for each strip

NDArray<bool, 1> bad_channels = {}