Start implementing use of msr2dat for global fit

This commit is contained in:
salman 2010-11-24 14:22:15 +00:00
parent 6442d6a9e6
commit 21b1421cfe
3 changed files with 85 additions and 65 deletions

View File

@ -1,6 +1,6 @@
# Form implementation generated from reading ui file 'MuSRFit.ui' # Form implementation generated from reading ui file 'MuSRFit.ui'
# #
# Created: Wed Aug 18 12:51:07 2010 # Created: Wed Nov 24 15:21:00 2010
# by: The PerlQt User Interface Compiler (puic) # by: The PerlQt User Interface Compiler (puic)
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!
@ -1704,7 +1704,7 @@ sub NEW
setName("MuSRFitform" ); setName("MuSRFitform" );
} }
setSizePolicy(Qt::SizePolicy(3, 3, 1, 1, this->sizePolicy()->hasHeightForWidth()) ); setSizePolicy(Qt::SizePolicy(3, 3, 1, 1, this->sizePolicy()->hasHeightForWidth()) );
setMinimumSize(Qt::Size(21, 275) ); setMinimumSize(Qt::Size(21, 264) );
setIcon($image0 ); setIcon($image0 );
setCentralWidget(Qt::Widget(this, "qt_central_widget")); setCentralWidget(Qt::Widget(this, "qt_central_widget"));
@ -2139,7 +2139,8 @@ sub NEW
buttonGroupSharing->setGeometry( Qt::Rect(5, 5, 545, 355) ); buttonGroupSharing->setGeometry( Qt::Rect(5, 5, 545, 355) );
buttonGroupSharing->setSizePolicy( Qt::SizePolicy(7, 7, 0, 0, buttonGroupSharing->sizePolicy()->hasHeightForWidth()) ); buttonGroupSharing->setSizePolicy( Qt::SizePolicy(7, 7, 0, 0, buttonGroupSharing->sizePolicy()->hasHeightForWidth()) );
buttonGroupSharing->setAlignment( int(&Qt::ButtonGroup::AlignLeft) ); buttonGroupSharing->setAlignment( int(&Qt::ButtonGroup::AlignLeft) );
buttonGroupSharing->setCheckable( 0 ); buttonGroupSharing->setCheckable( 1 );
buttonGroupSharing->setChecked( 0 );
SharingComp1 = Qt::ButtonGroup(buttonGroupSharing, "SharingComp1"); SharingComp1 = Qt::ButtonGroup(buttonGroupSharing, "SharingComp1");
SharingComp1->setEnabled( 0 ); SharingComp1->setEnabled( 0 );
@ -3011,6 +3012,7 @@ sub NEW
Qt::Object::connect(FitType2, SIGNAL "activated(const QString&)", this, SLOT "InitializeFunctions()"); Qt::Object::connect(FitType2, SIGNAL "activated(const QString&)", this, SLOT "InitializeFunctions()");
Qt::Object::connect(FitType3, SIGNAL "activated(const QString&)", this, SLOT "InitializeFunctions()"); Qt::Object::connect(FitType3, SIGNAL "activated(const QString&)", this, SLOT "InitializeFunctions()");
Qt::Object::connect(AddConstraint, SIGNAL "clicked()", this, SLOT "AppendToFunctions()"); Qt::Object::connect(AddConstraint, SIGNAL "clicked()", this, SLOT "AppendToFunctions()");
Qt::Object::connect(buttonGroupSharing, SIGNAL "toggled(bool)", this, SLOT "ActivateShComp()");
setTabOrder(musrfit_tabs, RunNumbers); setTabOrder(musrfit_tabs, RunNumbers);
setTabOrder(RunNumbers, BeamLine); setTabOrder(RunNumbers, BeamLine);
@ -3772,7 +3774,6 @@ sub CreateAllInput
$Shared = $ChkBx->isChecked(); $Shared = $ChkBx->isChecked();
} }
$All{"Sh_$Param"}=$Shared; $All{"Sh_$Param"}=$Shared;
print "Sh_$Param=$Shared\n";
$NP++; $NP++;
} }
#Loop on parameters #Loop on parameters
@ -3971,43 +3972,47 @@ sub ActivateShComp
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; # Possible to chare only if sharing is enabled altogether
foreach my $FitType (@FitTypes) { my $EnableSharing = buttonGroupSharing->isChecked();
my $Parameters=$Paramcomp[$Component-1]; if ($EnableSharing) {
my @Params = split( /\s+/, $Parameters ); my $Component=1;
foreach my $FitType (@FitTypes) {
my $Parameters=$Paramcomp[$Component-1];
my @Params = split( /\s+/, $Parameters );
if ( $Component == 1 && $All{"FitAsyType"} eq "Asymmetry" ) { if ( $Component == 1 && $All{"FitAsyType"} eq "Asymmetry" ) {
unshift( @Params, "Alpha" ); unshift( @Params, "Alpha" );
} }
elsif ( $Component == 1 && $All{"FitAsyType"} eq "SingleHist" ) { elsif ( $Component == 1 && $All{"FitAsyType"} eq "SingleHist" ) {
unshift( @Params, ( "No", "NBg" ) ); unshift( @Params, ( "No", "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;
my $ShCG = child($ShCompG); my $ShCG = child($ShCompG);
if ($#RUNS>0) { if ($#RUNS>0) {
$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"});
# Change state/label of parameters # Change state/label of parameters
for (my $i=1; $i<=9;$i++) { for (my $i=1; $i<=9;$i++) {
my $ParamChkBx="ShParam_".$Component."_".$i; my $ParamChkBx="ShParam_".$Component."_".$i;
my $ChkBx = child($ParamChkBx); my $ChkBx = child($ParamChkBx);
if ($Params[$i-1] ne "") { if ($Params[$i-1] ne "") {
$ChkBx->setHidden(0); $ChkBx->setHidden(0);
$ChkBx->setEnabled(1); $ChkBx->setEnabled(1);
$ChkBx ->setText($Params[$i-1]); $ChkBx ->setText($Params[$i-1]);
} else { } else {
$ChkBx->setHidden(1); $ChkBx->setHidden(1);
}
} }
$Component++;
} }
$Component++;
} }
} }

View File

@ -23,7 +23,7 @@
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>21</width> <width>21</width>
<height>275</height> <height>264</height>
</size> </size>
</property> </property>
<property name="caption"> <property name="caption">
@ -2162,6 +2162,9 @@
<set>AlignLeft</set> <set>AlignLeft</set>
</property> </property>
<property name="checkable"> <property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool> <bool>false</bool>
</property> </property>
<widget class="QButtonGroup"> <widget class="QButtonGroup">
@ -5496,6 +5499,12 @@
<receiver>MuSRFitform</receiver> <receiver>MuSRFitform</receiver>
<slot>AppendToFunctions()</slot> <slot>AppendToFunctions()</slot>
</connection> </connection>
<connection>
<sender>buttonGroupSharing</sender>
<signal>toggled(bool)</signal>
<receiver>MuSRFitform</receiver>
<slot>ActivateShComp()</slot>
</connection>
</connections> </connections>
<tabstops> <tabstops>
<tabstop>musrfit_tabs</tabstop> <tabstop>musrfit_tabs</tabstop>

View File

@ -583,43 +583,47 @@ void MuSRFitform::ActivateShComp()
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; # Possible to chare only if sharing is enabled altogether
foreach my $FitType (@FitTypes) { my $EnableSharing = buttonGroupSharing->isChecked();
my $Parameters=$Paramcomp[$Component-1]; if ($EnableSharing) {
my @Params = split( /\s+/, $Parameters ); my $Component=1;
foreach my $FitType (@FitTypes) {
my $Parameters=$Paramcomp[$Component-1];
my @Params = split( /\s+/, $Parameters );
if ( $Component == 1 && $All{"FitAsyType"} eq "Asymmetry" ) { if ( $Component == 1 && $All{"FitAsyType"} eq "Asymmetry" ) {
unshift( @Params, "Alpha" ); unshift( @Params, "Alpha" );
} }
elsif ( $Component == 1 && $All{"FitAsyType"} eq "SingleHist" ) { elsif ( $Component == 1 && $All{"FitAsyType"} eq "SingleHist" ) {
unshift( @Params, ( "No", "NBg" ) ); unshift( @Params, ( "No", "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;
my $ShCG = child($ShCompG); my $ShCG = child($ShCompG);
if ($#RUNS>0) { if ($#RUNS>0) {
$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"});
# Change state/label of parameters # Change state/label of parameters
for (my $i=1; $i<=9;$i++) { for (my $i=1; $i<=9;$i++) {
my $ParamChkBx="ShParam_".$Component."_".$i; my $ParamChkBx="ShParam_".$Component."_".$i;
my $ChkBx = child($ParamChkBx); my $ChkBx = child($ParamChkBx);
if ($Params[$i-1] ne "") { if ($Params[$i-1] ne "") {
$ChkBx->setHidden(0); $ChkBx->setHidden(0);
$ChkBx->setEnabled(1); $ChkBx->setEnabled(1);
$ChkBx ->setText($Params[$i-1]); $ChkBx ->setText($Params[$i-1]);
} else { } else {
$ChkBx->setHidden(1); $ChkBx->setHidden(1);
}
} }
$Component++;
} }
$Component++;
} }
} }
@ -899,3 +903,5 @@ void MuSRFitform::InitializeFunctions()
ConstraintLine->setText(""); ConstraintLine->setText("");
FunctionsBlock->setText(""); FunctionsBlock->setText("");
} }