Auto/Man file selection redesign.

This commit is contained in:
salman 2009-09-03 22:12:27 +00:00
parent 31f7d9cd98
commit b8db37af8c
3 changed files with 2766 additions and 2706 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -79,7 +79,7 @@ void Form1::fileChangeDir()
"get existing directory", "get existing directory",
"Choose a directory", "Choose a directory",
1); 1);
chdir ("$newdir"); chdir ("$newdir");
} }
void Form1::filePrint() void Form1::filePrint()
@ -137,26 +137,26 @@ void Form1::helpContents()
void Form1::helpAbout() void Form1::helpAbout()
{ {
my $AboutText=" my $AboutText="
This is a GUI that uses the musrfit binary, developed by Andreas Suter, This is a GUI that uses the musrfit binary, developed by Andreas Suter,
to fit muSR spectra. to fit muSR spectra.
MuSRFitGUI is free software: you can redistribute it and/or modify MuSRFitGUI is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
MuSRFitGUI is distributed in the hope that it will be useful, MuSRFitGUI is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with MuSRFitGUI. If not, see <http://www.gnu.org/licenses/>. along with MuSRFitGUI. If not, see <http://www.gnu.org/licenses/>.
Copyright 2009 by Zaher Salman and the LEM Group. Copyright 2009 by Zaher Salman and the LEM Group.
<zaher.salman\@psi.ch> <zaher.salman\@psi.ch>
"; ";
my $AboutWindow = Qt::MessageBox::information( this, "About MuSRFit GUI",$AboutText); my $AboutWindow = Qt::MessageBox::information( this, "About MuSRFit GUI",$AboutText);
} }
@ -170,7 +170,7 @@ void MuSRFitform::CreateAllInput()
$All{"RunNumbers"} = RunNumbers->text; $All{"RunNumbers"} = RunNumbers->text;
$All{"RunFiles"} = RunFiles->text; $All{"RunFiles"} = RunFiles->text;
$All{"BeamLine"} = BeamLine->currentText; $All{"BeamLine"} = BeamLine->currentText;
$All{"RUNSType"} = RUNSManual->isChecked(); $All{"RUNSType"} = ManualFile->isOn();
$All{"YEAR"} =YEAR->currentText; $All{"YEAR"} =YEAR->currentText;
$All{"Tis"} = Tis->text; $All{"Tis"} = Tis->text;
$All{"Tfs"} = Tfs->text; $All{"Tfs"} = Tfs->text;
@ -187,7 +187,7 @@ void MuSRFitform::CreateAllInput()
} }
my @Hists = split(/,/, $All{"LRBF"} ); my @Hists = split(/,/, $All{"LRBF"} );
# From Fourier Tab # From Fourier Tab
$All{"FUNITS"}= FUnits->currentText; $All{"FUNITS"}= FUnits->currentText;
$All{"FAPODIZATION"}= FApodization->currentText; $All{"FAPODIZATION"}= FApodization->currentText;
@ -315,18 +315,18 @@ void MuSRFitform::CreateAllInput()
} }
# Loop on components # Loop on components
# Done with shared parameters detecting # Done with shared parameters detecting
# Construct a default filename if empty # Construct a default filename if empty
if ( $All{"FILENAME"} eq "" && !$All{"RUNSType"}) { if ( $All{"FILENAME"} eq "" && !$All{"RUNSType"}) {
$All{"FILENAME"}=$RUNS[0]."_".$All{"BeamLine"}."_".$All{"YEAR"}; $All{"FILENAME"}=$RUNS[0]."_".$All{"BeamLine"}."_".$All{"YEAR"};
} else { } else {
$All{"FILENAME"}="TMP"; $All{"FILENAME"}="TMP";
} }
if ( $All{"go"} eq "" ) { if ( $All{"go"} eq "" ) {
$All{"go"}="PLOT"; $All{"go"}="PLOT";
} }
# Get minimization process # Get minimization process
my $Min = Minimization->selectedId(); my $Min = Minimization->selectedId();
if ($Min==0) { if ($Min==0) {
@ -344,7 +344,7 @@ void MuSRFitform::CreateAllInput()
# Get Error calculation process # Get Error calculation process
my $Err = ErrorCalc->selectedId(); my $Err = ErrorCalc->selectedId();
if ($Err==0) { if ($Err==0) {
$All{"ErrorCalc"}= "HESSE"; $All{"ErrorCalc"}= "HESSE";
# $All{"go"}="MIGRAD"; # $All{"go"}="MIGRAD";
} }
@ -383,10 +383,10 @@ void MuSRFitform::UpdateMSRFileInitTable()
foreach my $line (@lines) { foreach my $line (@lines) {
textMSROutput->append("$line"); textMSROutput->append("$line");
} }
my $FPBlock_ref=MSR::ExtractParamBlk(@lines); my $FPBlock_ref=MSR::ExtractParamBlk(@lines);
my @FPBloc = @$FPBlock_ref; my @FPBloc = @$FPBlock_ref;
my $PCount=0; my $PCount=0;
foreach my $line (@FPBloc) { foreach my $line (@FPBloc) {
$PCount++; $PCount++;
@ -456,8 +456,8 @@ void MuSRFitform::ActivateShComp()
{ {
my %All=CreateAllInput(); my %All=CreateAllInput();
my @RUNS = split( /,/, $All{"RunNumbers"} ); my @RUNS = split( /,/, $All{"RunNumbers"} );
# Hide all sharing components # Hide all sharing components
SharingComp1->setHidden(1); SharingComp1->setHidden(1);
SharingComp2->setHidden(1); SharingComp2->setHidden(1);
SharingComp3->setHidden(1); SharingComp3->setHidden(1);
@ -471,14 +471,14 @@ void MuSRFitform::ActivateShComp()
push( @FitTypes, $FitType ); push( @FitTypes, $FitType );
} }
} }
# Get number of parameters to determine the size of the table # Get number of parameters to determine the size of the table
my ($Full_T_Block,$Paramcomp_ref)= MSR::CreateTheory(@FitTypes); my ($Full_T_Block,$Paramcomp_ref)= MSR::CreateTheory(@FitTypes);
# For now the line below does not work. Why? # For now the line below does not work. Why?
# my $Paramcomp_ref=$All{"Paramcomp_ref"}; # my $Paramcomp_ref=$All{"Paramcomp_ref"};
my @Paramcomp = @$Paramcomp_ref; my @Paramcomp = @$Paramcomp_ref;
my $Full_T_Block= $All{"Full_T_Block"}; my $Full_T_Block= $All{"Full_T_Block"};
my $Component=1; my $Component=1;
foreach my $FitType (@FitTypes) { foreach my $FitType (@FitTypes) {
my $Parameters=$Paramcomp[$Component-1]; my $Parameters=$Paramcomp[$Component-1];
@ -490,7 +490,7 @@ void MuSRFitform::ActivateShComp()
elsif ( $Component == 1 && $All{"FitAsyType"} eq "SingleHist" ) { elsif ( $Component == 1 && $All{"FitAsyType"} eq "SingleHist" ) {
unshift( @Params, ( "N0", "NBg" ) ); unshift( @Params, ( "N0", "NBg" ) );
} }
# Make the component appear first (only if we have multiple runs) # Make the component appear first (only if we have multiple runs)
my $ShCompG="SharingComp".$Component; my $ShCompG="SharingComp".$Component;
@ -499,7 +499,7 @@ void MuSRFitform::ActivateShComp()
$ShCG->setHidden(0); $ShCG->setHidden(0);
$ShCG->setEnabled(1); $ShCG->setEnabled(1);
} }
my $CompShLabel = "Comp".$Component."ShLabel"; my $CompShLabel = "Comp".$Component."ShLabel";
my $CompShL = child($CompShLabel); my $CompShL = child($CompShLabel);
$CompShL->setText($All{"FitType$Component"}); $CompShL->setText($All{"FitType$Component"});
@ -524,7 +524,7 @@ void MuSRFitform::InitializeTab()
my %All=CreateAllInput(); my %All=CreateAllInput();
InitParamTable->setLeftMargin(100); InitParamTable->setLeftMargin(100);
my $NRows = InitParamTable->numRows(); my $NRows = InitParamTable->numRows();
# Remove any rows in table # Remove any rows in table
if ($NRows > 0) { if ($NRows > 0) {
for (my $i=0;$i<$NRows;$i++) { for (my $i=0;$i<$NRows;$i++) {
@ -573,7 +573,7 @@ void MuSRFitform::TabChanged()
# print "Answer=$Answer\n"; # print "Answer=$Answer\n";
} }
} }
# First make sure we have sharing initialized # First make sure we have sharing initialized
ActivateShComp(); ActivateShComp();
InitializeTab(); InitializeTab();
@ -653,30 +653,28 @@ void MuSRFitform::T0Update()
child($Name)->setText($tmp); child($Name)->setText($tmp);
} }
$NHist++ $NHist++
} }
} }
void MuSRFitform::RunSelectionToggle() void MuSRFitform::RunSelectionToggle()
{ {
my $RUNSType = RUNSManual->isChecked(); my $ManualFile= ManualFile->isOn();
if ($RUNSType) { if ($ManualFile) {
# Manual RUN selection # Manual RUN selection
RunFiles->setEnabled(1); FileTypeMan->setEnabled(1);
Browse->setEnabled(1); FileTypeMan->setHidden(0);
RunNumbers->setEnabled(0);
RunNumbers->setText(""); RunNumbers->setText("");
BeamLine->setEnabled(0); FileTypeAuto->setEnabled(0);
YEAR->setEnabled(0); FileTypeAuto->setHidden(1);
} else { } else {
# Auto RUN selection # Auto RUN selection
RunFiles->setEnabled(0); FileTypeMan->setEnabled(0);
FileTypeMan->setHidden(1);
RunFiles->setText(""); RunFiles->setText("");
Browse->setEnabled(0); FileTypeAuto->setEnabled(1);
RunNumbers->setEnabled(1); FileTypeAuto->setHidden(0);
BeamLine->setEnabled(1);
YEAR->setEnabled(1);
} }
} }