improve the doxygen docu of PGetFourierBlockDialog.* (musredit_qt6).

This commit is contained in:
2025-11-24 12:25:29 +01:00
parent 06ccceb810
commit 8b42254cbb
2 changed files with 147 additions and 10 deletions

View File

@@ -27,6 +27,20 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
/**
* @file PGetFourierBlockDialog.cpp
* @brief Implementation of the PGetFourierBlockDialog class.
* @details This file implements the dialog for creating FOURIER blocks in msr
* files. It handles user input validation (especially for the phase parameter)
* and generates properly formatted msr-file text for all Fourier transform
* parameters.
*
* @author Andreas Suter
* @date 2009-2025
* @copyright Copyright (C) 2009-2025 by Andreas Suter
* @license GNU General Public License v2 or later
*/
#include <QObject>
#include <QComboBox>
#include <QValidator>
@@ -40,9 +54,20 @@
//----------------------------------------------------------------------------------------------------
/**
* <p>Constructor
* @brief Constructs the FOURIER block dialog.
*
* \param helpUrl help url address for the Fourier block.
* @details Initializes the dialog UI and sets up input validators for all
* numeric fields. The dialog is created as modal.
*
* @par Input Validators:
* - Integer validators: Fourier power (zero-padding exponent)
* - Double validators: Phase correction range (low/high), frequency range (low/high)
*
* @par Signal Connections:
* The phase parameter input is connected to validation on focus loss to ensure
* proper format (integer or parXX).
*
* @param helpUrl URL to the online documentation for FOURIER blocks.
*/
PGetFourierBlockDialog::PGetFourierBlockDialog(const QString helpUrl) : fHelpUrl(helpUrl)
{
@@ -62,7 +87,19 @@ PGetFourierBlockDialog::PGetFourierBlockDialog(const QString helpUrl) : fHelpUrl
//----------------------------------------------------------------------------------------------------
/**
* <p>Checks if the phase parameter is either a number are has the form parXX, where XX is a number.
* @brief Validates the phase parameter input.
*
* @details Checks if the phase parameter is either a plain integer number or
* has the format "parXX" where XX is a parameter number referencing a fit
* parameter from the FITPARAMETER block.
*
* @par Validation Rules:
* - Empty input is allowed (phase parameter will be omitted)
* - Plain integer values are accepted (e.g., "45", "90")
* - Parameter references must follow the format "parXX" (e.g., "par3", "par12")
*
* If validation fails, the input is cleared and an error dialog is shown,
* returning focus to the phase input field for correction.
*/
void PGetFourierBlockDialog::checkPhaseParameter()
{
@@ -99,7 +136,29 @@ void PGetFourierBlockDialog::checkPhaseParameter()
//----------------------------------------------------------------------------------------------------
/**
* <p>Transfers the data of the dialog into a valid msr-file Fourier block string.
* @brief Generates the FOURIER block string from dialog inputs.
*
* @details Transfers the data from all dialog widgets into a valid msr-file
* FOURIER block string. The method collects:
* - Required parameters: units, apodization, plot type
* - Optional parameters: fourier_power, phase, range_for_phase_correction, range
*
* Optional parameters are only included if their corresponding input fields
* contain valid data. The generated block is stored in fFourierBlock for
* retrieval via getFourierBlock().
*
* @par Generated Block Structure:
* @code
* ###############################################################
* FOURIER
* units <Gauss|Tesla|MHz|Mc/s>
* fourier_power <n> (optional)
* apodization <none|weak|medium|strong>
* plot <real|imag|real_and_imag|power|phase>
* phase <value|parXX> (optional)
* range_for_phase_correction <low> <high> (optional)
* range <low> <high> (optional)
* @endcode
*/
void PGetFourierBlockDialog::fillFourierBlock()
{
@@ -125,7 +184,11 @@ void PGetFourierBlockDialog::fillFourierBlock()
//----------------------------------------------------------------------------------------------------
/**
* <p>Generates a help content window showing the description of the Fourier block.
* @brief Opens the online help documentation for FOURIER blocks.
*
* @details Attempts to open the help URL in the system's default web browser
* using QDesktopServices. If the URL is empty, displays an informational message.
* If the browser fails to open, displays an error message with a clickable link.
*/
void PGetFourierBlockDialog::helpContent()
{

View File

@@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2016 by Andreas Suter *
* Copyright (C) 2009-2025 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -27,6 +27,23 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
/**
* @file PGetFourierBlockDialog.h
* @brief Dialog for creating FOURIER blocks in msr files.
* @details This header defines the PGetFourierBlockDialog class which provides
* a dialog for entering Fourier transform parameters needed to create a FOURIER
* block in a musrfit msr file. Fourier analysis is used to transform time-domain
* muon spin rotation data into the frequency domain.
*
* @author Andreas Suter
* @date 2009-2025
* @copyright Copyright (C) 2009-2025 by Andreas Suter
* @license GNU General Public License v2 or later
*
* @see PGetPlotBlockDialog For plot block creation
* @see PGetAsymmetryRunBlockDialog For asymmetry RUN block creation
*/
#ifndef _PGETFOURIERBLOCKDIALOG_H_
#define _PGETFOURIERBLOCKDIALOG_H_
@@ -34,9 +51,46 @@
#include "ui_PGetFourierBlockDialog.h"
//-------------------------------------------------------------------------------
//---------------------------------------------------------------------------
/**
* <p>Handles the Fourier dialog.
* @class PGetFourierBlockDialog
* @brief Dialog for creating FOURIER blocks in msr files.
*
* @details This dialog collects all parameters needed to generate a FOURIER
* block for muon spin rotation data analysis. The Fourier transform converts
* time-domain asymmetry data into the frequency domain, revealing oscillation
* frequencies corresponding to internal magnetic fields.
*
* @par Fourier Block Parameters:
* - Units: Gauss, Tesla, MHz, or Mc/s (megacycles per second)
* - Fourier power: Zero-padding power for FFT (2^n points)
* - Apodization: Window function (none, weak, medium, strong)
* - Plot type: real, imag, real_and_imag, power, or phase
* - Phase: Initial phase value or parameter reference (parXX)
* - Phase correction range: Frequency range for phase optimization
* - Range: Frequency range for display
*
* @par Generated Output Format:
* The dialog generates msr-file formatted text blocks such as:
* @code
* ###############################################################
* FOURIER
* units Gauss
* fourier_power 10
* apodization strong
* plot power
* phase par3
* range_for_phase_correction 50 80
* range 0 500
* @endcode
*
* @par Phase Parameter Formats:
* The phase can be specified in two ways:
* - Direct value: An integer representing an initial phase angle
* - Parameter reference: "parXX" where XX is a fit parameter number
* that will be used as the phase during fitting
*
* @see PGetPlotBlockDialog For creating PLOT blocks
*/
class PGetFourierBlockDialog : public QDialog, private Ui::PGetFourierBlockDialog
{
@@ -45,16 +99,36 @@ class PGetFourierBlockDialog : public QDialog, private Ui::PGetFourierBlockDialo
public:
PGetFourierBlockDialog(const QString helpUrl);
/**
* @brief Returns the generated FOURIER block string.
* @return Formatted msr-file FOURIER block string ready for insertion
* into an msr file.
*/
QString getFourierBlock() { return fFourierBlock; }
private slots:
/**
* @brief Validates the phase parameter input.
* @details Checks that the phase entry is either a plain integer or
* follows the "parXX" format where XX is a parameter number.
*/
void checkPhaseParameter();
/**
* @brief Builds the FOURIER block string from dialog inputs.
* @details Collects all user-entered values and formats them into
* a valid msr-file FOURIER block.
*/
void fillFourierBlock();
/**
* @brief Opens the online help for FOURIER blocks.
*/
void helpContent();
private:
QString fFourierBlock; ///< keeps the msr Fourier block
QString fHelpUrl; ///< help url for the Fourier block
QString fFourierBlock; ///< Generated msr-file FOURIER block string.
QString fHelpUrl; ///< URL to the online documentation for FOURIER blocks.
};
#endif // _PGETFOURIERBLOCKDIALOG_H_