Plot Helper

Some helper functions for easy plotting.

class PlotHelper

Public Functions

inline PlotHelper(std::shared_ptr<AngleCalibration> anglecalibration)

constructor for PlotHelper class

Parameters:

anglecalibration

inline ~PlotHelper()
inline void overwrite_plot()

overwrite plot for plotting multiple frames in one figure

inline void reuse_plot()

reuse plot for plotting multiple frames in one figure without overwriting the previous one

inline void create_plot() const
inline void initialize_axis(const std::string &plot_title) const
inline void show_plot() const
inline void plot_diffraction_pattern(const NDView<double, 2> &photon_counts, std::optional<size_t> module_index = std::nullopt, std::optional<double> motor_position = std::nullopt) const

plot diffraction pattern for given photon counts

Parameters:
  • motor_position – The position of the motor for resulting diffraction pattern

  • photon_counts – resulting photon counts of diffraction pattern

  • module_index – optional module index for plotting only specific module region

inline void plot_base_peak(const NDView<double, 2> photon_counts, const std::optional<size_t> module_index = std::nullopt) const

plot base peak for given photon counts

Parameters:
  • photon_counts – resulting photon counts of diffraction pattern

  • module_index – optional module index if only one module contributed to diffraction pattern

Public Static Functions

static inline void pause()

pause the program until user input, e.g. before destroying all plots

Private Functions

inline size_t left_module_boundary_as_fixed_angle_bin_index(const size_t module_index, const double detector_angle) const
inline size_t right_module_boundary_as_fixed_angle_bin_index(const size_t module_index, const double detector_angle) const

Private Members

const std::shared_ptr<AngleCalibration> m_anglecalibration = {}

shared pointer to AngleCalibration class for accessing calibration specific parameters and functions

std::function<double(const size_t)> bin_to_diffraction_angle = {}

function to convert bin index to diffraction angle

std::function<double(const size_t)> bin_to_diffraction_angle_base_peak_ROI_only = {}

function to convert bin index to diffraction angle for base peak ROI only

bool m_overwrite_plot = false
bool m_reuse_plot = false
void angcal::select_base_peak(std::shared_ptr<AngleCalibration> anglecalibration, std::shared_ptr<MythenFileReader> mythen_file_reader, const std::vector<std::string> &filelist, const size_t module_index = 0)

select base peak by performing angular conversion for a specific module and clicking through frames where module is within range of [6°, 33°]

Parameters:
  • anglecalibration – shared pointer to AngleCalibration class for accessing calibration specific parameters and functions

  • mythen_file_reader – shared pointer to MythenFileReader for reading mythen acquisition files

  • filelist – vector of acquisition files to select base peak from

  • module_index – optional module index if only one module contributed to diffraction pattern, default is 0.