|
| void | handleCellChanged (int row, int column) |
| | Slot called when a table cell value changes.
|
| |
| void | checkSpecific () |
| | Slot that allows selection of parameters by name template.
|
| |
| void | checkAll () |
| | Slot that selects all non-fixed parameters.
|
| |
| void | unCheckAll () |
| | Slot that deselects all parameters.
|
| |
| void | modifyAuto () |
| | Slot that applies automatic step modification to all non-fixed parameters.
|
| |
| void | modifyChecked () |
| | Slot that opens the PModSelect dialog for checked parameters.
|
| |
| void | saveAndQuit () |
| | Slot that saves the modified msr-file and closes the dialog.
|
| |
| void | handleModSelect (bool automatic, double factor, bool absVal) |
| | Slot that handles the selection made in the PModSelect dialog.
|
| |
|
| void | initParam (PParam ¶m) |
| | Initializes a PParam structure with empty strings.
|
| |
| double | lookupTable (const QString str, bool &absVal) |
| | Determines the appropriate step size factor based on parameter name.
|
| |
| QString | adoptStep (const QString str, double factor, bool absVal) |
| | Calculates the new step value based on the current value and factor.
|
| |
| int | readMsrFile () |
| | Reads and parses the FITPARAMETER block from the msr-file.
|
| |
| int | writeMsrFile () |
| | Writes the modified parameters back to the msr-file.
|
| |
| QString | getLine (QByteArray &data, int &idx) |
| | Extracts a single line from a byte array.
|
| |
| QString | updateParamLine (const QString str) |
| | Reconstructs a parameter line with updated values.
|
| |
|
| QString | fMsrFileName |
| | Path to the currently open msr-file.
|
| |
| bool | fValid |
| | Flag indicating successful initialization.
|
| |
| QVector< PParam > | fParamVec |
| | Vector storing all fit parameters.
|
| |
| std::unique_ptr< QLabel > | fTitleLabel |
| | Label displaying the file name.
|
| |
| std::unique_ptr< QTableWidget > | fParamTable |
| | Table widget for parameter display.
|
| |
| std::unique_ptr< QPushButton > | fCheckSpecific |
| | Button to select by template.
|
| |
| std::unique_ptr< QPushButton > | fCheckAll |
| | Button to select all parameters.
|
| |
| std::unique_ptr< QPushButton > | fUnCheckAll |
| | Button to deselect all parameters.
|
| |
| std::unique_ptr< QPushButton > | fModifyAuto |
| | Button for automatic modification.
|
| |
| std::unique_ptr< QPushButton > | fModifySelected |
| | Button to modify selected parameters.
|
| |
| std::unique_ptr< QPushButton > | fSave |
| | Button to save and quit.
|
| |
| std::unique_ptr< QPushButton > | fCancel |
| | Button to cancel without saving.
|
| |
| PModSelect * | fModSelect |
| | Pointer to the modification options dialog.
|
| |
Main dialog class for the musrStep application.
This class implements the main user interface for viewing and modifying fit parameter step sizes in muSR msr-files. It provides:
- A table view displaying all fit parameters with their values and step sizes
- Selection mechanisms for choosing which parameters to modify
- Automatic and manual step size adjustment options
- File I/O for reading and writing msr-files
The automatic step size adjustment uses a lookup table based on common muSR parameter naming conventions to determine appropriate step sizes.
- See also
- PModSelect for the modification options dialog
-
PParam for the parameter data structure
| PMusrStep::PMusrStep |
( |
const char * | fln, |
|
|
QWidget * | parent = Q_NULLPTR ) |
Constructor for PMusrStep dialog.
Constructor for the PMusrStep main dialog.
Initializes the dialog, reads the msr-file, and populates the parameter table. Sets up all UI elements and signal/slot connections.
- Parameters
-
| fln | Path to the msr-file to open |
| parent | Pointer to the parent widget (default: Q_NULLPTR) |
Initializes the dialog with the following operations:
- Sets up the window title and icon based on the current theme
- Reads and parses the msr-file to extract fit parameters
- Creates the parameter table with columns for name, value, and step
- Sets up selection buttons (Check Specific, Check All, Uncheck All)
- Sets up modification buttons (Modify Automatic, Modify Selected)
- Sets up action buttons (Save&Quit, Cancel)
- Creates the PModSelect sub-dialog for detailed modification options
The dialog height is automatically adjusted based on the number of parameters, with a maximum limit based on screen resolution.
- Parameters
-
| fln | Path to the msr-file to open and edit |
| parent | Pointer to the parent widget (default: Q_NULLPTR) |
| void PMusrStep::checkAll |
( |
| ) |
|
|
privateslot |
Slot that selects all non-fixed parameters.
Selects all non-fixed parameters in the table.
Checks all parameters except those with step == 0.
Iterates through all rows and checks parameters whose step value is not "0" or "0.0" (fixed parameters remain unchecked).
| void PMusrStep::checkSpecific |
( |
| ) |
|
|
privateslot |
Slot that allows selection of parameters by name template.
Allows selection of parameters matching a template string.
Opens an input dialog for the user to enter a template string. All parameters whose names contain the template are selected.
Opens an input dialog where the user can enter a template string. All parameters whose names contain this template (case-sensitive) are then checked, except for fixed parameters (step == 0 or "0.0").
| void PMusrStep::handleCellChanged |
( |
int | row, |
|
|
int | column ) |
|
privateslot |
Slot called when a table cell value changes.
Handles changes to cells in the parameter table.
Validates changes to step values and prevents selection of fixed parameters (step == 0).
- Parameters
-
| row | The row index of the changed cell |
| column | The column index of the changed cell |
Performs validation when table cells are modified:
- Column 0 (name): Prevents selection of fixed parameters (step == 0)
- Column 2 (step): Validates that entered values are valid numbers
If an invalid step value is entered, the cell is restored to its previous value from fParamVec.
- Parameters
-
| row | The row index of the changed cell |
| column | The column index of the changed cell |
| void PMusrStep::handleModSelect |
( |
bool | automatic, |
|
|
double | factor, |
|
|
bool | absVal ) |
|
privateslot |
Slot that handles the selection made in the PModSelect dialog.
Processes the scaling selection from the PModSelect dialog.
Applies the specified scaling operation to all checked parameters.
- Parameters
-
| automatic | If true, use automatic scaling based on parameter names |
| factor | The scaling factor to apply |
| absVal | If true, factor is used as absolute value; if false, as multiplier |
Applies the specified scaling operation to all checked parameters. If automatic mode is selected, the factor is determined by lookupTable() for each parameter individually.
- Parameters
-
| automatic | If true, use automatic scaling based on parameter names |
| factor | The scaling factor (used when automatic is false) |
| absVal | If true, factor is used as absolute value; if false, as multiplier |
| void PMusrStep::modifyAuto |
( |
| ) |
|
|
privateslot |
Slot that applies automatic step modification to all non-fixed parameters.
Applies automatic step size modification to all non-fixed parameters.
Uses the lookupTable() function to determine appropriate step sizes based on parameter naming conventions.
Iterates through all parameters and applies automatic scaling using lookupTable() and adoptStep(). Fixed parameters (step == 0) are skipped. Both the table display and the internal fParamVec are updated.
| int PMusrStep::readMsrFile |
( |
| ) |
|
|
private |
Reads and parses the FITPARAMETER block from the msr-file.
Populates fParamVec with all parameters found between FITPARAMETER and THEORY blocks.
- Returns
- 1 on success, -1 if file cannot be opened, -2 on parse error
Opens the msr-file specified in fMsrFileName and extracts all parameters from the FITPARAMETER block (between FITPARAMETER and THEORY keywords). Each parameter line must have either 5 or 7 space-separated fields:
- 5 fields: number, name, value, step, posErr
- 7 fields: above plus boundLow, boundHigh
Comment lines (starting with #) and empty lines are ignored.
- Returns
- 1 on success
-
-1 if file cannot be opened
-
-2 if a parameter line has invalid format
| QString PMusrStep::updateParamLine |
( |
const QString | str | ) |
|
|
private |
Reconstructs a parameter line with updated values.
Formats the parameter line with proper field widths for msr-file compatibility.
- Parameters
-
| str | The original parameter line |
- Returns
- The updated parameter line, or empty string if not a parameter line
Searches fParamVec for a parameter matching the given line, then formats a new parameter line with proper field widths:
- Column 1 (10 chars, right-aligned): parameter number
- Column 2 (12+ chars, left-aligned): parameter name
- Columns 3-5 (11 chars each): value, step, posErr
- Columns 6-7 (11 chars each, optional): boundLow, boundHigh
The parameter is identified by finding its name sandwiched between spaces in the input string to avoid partial matches.
- Parameters
-
| str | The original parameter line to update |
- Returns
- The reconstructed parameter line, or empty string if no match found
| int PMusrStep::writeMsrFile |
( |
| ) |
|
|
private |
Writes the modified parameters back to the msr-file.
Preserves all non-parameter content and updates only the FITPARAMETER block with new step values.
- Returns
- 1 on success, -1 if input file cannot be opened, -2 if output file cannot be opened
Reads the entire original msr-file, then rewrites it with updated step values in the FITPARAMETER block. All other content is preserved unchanged. A "*** FIT DID NOT CONVERGE ***" marker is appended to indicate the file has been modified.
- Returns
- 1 on success
-
-1 if input file cannot be opened for reading
-
-2 if output file cannot be opened for writing