diff --git a/src/external/MuSRFitGUI/MuSRFit4.pm b/src/external/MuSRFitGUI/MuSRFit4.pm index fc614e85..2bb46742 100644 --- a/src/external/MuSRFitGUI/MuSRFit4.pm +++ b/src/external/MuSRFitGUI/MuSRFit4.pm @@ -34,7 +34,7 @@ use QtCore4::slots GoFit => [], GoPlot => [], ShowMuSRT0 => [], - T0Update => [], + t0Update => [], RunSelectionToggle => [], fileBrowse => [], AppendToFunctions => [], @@ -89,12 +89,10 @@ sub fileSave() my %All=CreateAllInput(); my $FILENAME=$All{"FILENAME"}.".msr"; my $file=Qt::FileDialog::getSaveFileName( - "$FILENAME", - "MSR Files (*.msr *.mlog)", - this, - - "save file dialog", - "Choose a filename to save under"); + this, + "Save file", + "$FILENAME", + "MSR Files (*.msr *.mlog)"); # If the user gave a filename the copy to it if ($file ne "") { @@ -114,11 +112,10 @@ sub fileSave() sub fileChangeDir() { my $newdir=Qt::FileDialog::getExistingDirectory( - "", - this, - "get existing directory", - "Choose a directory", - 1); + this, + "Change work directory", + "./", + ""); chdir ("$newdir"); } @@ -140,16 +137,17 @@ sub fileExit() sub parametersExport() { +# Exports the fit parameters for a table format file +# This works only after a fit call, i.e. a plot call is not sufficient! my %All=CreateAllInput(); # Add also a flag for header $All{"Header"}=1; my $FILENAME=$All{"FILENAME"}.".dat"; my $file=Qt::FileDialog::getSaveFileName( - "$FILENAME", - "Data Files (*.dat)", - this, - "export file dialog", - "Choose a filename to export to"); + this, + "Export parameters to file", + "$FILENAME", + "Data Files (*.dat)"); # If the user gave a filename the copy to it if ($file ne "") { @@ -163,16 +161,17 @@ sub parametersExport() sub parametersAppend() { +# Appends the fit parameters for a table format file +# This works only after a fit call, i.e. a plot call is not sufficient! my %All=CreateAllInput(); # Add also a flag for header $All{"Header"}=0; my $FILENAME=$All{"FILENAME"}.".dat"; my $file=Qt::FileDialog::getOpenFileName( - "./", - "Data Files (*.dat)", - this, - "append file dialog", - "Choose a filename to append to"); + this, + "Append parameters to file", + "./", + "Data Files (*.dat)"); # If the user gave a filename the copy to it if ($file ne "") { @@ -228,25 +227,28 @@ sub helpContents() sub helpAbout() { my $AboutText=" - This is a GUI that uses the musrfit binary, developed by Andreas Suter, - to fit muSR spectra. +This is a GUI that uses the musrfit binary to fit +muSR spectra. + +MuSRFitGUI is free software: you can redistribute it +and/or modify it under the terms of the GNU General +Public License as published by the Free Software +Foundation, either version 3 of the License, or (at +your option) any later version. + +MuSRFitGUI is distributed in the hope that it will be +useful, but WITHOUT ANY WARRANTY; without even the +implied warranty of MERCHANTABILITY or FITNESS FOR A +PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public +License along with MuSRFitGUI. If not, see +. - MuSRFitGUI is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - MuSRFitGUI is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with MuSRFitGUI. If not, see . - - Copyright 2009 by Zaher Salman and the LEM Group. - - "; +Copyright 2009-2017 by Zaher Salman +. +"; my $AboutWindow = Qt::MessageBox::information( this, "About MuSRFit GUI",$AboutText); } @@ -471,7 +473,7 @@ sub CreateAllInput() my %PTable=MSR::PrepParamTable(\%All); # Setup the table with the right size - my $NParam=scalar keys( %PTable ); + my $NParam=keys( %PTable ); # Read initial values of paramets from tabel my $erradd = "d"; @@ -482,11 +484,12 @@ sub CreateAllInput() if ($NParam > 0) { # Set appropriate number of rows $QTable->setRowCount($NParam); - for (my $i=0;$i<$NParam;$i++) { -# Take label of row, i.e. name of parameter - if (defined($QTable->verticalHeaderItem($i)) && defined($QTable->item($i,1)) && defined($QTable->item($i,2)) && defined($QTable->item($i,3)) && defined($QTable->item($i,4))) { + for (my $i=0;$i<=$NParam;$i++) { + # Make sure the row items exist/defined + if (defined($QTable->verticalHeaderItem($i)) && defined($QTable->item($i,0)) && defined($QTable->item($i,1)) && defined($QTable->item($i,2)) && defined($QTable->item($i,3))) { + # Take label of row, i.e. name of parameter my $Param=$QTable->verticalHeaderItem($i)->text(); -# Then take the value, error, max and min (as numbers) + # Then take the value, error, max and min (as numbers) $All{"$Param"}=1.0*$QTable->item($i,0)->text(); $All{"$erradd$Param"}=1.0*$QTable->item($i,1)->text(); $All{"$Param$minadd"}=1.0*$QTable->item($i,2)->text(); @@ -773,15 +776,17 @@ sub InitializeTab() if ($error eq "nan") { $error=0.1;} # Make sure items exist before addressing them $QTable->setVerticalHeaderItem($PCount,Qt::TableWidgetItem()); - $QTable->verticalHeaderItem($PCount)->setText($Param); + # Make sure that the row exists $QTable->showRow($PCount); $QTable->setItem($PCount,0,Qt::TableWidgetItem()); - $QTable->item($PCount,0)->setText($value); $QTable->setItem($PCount,1,Qt::TableWidgetItem()); - $QTable->item($PCount,1)->setText($error); $QTable->setItem($PCount,2,Qt::TableWidgetItem()); - $QTable->item($PCount,2)->setText($minvalue); $QTable->setItem($PCount,3,Qt::TableWidgetItem()); + # Fill in the values... + $QTable->verticalHeaderItem($PCount)->setText($Param); + $QTable->item($PCount,0)->setText($value); + $QTable->item($PCount,1)->setText($error); + $QTable->item($PCount,2)->setText($minvalue); $QTable->item($PCount,3)->setText($maxvalue); } } @@ -870,8 +875,9 @@ sub GoPlot() sub ShowMuSRT0() { +# Open musrt0 to check and adjust t0 , Bg and Data bins my %All=CreateAllInput(); - this->{ui}->musrfit_tabs->setCurrentPage(6); + this->{ui}->musrfit_tabs->setCurrentIndex(6); # Create MSR file and then run musrt0 my $Answer=CallMSRCreate(); @@ -889,7 +895,7 @@ sub ShowMuSRT0() } -sub T0Update() +sub t0Update() { my %All = CreateAllInput(); my @Hists = split(/,/, $All{"LRBF"} ); @@ -900,11 +906,12 @@ sub T0Update() foreach ("t0","Bg1","Bg2","Data1","Data2") { my $Name = "$_$NHist"; my $tmp=MSR::T0BgData($_,$Hist,$All{"BeamLine"}); - child("Qt::Widget",$Name)->setText($tmp); + if (defined(child("Qt::Widget",$Name))) { + child("Qt::Widget",$Name)->setText($tmp); + } } $NHist++ - } - + } } @@ -958,14 +965,16 @@ sub AppendToFunctions() if (defined(this->{ui}->theoryBlock->toPlainText)) { $Full_T_Block=this->{ui}->theoryBlock->toPlainText; } - if (defined(this->{ui}->constraintLine->toPlainText)) { - $Constraint=this->{ui}->constraintLine->toPlainText; + if (defined(this->{ui}->constraintLine->text)) { + $Constraint=this->{ui}->constraintLine->text; } # Then clear the text this->{ui}->constraintLine->setText(""); # Check how many constraints (lines) in FUNCTIONS Block - my $i=this->{ui}->functionsBlock->lines(); +# my $i=this->{ui}->functionsBlock->blockCount(); + my $fun_lines=this->{ui}->functionsBlock->toPlainText(); + my $i= ($fun_lines =~ tr/\n//)+1; my $ConstLine="fun$i = $Constraint\n"; this->{ui}->functionsBlock->insertPlainText($ConstLine); diff --git a/src/external/MuSRFitGUI/MuSRFit4.ui b/src/external/MuSRFitGUI/MuSRFit4.ui index e65f78dc..d6b8805e 100644 --- a/src/external/MuSRFitGUI/MuSRFit4.ui +++ b/src/external/MuSRFitGUI/MuSRFit4.ui @@ -986,9 +986,6 @@ false - - fitType1 - @@ -1441,9 +1438,6 @@ false - - fitType1 - @@ -1896,9 +1890,6 @@ false - - fitType1 - @@ -2273,9 +2264,6 @@ false - - tis - @@ -2292,9 +2280,6 @@ false - - tfs - @@ -2311,9 +2296,6 @@ false - - bins - @@ -3149,9 +3131,6 @@ false - - title - @@ -3183,9 +3162,6 @@ false - - fileName - @@ -5572,16 +5548,16 @@ false - Overwrite MSR File + No Overwrite Overwrite MSR File - Enable overwriting MSR files + Enable overwriting MSR files - Enable/Disable checking for MSR files. + Enable/Disable checking for MSR files. @@ -5724,6 +5700,12 @@ tis tfs bins + xi + xf + viewBin + yi + yf + ltc fitAsyType histsLRBF minimization @@ -5765,8 +5747,8 @@ fapodization fplot frqMin - frqMax fphase + frqMax rrfFrq rrfUnits rrfPack @@ -5953,7 +5935,7 @@ InitializeFunctions() - 608 + 593 489 @@ -5969,7 +5951,7 @@ AppendToFunctions() - 608 + 593 284 @@ -6017,7 +5999,7 @@ t0UpdateClicked() - 609 + 594 490 @@ -6058,6 +6040,38 @@ + + fitType1 + currentIndexChanged(int) + MuSRFit4 + InitializeFunctions() + + + 79 + 304 + + + 601 + 323 + + + + + beamLine + currentIndexChanged(int) + MuSRFit4 + t0Update() + + + 416 + 144 + + + 603 + 191 + + + t0UpdateClicked() @@ -6077,5 +6091,6 @@ AppendToFunctions() ActivateShComp() TabChanged() + t0Update() diff --git a/src/external/MuSRFitGUI/Ui_MuSRFit4.pm b/src/external/MuSRFitGUI/Ui_MuSRFit4.pm index b9eea50e..8a0fe95f 100644 --- a/src/external/MuSRFitGUI/Ui_MuSRFit4.pm +++ b/src/external/MuSRFitGUI/Ui_MuSRFit4.pm @@ -5,7 +5,7 @@ ################################################################################# ## Form generated from reading UI file 'MuSRFit4.ui' ## -## Created: Wed Mar 22 17:10:29 2017 +## Created: Thu Mar 23 16:58:52 2017 ## by: Qt User Interface Compiler version 4.8.6 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! @@ -2991,14 +2991,6 @@ sub setupUi { $actionsToolBar->setObjectName( "actionsToolBar" ); $actionsToolBar->setMinimumSize( Qt::Size(0, 0) ); $muSRFit4->addToolBar( Qt::TopToolBarArea(), $actionsToolBar ); - $comp1Label->setBuddy( $fitType1 ); - $comp2Label->setBuddy( $fitType1 ); - $comp3Label->setBuddy( $fitType1 ); - $tisLabel->setBuddy( $tis ); - $tfsLabel->setBuddy( $tfs ); - $binsLabel->setBuddy( $bins ); - $titleLabel->setBuddy( $title ); - $fileNameLabel->setBuddy( $fileName ); Qt::Widget::setTabOrder( $musrfit_tabs, $runNumbers ); Qt::Widget::setTabOrder( $runNumbers, $beamLine ); Qt::Widget::setTabOrder( $beamLine, $year ); @@ -3010,7 +3002,13 @@ sub setupUi { Qt::Widget::setTabOrder( $fitType3, $tis ); Qt::Widget::setTabOrder( $tis, $tfs ); Qt::Widget::setTabOrder( $tfs, $bins ); - Qt::Widget::setTabOrder( $bins, $fitAsyType ); + Qt::Widget::setTabOrder( $bins, $xi ); + Qt::Widget::setTabOrder( $xi, $xf ); + Qt::Widget::setTabOrder( $xf, $viewBin ); + Qt::Widget::setTabOrder( $viewBin, $yi ); + Qt::Widget::setTabOrder( $yi, $yf ); + Qt::Widget::setTabOrder( $yf, $ltc ); + Qt::Widget::setTabOrder( $ltc, $fitAsyType ); Qt::Widget::setTabOrder( $fitAsyType, $histsLRBF ); Qt::Widget::setTabOrder( $histsLRBF, $minimization ); Qt::Widget::setTabOrder( $minimization, $errorCalc ); @@ -3051,9 +3049,9 @@ sub setupUi { Qt::Widget::setTabOrder( $funits, $fapodization ); Qt::Widget::setTabOrder( $fapodization, $fplot ); Qt::Widget::setTabOrder( $fplot, $frqMin ); - Qt::Widget::setTabOrder( $frqMin, $frqMax ); - Qt::Widget::setTabOrder( $frqMax, $fphase ); - Qt::Widget::setTabOrder( $fphase, $rrfFrq ); + Qt::Widget::setTabOrder( $frqMin, $fphase ); + Qt::Widget::setTabOrder( $fphase, $frqMax ); + Qt::Widget::setTabOrder( $frqMax, $rrfFrq ); Qt::Widget::setTabOrder( $rrfFrq, $rrfUnits ); Qt::Widget::setTabOrder( $rrfUnits, $rrfPack ); Qt::Widget::setTabOrder( $rrfPack, $rrfPhase ); @@ -3130,6 +3128,8 @@ sub setupUi { Qt::Object::connect($t0Update, SIGNAL 'clicked()' , $muSRFit4, SLOT 't0UpdateClicked()' ); Qt::Object::connect($buttonGroupSharing, SIGNAL 'toggled(bool)' , $muSRFit4, SLOT 'ActivateShComp()' ); Qt::Object::connect($menuBar, SIGNAL 'triggered(QAction*)' , $muSRFit4, SLOT 'RunSelectionToggle()' ); + Qt::Object::connect($fitType1, SIGNAL 'currentIndexChanged(int)' , $muSRFit4, SLOT 'InitializeFunctions()' ); + Qt::Object::connect($beamLine, SIGNAL 'currentIndexChanged(int)' , $muSRFit4, SLOT 't0Update()' ); $musrfit_tabs->setCurrentIndex( 0 ); $fitType2->setCurrentIndex( 18 ); @@ -3159,7 +3159,7 @@ sub retranslateUi { $self->{helpAboutAction}->setText( Qt::Application::translate( 'MuSRFit4', "&About", undef, Qt::Application::UnicodeUTF8() ) ); $self->{helpAboutAction}->setIconText( Qt::Application::translate( 'MuSRFit4', "About", undef, Qt::Application::UnicodeUTF8() ) ); $self->{helpAboutAction}->setShortcut( Qt::KeySequence( '' ) ); - $self->{fileExistCheck}->setText( Qt::Application::translate( 'MuSRFit4', "Overwrite MSR File", undef, Qt::Application::UnicodeUTF8() ) ); + $self->{fileExistCheck}->setText( Qt::Application::translate( 'MuSRFit4', "No Overwrite", undef, Qt::Application::UnicodeUTF8() ) ); $self->{fileExistCheck}->setIconText( Qt::Application::translate( 'MuSRFit4', "Overwrite MSR File", undef, Qt::Application::UnicodeUTF8() ) ); $self->{fileExistCheck}->setToolTip( Qt::Application::translate( 'MuSRFit4', "Enable overwriting MSR files", undef, Qt::Application::UnicodeUTF8() ) ); $self->{fileExistCheck}->setWhatsThis( Qt::Application::translate( 'MuSRFit4', "Enable/Disable checking for MSR files.", undef, Qt::Application::UnicodeUTF8() ) );