diff --git a/src/external/MuSRFitGUI/devel/MSR.pm b/src/external/MuSRFitGUI/devel/MSR.pm
index 7e4d6f91..8e12977f 100755
--- a/src/external/MuSRFitGUI/devel/MSR.pm
+++ b/src/external/MuSRFitGUI/devel/MSR.pm
@@ -124,6 +124,21 @@ sub CreateMSR {
my ($Full_T_Block,$Paramcomp_ref)=MSR::CreateTheory(@FitTypes);
my @Paramcomp = @$Paramcomp_ref;
+
+ # If we have a FUNCTIONS Block the Full_T_Block should be
+ # replaced by Func_T_Block
+ $FUNCTIONS_Block = $EMPTY;
+ if ($All{"FunctionsBlock"} ne $EMPTY) {
+ $FUNCTIONS_Block = "
+###############################################################
+FUNCTIONS
+###############################################################
+".$All{"FunctionsBlock"}."\n";
+ $Full_T_Block=$All{"Func_T_Block"};
+ # remove all _N to end (may fail with large number of parameters)
+ $Full_T_Block =~ s/_\d\b//g;
+ }
+
# Counter for RUNS
my $iRun = 1;
@@ -344,7 +359,6 @@ FITPARAMETER
$PCount $Param $value $error $error $minvalue $maxvalue";
}
-
$Full_T_Block = "
###############################################################
THEORY
@@ -352,14 +366,6 @@ THEORY
$Full_T_Block
";
- $FUNCTIONS_Block = $EMPTY;
- if ($All{"FunctionsBlock"} ne $EMPTY) {
- $FUNCTIONS_Block = "
-###############################################################
-FUNCTIONS
-###############################################################".
-$All{"FunctionsBlock"}."\n";
- }
$RUN_Block =
"###############################################################
@@ -481,6 +487,20 @@ sub CreateMSRSingleHist {
my ($Full_T_Block,$Paramcomp_ref)=MSR::CreateTheory(@FitTypes);
my @Paramcomp = @$Paramcomp_ref;
+ # If we have a FUNCTIONS Block the Full_T_Block should be
+ # replaced by Func_T_Block
+ $FUNCTIONS_Block = $EMPTY;
+ if ($All{"FunctionsBlock"} ne $EMPTY) {
+ $FUNCTIONS_Block = "
+###############################################################
+FUNCTIONS
+###############################################################
+".$All{"FunctionsBlock"}."\n";
+ $Full_T_Block=$All{"Func_T_Block"};
+ # remove all _N to end
+ $Full_T_Block =~ s/_\d\b//g;
+ }
+
# Counter for RUNS
my $iRun = 1;
@@ -725,16 +745,6 @@ THEORY
$Full_T_Block
";
- $FUNCTIONS_Block = $EMPTY;
- if ($All{"FunctionsBlock"} ne $EMPTY) {
- $FUNCTIONS_Block = "
-###############################################################
-FUNCTIONS
-###############################################################".
-$All{"FunctionsBlock"}."\n";
- }
-
-
$RUN_Block =
"###############################################################
$RUN_Block";
diff --git a/src/external/MuSRFitGUI/devel/MuSRFit.pl b/src/external/MuSRFitGUI/devel/MuSRFit.pl
index 3a190ff9..d637c421 100755
--- a/src/external/MuSRFitGUI/devel/MuSRFit.pl
+++ b/src/external/MuSRFitGUI/devel/MuSRFit.pl
@@ -1,6 +1,6 @@
# Form implementation generated from reading ui file 'MuSRFit.ui'
#
-# Created: Mon Jun 7 18:29:05 2010
+# Created: Tue Jun 8 13:35:32 2010
# by: The PerlQt User Interface Compiler (puic)
#
# WARNING! All changes made in this file will be lost!
@@ -43,7 +43,7 @@ use Qt::slots
RunSelectionToggle => [],
fileBrowse => [],
AppendToFunctions => [],
- ResetFunctions => [];
+ InitializeFunctions => [];
use Qt::attributes qw(
musrfit_tabs
RUNSPage
@@ -1583,7 +1583,7 @@ sub NEW
setName("MuSRFitform" );
}
setSizePolicy(Qt::SizePolicy(3, 3, 1, 1, this->sizePolicy()->hasHeightForWidth()) );
- setMinimumSize(Qt::Size(21, 264) );
+ setMinimumSize(Qt::Size(21, 275) );
setIcon($image0 );
setCentralWidget(Qt::Widget(this, "qt_central_widget"));
@@ -1594,7 +1594,6 @@ sub NEW
musrfit_tabs->setSizePolicy( Qt::SizePolicy(7, 7, 1, 1, musrfit_tabs->sizePolicy()->hasHeightForWidth()) );
musrfit_tabs->setMinimumSize( Qt::Size(560, 400) );
musrfit_tabs->setMaximumSize( Qt::Size(95, 32767) );
- musrfit_tabs->setMouseTracking( 0 );
RUNSPage = Qt::Widget(musrfit_tabs, "RUNSPage");
@@ -2840,7 +2839,10 @@ sub NEW
Qt::Object::connect(T0, SIGNAL "activated()", this, SLOT "ShowMuSRT0()");
Qt::Object::connect(Plot, SIGNAL "activated()", this, SLOT "GoPlot()");
Qt::Object::connect(AddConstraint, SIGNAL "clicked()", this, SLOT "AppendToFunctions()");
- Qt::Object::connect(ResetFunc, SIGNAL "clicked()", this, SLOT "ActivateShComp()");
+ Qt::Object::connect(ResetFunc, SIGNAL "clicked()", this, SLOT "InitializeFunctions()");
+ Qt::Object::connect(FitType1, SIGNAL "activated(const QString&)", this, SLOT "InitializeFunctions()");
+ Qt::Object::connect(FitType2, SIGNAL "activated(int)", this, SLOT "InitializeFunctions()");
+ Qt::Object::connect(FitType3, SIGNAL "activated(int)", this, SLOT "InitializeFunctions()");
setTabOrder(musrfit_tabs, RunNumbers);
setTabOrder(RunNumbers, BeamLine);
@@ -3532,7 +3534,9 @@ sub CreateAllInput
# Functions block
$All{"FunctionsBlock"}=FunctionsBlock->text;
-
+# and the associated theory block
+ $All{"Func_T_Block"}=TheoryBlock->text;
+
# Read initial values of paramets from tabel
my $erradd = "d";
my $minadd = "_min";
@@ -3610,8 +3614,6 @@ sub CreateAllInput
$All{"FILENAME"}="TMP";
}
-
-
# Return Hash with all important values
return %All;
@@ -3801,7 +3803,7 @@ sub ActivateShComp
my $ParamChkBx="ShParam_".$Component."_".$i;
my $ChkBx = child($ParamChkBx);
# my $CParam = $Params[$i-1]."_".$Component;
- if ($Params[$i-1] ne "" && $Params[$i-1] ne "Alpha" && $Params[$i-1] ne "N0" && $Params[$i-1] ne "NBg") {
+ if ($Params[$i-1] ne "" ) {
$ChkBx->setHidden(0);
$ChkBx->setEnabled(1);
$ChkBx ->setText($Params[$i-1]);
@@ -3867,6 +3869,11 @@ sub TabChanged
UpdateMSRFileInitTable();
# And also setup T0 and Bg bins
ActivateT0Hists();
+
+# Initialize FUNCTIONS block only if it has not been initialized yet
+ if ($All{"Func_T_Block"} eq "" ) {
+ InitializeFunctions();
+ }
}
@@ -4039,7 +4046,7 @@ sub AppendToFunctions
}
-sub ResetFunctions
+sub InitializeFunctions
{
my %All=CreateAllInput();
@@ -4054,38 +4061,51 @@ sub ResetFunctions
# Get number of parameters to determine the size of the table
my ($Full_T_Block,$Paramcomp_ref)= MSR::CreateTheory(@FitTypes);
-# For now the line below does not work. Why?
-# my $Paramcomp_ref=$All{"Paramcomp_ref"};
my @Paramcomp = @$Paramcomp_ref;
my $Full_T_Block= $All{"Full_T_Block"};
- my $Param="";
- # Initialize Parameters List in function block (constraints).
+# Initialize Parameters List in function block (constraints).
my $ParametersList="";
ParametersList->setText("");
-
# Counter for function block (with out Alpha etc.)
my $ParCount=0;
- CParamsCombo->clear();
-
-# my $CParam = $Params[$i-1]."_".$Component;
-# CParamsCombo->insertItem($CParam,-1);
-# $Full_T_Block=~ s/\b$Params[$i-1]\b/$CParam/;
+ CParamsCombo->clear();
+
+ my $Component=1;
+ foreach my $FitType (@FitTypes) {
+ my $Parameters=$Paramcomp[$Component-1];
+ my @Params = split( /\s+/, $Parameters );
-# Also update Parameters List for the Functions block
- (my $Ptmp,my $tmp)=split(/_/,$Param);
- if ($Ptmp ne "" && $Ptmp ne "Alpha" && $Ptmp ne "N0" && $Ptmp ne "NBg") {
- $ParCount++;
- $ParametersList=$ParametersList."$Param is par$ParCount\n";
- ParametersList->setText($ParametersList);
- }
+# Alpha, N0 and NBg are counted in the parameters
+ if ( $Component == 1 && $All{"FitAsyType"} eq "Asymmetry" ) {
+ unshift( @Params, "Alpha" );
+ }
+ elsif ( $Component == 1 && $All{"FitAsyType"} eq "SingleHist" ) {
+ unshift( @Params, ( "N0", "NBg" ) );
+ }
+
+# Add list to the constraints drop down menu
+ for (my $i=1; $i<=9;$i++) {
+ my $CParam = $Params[$i-1]."_".$Component;
+ if ($Params[$i-1] ne "" ) {
+ if ($Params[$i-1] ne "Alpha" && $Params[$i-1] ne "N0" && $Params[$i-1] ne "NBg") {
+ CParamsCombo->insertItem($CParam,-1);
+ $Full_T_Block=~ s/\b$Params[$i-1]\b/$CParam/;
+ }
+# also enumerate the parameters as should be used in the FUNCTIONS Block
+ $ParCount++;
+ $ParametersList=$ParametersList."$CParam \t is \t par$ParCount\n";
+ ParametersList->setText($ParametersList);
+ }
+ }
+ $Component++;
+ }
# Set theory block in Constraints
TheoryBlock->setText($Full_T_Block);
# Then clear the text
ConstraintLine->setText("");
FunctionsBlock->setText("");
-
}
1;
diff --git a/src/external/MuSRFitGUI/devel/MuSRFit.ui b/src/external/MuSRFitGUI/devel/MuSRFit.ui
index b73aec36..382bbb5a 100755
--- a/src/external/MuSRFitGUI/devel/MuSRFit.ui
+++ b/src/external/MuSRFitGUI/devel/MuSRFit.ui
@@ -22,8 +22,8 @@
- 23
- 270
+ 21
+ 275
@@ -5346,7 +5346,25 @@
ResetFunc
clicked()
MuSRFitform
- ActivateShComp()
+ InitializeFunctions()
+
+
+ FitType1
+ activated(const QString&)
+ MuSRFitform
+ InitializeFunctions()
+
+
+ FitType2
+ activated(int)
+ MuSRFitform
+ InitializeFunctions()
+
+
+ FitType3
+ activated(int)
+ MuSRFitform
+ InitializeFunctions()
@@ -5455,8 +5473,7 @@
RunSelectionToggle()
fileBrowse()
AppendToFunctions()
- ResetFunctions()
- InitializeFunction()
+ InitializeFunctions()
diff --git a/src/external/MuSRFitGUI/devel/MuSRFit.ui.h b/src/external/MuSRFitGUI/devel/MuSRFit.ui.h
index a3914b00..648cd3e5 100755
--- a/src/external/MuSRFitGUI/devel/MuSRFit.ui.h
+++ b/src/external/MuSRFitGUI/devel/MuSRFit.ui.h
@@ -341,9 +341,6 @@ void MuSRFitform::CreateAllInput()
$All{"FunctionsBlock"}=FunctionsBlock->text;
# and the associated theory block
$All{"Func_T_Block"}=TheoryBlock->text;
- if ($All{"Func_T_Block"} eq "") {
- InitializeFunction();
- }
# Read initial values of paramets from tabel
my $erradd = "d";
@@ -665,6 +662,11 @@ void MuSRFitform::TabChanged()
UpdateMSRFileInitTable();
# And also setup T0 and Bg bins
ActivateT0Hists();
+
+# Initialize FUNCTIONS block only if it has not been initialized yet
+ if ($All{"Func_T_Block"} eq "" ) {
+ InitializeFunctions();
+ }
}
@@ -827,7 +829,7 @@ void MuSRFitform::AppendToFunctions()
TheoryBlock->setText($Full_T_Block);
}
-void MuSRFitform::ResetFunctions()
+void MuSRFitform::InitializeFunctions()
{
my %All=CreateAllInput();
my @RUNS = split( /,/, $All{"RunNumbers"} );
@@ -841,67 +843,41 @@ void MuSRFitform::ResetFunctions()
# Get number of parameters to determine the size of the table
my ($Full_T_Block,$Paramcomp_ref)= MSR::CreateTheory(@FitTypes);
-# For now the line below does not work. Why?
-# my $Paramcomp_ref=$All{"Paramcomp_ref"};
my @Paramcomp = @$Paramcomp_ref;
my $Full_T_Block= $All{"Full_T_Block"};
- my $Param="";
- # Initialize Parameters List in function block (constraints).
+# Initialize Parameters List in function block (constraints).
my $ParametersList="";
ParametersList->setText("");
-
# Counter for function block (with out Alpha etc.)
my $ParCount=0;
- CParamsCombo->clear();
-
-# my $CParam = $Params[$i-1]."_".$Component;
-# CParamsCombo->insertItem($CParam,-1);
-# $Full_T_Block=~ s/\b$Params[$i-1]\b/$CParam/;
-
-# Also update Parameters List for the Functions block
- (my $Ptmp,my $tmp)=split(/_/,$Param);
- if ($Ptmp ne "" && $Ptmp ne "Alpha" && $Ptmp ne "N0" && $Ptmp ne "NBg") {
- $ParCount++;
- $ParametersList=$ParametersList."$Param is par$ParCount\n";
- ParametersList->setText($ParametersList);
- }
-# Set theory block in Constraints
- TheoryBlock->setText($Full_T_Block);
-# Then clear the text
- ConstraintLine->setText("");
- FunctionsBlock->setText("");
-
-}
-
-void MuSRFitform::InitializeFunction()
-{
- my %All=CreateAllInput();
- my @RUNS = split( /,/, $All{"RunNumbers"} );
-
- my @FitTypes =();
- foreach my $FitType ($All{"FitType1"}, $All{"FitType2"}, $All{"FitType3"}) {
- if ( $FitType ne "None" ) {
- push( @FitTypes, $FitType );
- }
- }
-
-# Get number of parameters to determine the size of the table
- my ($Full_T_Block,$Paramcomp_ref)= MSR::CreateTheory(@FitTypes);
- my @Paramcomp = @$Paramcomp_ref;
- my $Full_T_Block= $All{"Full_T_Block"};
+ CParamsCombo->clear();
my $Component=1;
foreach my $FitType (@FitTypes) {
my $Parameters=$Paramcomp[$Component-1];
my @Params = split( /\s+/, $Parameters );
+# Alpha, N0 and NBg are counted in the parameters
+ if ( $Component == 1 && $All{"FitAsyType"} eq "Asymmetry" ) {
+ unshift( @Params, "Alpha" );
+ }
+ elsif ( $Component == 1 && $All{"FitAsyType"} eq "SingleHist" ) {
+ unshift( @Params, ( "N0", "NBg" ) );
+ }
+
# Add list to the constraints drop down menu
for (my $i=1; $i<=9;$i++) {
my $CParam = $Params[$i-1]."_".$Component;
if ($Params[$i-1] ne "" ) {
- CParamsCombo->insertItem($CParam,-1);
- $Full_T_Block=~ s/\b$Params[$i-1]\b/$CParam/;
+ if ($Params[$i-1] ne "Alpha" && $Params[$i-1] ne "N0" && $Params[$i-1] ne "NBg") {
+ CParamsCombo->insertItem($CParam,-1);
+ $Full_T_Block=~ s/\b$Params[$i-1]\b/$CParam/;
+ }
+# also enumerate the parameters as should be used in the FUNCTIONS Block
+ $ParCount++;
+ $ParametersList=$ParametersList."$CParam \t is \t par$ParCount\n";
+ ParametersList->setText($ParametersList);
}
}
$Component++;