Plot Helper¶
Some helper functions for easy plotting.
-
class PlotHelper¶
Public Functions
constructor for PlotHelper class
- Parameters:
mythen_detector – shared pointer to MythenDetector holding the detector geometry parameters
angular_range – angular range {min_angle, max_angle} of the diffraction pattern [degrees]
histogram_bin_width – width of the fixed angle width bins [degrees]
-
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 double base_peak_angle, const double base_peak_roi_width, 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
base_peak_angle – angle of the base peak [degrees]
base_peak_roi_width – width of the region of interest around the base peak [degrees]
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<MythenDetector> m_mythen_detector = {}¶
shared pointer to detector geometry of m_anglecalibration for calculating diffraction angles
-
const std::tuple<double, double> m_angular_range = {}¶
angular range of diffraction pattern [degrees]
-
const double m_histogram_bin_width = {}¶
histogram bin width [degrees]
-
std::function<double(const size_t)> bin_to_diffraction_angle = {}¶
function to convert bin index to diffraction angle
-
bool m_overwrite_plot = false¶
-
bool m_reuse_plot = false¶
select base peak by performing angular conversion for a specific module and clicking through frames where module is within range of [6°, 33°]
- Parameters:
mythen_detector_ptr – shared pointer to MythenDetector holding the detector geometry parameters
angularconversion – shared pointer to AngularConversion class for accessing the angular range and histogram bin width
mythen_file_reader – reference to EpicsMythenFileReader for reading mythen acquisition files
module_index – optional module index if only one module contributed to diffraction pattern, default is 0.