Algorithm for FUNCTIONS block implemented in GUI. Not yet full in MSR module.

This commit is contained in:
nemu 2010-06-07 15:53:31 +00:00
parent 23077d70f2
commit e68de4133c
4 changed files with 726 additions and 344 deletions

View File

@ -122,7 +122,6 @@ sub CreateMSR {
# First create the THEORY Block # First create the THEORY Block
my ($Full_T_Block,$Paramcomp_ref)=MSR::CreateTheory(@FitTypes); my ($Full_T_Block,$Paramcomp_ref)=MSR::CreateTheory(@FitTypes);
my @Paramcomp = @$Paramcomp_ref; my @Paramcomp = @$Paramcomp_ref;
# Counter for RUNS # Counter for RUNS
@ -147,8 +146,7 @@ sub CreateMSR {
# $shcount is a counter for shared parameters # $shcount is a counter for shared parameters
if ( $#RUNS == 0 ) { if ( $#RUNS == 0 ) {
my $shcount = 1; my $shcount = 1;
} } else {
else {
if ( $All{"Sh_Alpha"} == 1 ) { if ( $All{"Sh_Alpha"} == 1 ) {
my $shcount = 1; my $shcount = 1;
} else { } else {
@ -354,6 +352,15 @@ THEORY
$Full_T_Block $Full_T_Block
"; ";
$FUNCTIONS_Block = $EMPTY;
if ($All{"FunctionsBlock"} ne $EMPTY) {
$FUNCTIONS_Block = "
###############################################################
FUNCTIONS
###############################################################".
$All{"FunctionsBlock"}."\n";
}
$RUN_Block = $RUN_Block =
"############################################################### "###############################################################
$RUN_Block"; $RUN_Block";
@ -421,7 +428,7 @@ STATISTIC --- 0000-00-00 00:00:00
# Empty line at the end of each block # Empty line at the end of each block
my $FullMSRFile = "$TitleLine$FitParaBlk\n$Full_T_Block\n$RUN_Block\n$COMMANDS_Block\n$PLOT_Block\n$FOURIER_Block\n$STAT_Block\n"; my $FullMSRFile = "$TitleLine$FitParaBlk\n$Full_T_Block\n$FUNCTIONS_Block\n$RUN_Block\n$COMMANDS_Block\n$PLOT_Block\n$FOURIER_Block\n$STAT_Block\n";
# Open output file FILENAME.msr # Open output file FILENAME.msr
open( OUTF,q{>},"$FILENAME.msr" ); open( OUTF,q{>},"$FILENAME.msr" );
@ -493,6 +500,7 @@ sub CreateMSRSingleHist {
$RUNSType = 1; $RUNSType = 1;
} }
# Until here identical to sub CreateMSR
# $shcount is a counter for shared parameters # $shcount is a counter for shared parameters
if ( $#RUNS == 0 && $#Hists == 0) { if ( $#RUNS == 0 && $#Hists == 0) {
my $shcount = 1; my $shcount = 1;
@ -517,6 +525,10 @@ sub CreateMSRSingleHist {
# For a single histogram fit we basically need to repeat this for each hist # For a single histogram fit we basically need to repeat this for each hist
# However, "physical" parameters such as Asymmetry, relaxation etc. should # However, "physical" parameters such as Asymmetry, relaxation etc. should
# be the same for all histograms # be the same for all histograms
# We distinguich between sharing among different runs to common parameters
# for different histograms. The first is done in the usual "Sharing" schame,
# while the second has to be done in the functions block. This can be done
# in a consistent, non-confusing algorithm
foreach my $Hist (@Hists) { foreach my $Hist (@Hists) {
# Prepare the Parameters and initial values block # Prepare the Parameters and initial values block
@ -713,6 +725,16 @@ THEORY
$Full_T_Block $Full_T_Block
"; ";
$FUNCTIONS_Block = $EMPTY;
if ($All{"FunctionsBlock"} ne $EMPTY) {
$FUNCTIONS_Block = "
###############################################################
FUNCTIONS
###############################################################".
$All{"FunctionsBlock"}."\n";
}
$RUN_Block = $RUN_Block =
"############################################################### "###############################################################
$RUN_Block"; $RUN_Block";
@ -780,7 +802,7 @@ STATISTIC --- 0000-00-00 00:00:00
# Empty line at the end of each block # Empty line at the end of each block
my $FullMSRFile = "$TitleLine$FitParaBlk\n$Full_T_Block\n$RUN_Block\n$COMMANDS_Block\n$PLOT_Block\n$FOURIER_Block\n$STAT_Block\n"; my $FullMSRFile = "$TitleLine$FitParaBlk\n$Full_T_Block\n$FUNCTIONS_Block\n$RUN_Block\n$COMMANDS_Block\n$PLOT_Block\n$FOURIER_Block\n$STAT_Block\n";
# Open output file FILENAME.msr # Open output file FILENAME.msr
open( OUTF,q{>},"$FILENAME.msr" ); open( OUTF,q{>},"$FILENAME.msr" );
@ -1072,16 +1094,19 @@ sub T0BgData {
my %RV=(); my %RV=();
# If multiple histograms (sum or difference) take the first histogram only
my @Hists=split(/ /,$Hist);
if ($BeamLine eq "LEM") { if ($BeamLine eq "LEM") {
my $HistParams=$LEM{$Hist}; my $HistParams=$LEM{$Hists[0]};
($RV{"t0"},$RV{"Bg1"},$RV{"Bg2"},$RV{"Data1"},$RV{"Data2"})=split(/,/,$HistParams); ($RV{"t0"},$RV{"Bg1"},$RV{"Bg2"},$RV{"Data1"},$RV{"Data2"})=split(/,/,$HistParams);
} }
elsif ($BeamLine eq "Dolly") { elsif ($BeamLine eq "Dolly") {
my $HistParams=$Dolly{$Hist}; my $HistParams=$Dolly{$Hists[0]};
($RV{"t0"},$RV{"Bg1"},$RV{"Bg2"},$RV{"Data1"},$RV{"Data2"})=split(/,/,$HistParams); ($RV{"t0"},$RV{"Bg1"},$RV{"Bg2"},$RV{"Data1"},$RV{"Data2"})=split(/,/,$HistParams);
} }
elsif ($BeamLine eq "GPS") { elsif ($BeamLine eq "GPS") {
my $HistParams=$GPS{$Hist}; my $HistParams=$GPS{$Hists[0]};
($RV{"t0"},$RV{"Bg1"},$RV{"Bg2"},$RV{"Data1"},$RV{"Data2"})=split(/,/,$HistParams); ($RV{"t0"},$RV{"Bg1"},$RV{"Bg2"},$RV{"Data1"},$RV{"Data2"})=split(/,/,$HistParams);
} }
return $RV{$Name}; return $RV{$Name};
@ -1562,7 +1587,8 @@ sub RUNFileNameAuto {
$RUNFILE = "$DATADIR/$YEAR/$RUN_File_Name"; $RUNFILE = "$DATADIR/$YEAR/$RUN_File_Name";
} }
elsif ( $BeamLine eq "GPS" ) { elsif ( $BeamLine eq "GPS" ) {
$RUN_File_Name = "deltat_pta_gps_" . $RUNtmp; # $RUN_File_Name = "deltat_pta_gps_" . $RUNtmp;
$RUN_File_Name = "deltat_tdc_gps_" . $RUNtmp;
if ( $YEAR == $current_year ) { if ( $YEAR == $current_year ) {
$RUNFILE = "$DATADIR/$RUN_File_Name"; $RUNFILE = "$DATADIR/$RUN_File_Name";
} }

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: Mon May 31 15:10:55 2010 # Created: Mon Jun 7 17:42:34 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!
@ -42,8 +42,7 @@ use Qt::slots
T0Update => [], T0Update => [],
RunSelectionToggle => [], RunSelectionToggle => [],
fileBrowse => [], fileBrowse => [],
AppendToFunctions => [], AppendToFunctions => [];
ResetFunctions => [];
use Qt::attributes qw( use Qt::attributes qw(
musrfit_tabs musrfit_tabs
RUNSPage RUNSPage
@ -181,8 +180,10 @@ use Qt::attributes qw(
Data14 Data14
Data24 Data24
ConstPage ConstPage
textLabel2_2 TheoryBlock_Label
TheoryBlock TheoryBlock
ParametersList_Label
ParametersList
CParamsCombo CParamsCombo
textLabel1_4_6 textLabel1_4_6
ConstraintLine ConstraintLine
@ -190,7 +191,6 @@ use Qt::attributes qw(
textLabel2_2_3_4 textLabel2_2_3_4
FunctionsBlock FunctionsBlock
textLabel1_6 textLabel1_6
ApplyFunc_2
ResetFunc ResetFunc
MenuBar MenuBar
fileMenu fileMenu
@ -1582,7 +1582,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"));
@ -2244,6 +2244,7 @@ sub NEW
$layout25->addWidget(groupTitle); $layout25->addWidget(groupTitle);
textMSROutput = Qt::TextEdit($LayoutWidget_8, "textMSROutput"); textMSROutput = Qt::TextEdit($LayoutWidget_8, "textMSROutput");
textMSROutput->setWordWrap( &Qt::TextEdit::WidgetWidth() );
textMSROutput->setOverwriteMode( 1 ); textMSROutput->setOverwriteMode( 1 );
$layout25->addWidget(textMSROutput); $layout25->addWidget(textMSROutput);
musrfit_tabs->insertTab( MSRPage, "" ); musrfit_tabs->insertTab( MSRPage, "" );
@ -2462,10 +2463,12 @@ sub NEW
ConstPage = Qt::Widget(musrfit_tabs, "ConstPage"); ConstPage = Qt::Widget(musrfit_tabs, "ConstPage");
my $LayoutWidget_16 = Qt::Widget(ConstPage, '$LayoutWidget_16'); my $LayoutWidget_16 = Qt::Widget(ConstPage, '$LayoutWidget_16');
$LayoutWidget_16->setGeometry( Qt::Rect(5, 5, 545, 350) ); $LayoutWidget_16->setGeometry( Qt::Rect(6, 1, 540, 360) );
my $layout31_2 = Qt::VBoxLayout($LayoutWidget_16, 11, 6, '$layout31_2'); my $layout34_2 = Qt::VBoxLayout($LayoutWidget_16, 11, 6, '$layout34_2');
textLabel2_2 = Qt::Label($LayoutWidget_16, "textLabel2_2"); my $layout33_3 = Qt::GridLayout(undef, 1, 1, 0, 6, '$layout33_3');
TheoryBlock_Label = Qt::Label($LayoutWidget_16, "TheoryBlock_Label");
$cg->setColor(&Qt::ColorGroup::Foreground, &black); $cg->setColor(&Qt::ColorGroup::Foreground, &black);
$cg->setColor(&Qt::ColorGroup::Button, Qt::Color(230,240,249)); $cg->setColor(&Qt::ColorGroup::Button, Qt::Color(230,240,249));
$cg->setColor(&Qt::ColorGroup::Light, &white); $cg->setColor(&Qt::ColorGroup::Light, &white);
@ -2517,11 +2520,76 @@ sub NEW
$cg->setColor(&Qt::ColorGroup::Link, Qt::Color(0,0,238)); $cg->setColor(&Qt::ColorGroup::Link, Qt::Color(0,0,238));
$cg->setColor(&Qt::ColorGroup::LinkVisited, Qt::Color(82,24,139)); $cg->setColor(&Qt::ColorGroup::LinkVisited, Qt::Color(82,24,139));
$pal->setDisabled($cg); $pal->setDisabled($cg);
textLabel2_2->setPalette( $pal ); TheoryBlock_Label->setPalette( $pal );
$layout31_2->addWidget(textLabel2_2);
$layout33_3->addWidget(TheoryBlock_Label, 0, 0);
TheoryBlock = Qt::TextEdit($LayoutWidget_16, "TheoryBlock"); TheoryBlock = Qt::TextEdit($LayoutWidget_16, "TheoryBlock");
$layout31_2->addWidget(TheoryBlock); TheoryBlock->setEnabled( 0 );
$layout33_3->addWidget(TheoryBlock, 1, 0);
ParametersList_Label = Qt::Label($LayoutWidget_16, "ParametersList_Label");
$cg->setColor(&Qt::ColorGroup::Foreground, &black);
$cg->setColor(&Qt::ColorGroup::Button, Qt::Color(230,240,249));
$cg->setColor(&Qt::ColorGroup::Light, &white);
$cg->setColor(&Qt::ColorGroup::Midlight, Qt::Color(242,247,252));
$cg->setColor(&Qt::ColorGroup::Dark, Qt::Color(115,120,124));
$cg->setColor(&Qt::ColorGroup::Mid, Qt::Color(154,160,166));
$cg->setColor(&Qt::ColorGroup::Text, &black);
$cg->setColor(&Qt::ColorGroup::BrightText, &white);
$cg->setColor(&Qt::ColorGroup::ButtonText, &black);
$cg->setColor(&Qt::ColorGroup::Base, &white);
$cg->setColor(&Qt::ColorGroup::Background, Qt::Color(255,255,127));
$cg->setColor(&Qt::ColorGroup::Shadow, &black);
$cg->setColor(&Qt::ColorGroup::Highlight, Qt::Color(0,0,128));
$cg->setColor(&Qt::ColorGroup::HighlightedText, &white);
$cg->setColor(&Qt::ColorGroup::Link, &black);
$cg->setColor(&Qt::ColorGroup::LinkVisited, &black);
$pal->setActive($cg);
$cg->setColor(&Qt::ColorGroup::Foreground, &black);
$cg->setColor(&Qt::ColorGroup::Button, Qt::Color(230,240,249));
$cg->setColor(&Qt::ColorGroup::Light, &white);
$cg->setColor(&Qt::ColorGroup::Midlight, &white);
$cg->setColor(&Qt::ColorGroup::Dark, Qt::Color(115,120,124));
$cg->setColor(&Qt::ColorGroup::Mid, Qt::Color(154,160,166));
$cg->setColor(&Qt::ColorGroup::Text, &black);
$cg->setColor(&Qt::ColorGroup::BrightText, &white);
$cg->setColor(&Qt::ColorGroup::ButtonText, &black);
$cg->setColor(&Qt::ColorGroup::Base, &white);
$cg->setColor(&Qt::ColorGroup::Background, Qt::Color(255,255,127));
$cg->setColor(&Qt::ColorGroup::Shadow, &black);
$cg->setColor(&Qt::ColorGroup::Highlight, Qt::Color(0,0,128));
$cg->setColor(&Qt::ColorGroup::HighlightedText, &white);
$cg->setColor(&Qt::ColorGroup::Link, Qt::Color(0,0,238));
$cg->setColor(&Qt::ColorGroup::LinkVisited, Qt::Color(82,24,139));
$pal->setInactive($cg);
$cg->setColor(&Qt::ColorGroup::Foreground, Qt::Color(128,128,128));
$cg->setColor(&Qt::ColorGroup::Button, Qt::Color(230,240,249));
$cg->setColor(&Qt::ColorGroup::Light, &white);
$cg->setColor(&Qt::ColorGroup::Midlight, &white);
$cg->setColor(&Qt::ColorGroup::Dark, Qt::Color(115,120,124));
$cg->setColor(&Qt::ColorGroup::Mid, Qt::Color(154,160,166));
$cg->setColor(&Qt::ColorGroup::Text, Qt::Color(128,128,128));
$cg->setColor(&Qt::ColorGroup::BrightText, &white);
$cg->setColor(&Qt::ColorGroup::ButtonText, Qt::Color(128,128,128));
$cg->setColor(&Qt::ColorGroup::Base, &white);
$cg->setColor(&Qt::ColorGroup::Background, Qt::Color(255,255,127));
$cg->setColor(&Qt::ColorGroup::Shadow, &black);
$cg->setColor(&Qt::ColorGroup::Highlight, Qt::Color(0,0,128));
$cg->setColor(&Qt::ColorGroup::HighlightedText, &white);
$cg->setColor(&Qt::ColorGroup::Link, Qt::Color(0,0,238));
$cg->setColor(&Qt::ColorGroup::LinkVisited, Qt::Color(82,24,139));
$pal->setDisabled($cg);
ParametersList_Label->setPalette( $pal );
$layout33_3->addWidget(ParametersList_Label, 0, 1);
ParametersList = Qt::TextEdit($LayoutWidget_16, "ParametersList");
ParametersList->setEnabled( 0 );
$layout33_3->addWidget(ParametersList, 1, 1);
$layout34_2->addLayout($layout33_3);
my $layout25_6 = Qt::HBoxLayout(undef, 0, 6, '$layout25_6'); my $layout25_6 = Qt::HBoxLayout(undef, 0, 6, '$layout25_6');
@ -2540,7 +2608,7 @@ sub NEW
AddConstraint = Qt::PushButton($LayoutWidget_16, "AddConstraint"); AddConstraint = Qt::PushButton($LayoutWidget_16, "AddConstraint");
AddConstraint->setSizePolicy( Qt::SizePolicy(0, 7, 0, 0, AddConstraint->sizePolicy()->hasHeightForWidth()) ); AddConstraint->setSizePolicy( Qt::SizePolicy(0, 7, 0, 0, AddConstraint->sizePolicy()->hasHeightForWidth()) );
$layout25_6->addWidget(AddConstraint); $layout25_6->addWidget(AddConstraint);
$layout31_2->addLayout($layout25_6); $layout34_2->addLayout($layout25_6);
textLabel2_2_3_4 = Qt::Label($LayoutWidget_16, "textLabel2_2_3_4"); textLabel2_2_3_4 = Qt::Label($LayoutWidget_16, "textLabel2_2_3_4");
$cg->setColor(&Qt::ColorGroup::Foreground, &black); $cg->setColor(&Qt::ColorGroup::Foreground, &black);
@ -2595,24 +2663,20 @@ sub NEW
$cg->setColor(&Qt::ColorGroup::LinkVisited, Qt::Color(82,24,139)); $cg->setColor(&Qt::ColorGroup::LinkVisited, Qt::Color(82,24,139));
$pal->setDisabled($cg); $pal->setDisabled($cg);
textLabel2_2_3_4->setPalette( $pal ); textLabel2_2_3_4->setPalette( $pal );
$layout31_2->addWidget(textLabel2_2_3_4); $layout34_2->addWidget(textLabel2_2_3_4);
FunctionsBlock = Qt::TextEdit($LayoutWidget_16, "FunctionsBlock"); FunctionsBlock = Qt::TextEdit($LayoutWidget_16, "FunctionsBlock");
$layout31_2->addWidget(FunctionsBlock); $layout34_2->addWidget(FunctionsBlock);
my $layout30 = Qt::HBoxLayout(undef, 0, 6, '$layout30'); my $layout30 = Qt::HBoxLayout(undef, 0, 6, '$layout30');
textLabel1_6 = Qt::Label($LayoutWidget_16, "textLabel1_6"); textLabel1_6 = Qt::Label($LayoutWidget_16, "textLabel1_6");
$layout30->addWidget(textLabel1_6); $layout30->addWidget(textLabel1_6);
ApplyFunc_2 = Qt::PushButton($LayoutWidget_16, "ApplyFunc_2");
ApplyFunc_2->setMaximumSize( Qt::Size(100, 32767) );
$layout30->addWidget(ApplyFunc_2);
ResetFunc = Qt::PushButton($LayoutWidget_16, "ResetFunc"); ResetFunc = Qt::PushButton($LayoutWidget_16, "ResetFunc");
ResetFunc->setMaximumSize( Qt::Size(100, 32767) ); ResetFunc->setMaximumSize( Qt::Size(100, 32767) );
$layout30->addWidget(ResetFunc); $layout30->addWidget(ResetFunc);
$layout31_2->addLayout($layout30); $layout34_2->addLayout($layout30);
musrfit_tabs->insertTab( ConstPage, "" ); musrfit_tabs->insertTab( ConstPage, "" );
fileNewAction= Qt::Action(this, "fileNewAction"); fileNewAction= Qt::Action(this, "fileNewAction");
@ -2775,7 +2839,7 @@ sub NEW
Qt::Object::connect(T0, SIGNAL "activated()", this, SLOT "ShowMuSRT0()"); Qt::Object::connect(T0, SIGNAL "activated()", this, SLOT "ShowMuSRT0()");
Qt::Object::connect(Plot, SIGNAL "activated()", this, SLOT "GoPlot()"); Qt::Object::connect(Plot, SIGNAL "activated()", this, SLOT "GoPlot()");
Qt::Object::connect(AddConstraint, SIGNAL "clicked()", this, SLOT "AppendToFunctions()"); Qt::Object::connect(AddConstraint, SIGNAL "clicked()", this, SLOT "AppendToFunctions()");
Qt::Object::connect(ResetFunc, SIGNAL "clicked()", this, SLOT "ResetFunctions()"); Qt::Object::connect(ResetFunc, SIGNAL "clicked()", this, SLOT "ActivateShComp()");
setTabOrder(musrfit_tabs, RunNumbers); setTabOrder(musrfit_tabs, RunNumbers);
setTabOrder(RunNumbers, BeamLine); setTabOrder(RunNumbers, BeamLine);
@ -3015,6 +3079,7 @@ sub languageChange
FILENAMELabel->setText( trUtf8("Enter [name] for output [name].msr file (optional)") ); FILENAMELabel->setText( trUtf8("Enter [name] for output [name].msr file (optional)") );
Qt::ToolTip::add(FILENAME, trUtf8("Name of the produced MSR file (optional)")); Qt::ToolTip::add(FILENAME, trUtf8("Name of the produced MSR file (optional)"));
Qt::WhatsThis::add(FILENAME, trUtf8("Name of the produced MSR file (optional)")); Qt::WhatsThis::add(FILENAME, trUtf8("Name of the produced MSR file (optional)"));
textMSROutput->setText( undef );
musrfit_tabs->changeTab( MSRPage, trUtf8("MSR File") ); musrfit_tabs->changeTab( MSRPage, trUtf8("MSR File") );
FUnitsLabel->setText( trUtf8("Units") ); FUnitsLabel->setText( trUtf8("Units") );
FApodizationLabel->setText( trUtf8("Apodization") ); FApodizationLabel->setText( trUtf8("Apodization") );
@ -3056,12 +3121,12 @@ sub languageChange
groupHist3->setTitle( trUtf8("Hist3") ); groupHist3->setTitle( trUtf8("Hist3") );
groupHist4->setTitle( trUtf8("Hist4") ); groupHist4->setTitle( trUtf8("Hist4") );
musrfit_tabs->changeTab( T0Page, trUtf8("t0/Bg Bins") ); musrfit_tabs->changeTab( T0Page, trUtf8("t0/Bg Bins") );
textLabel2_2->setText( trUtf8("THEORY Block") ); TheoryBlock_Label->setText( trUtf8("THEORY Block") );
ParametersList_Label->setText( trUtf8("Parameters List") );
textLabel1_4_6->setText( trUtf8("=") ); textLabel1_4_6->setText( trUtf8("=") );
AddConstraint->setText( trUtf8("Add") ); AddConstraint->setText( trUtf8("Add") );
textLabel2_2_3_4->setText( trUtf8("FUNCTIONS Block") ); textLabel2_2_3_4->setText( trUtf8("FUNCTIONS Block") );
textLabel1_6->setText( undef ); textLabel1_6->setText( undef );
ApplyFunc_2->setText( trUtf8("Apply") );
ResetFunc->setText( trUtf8("Reset") ); ResetFunc->setText( trUtf8("Reset") );
musrfit_tabs->changeTab( ConstPage, trUtf8("Constraints") ); musrfit_tabs->changeTab( ConstPage, trUtf8("Constraints") );
fileNewAction->setText( trUtf8("&New") ); fileNewAction->setText( trUtf8("&New") );
@ -3464,6 +3529,9 @@ sub CreateAllInput
$All{"Paramcomp_ref"}=$Paramcomp_ref; $All{"Paramcomp_ref"}=$Paramcomp_ref;
my @Paramcomp = @$Paramcomp_ref; my @Paramcomp = @$Paramcomp_ref;
# Functions block
$All{"FunctionsBlock"}=FunctionsBlock->text;
# Read initial values of paramets from tabel # Read initial values of paramets from tabel
my $erradd = "d"; my $erradd = "d";
my $minadd = "_min"; my $minadd = "_min";
@ -3603,12 +3671,13 @@ sub UpdateMSRFileInitTable
(my $TBlock_ref, my $FPBlock_ref)=MSR::ExtractBlks(@lines); (my $TBlock_ref, my $FPBlock_ref)=MSR::ExtractBlks(@lines);
my @FPBloc = @$FPBlock_ref; my @FPBloc = @$FPBlock_ref;
# Counter for initialization table (including Alpha, N0 and Bg)
my $PCount=0; my $PCount=0;
foreach my $line (@FPBloc) { foreach my $line (@FPBloc) {
$PCount++; $PCount++;
my @Param=split(/\s+/,$line); my @Param=split(/\s+/,$line);
# Depending on home many elements in @Param determine what they mean # Depending on how many elements in @Param determine what they mean
# 0th element is empty (always) # 0th element is empty (always)
# 1st element is the order (always) # 1st element is the order (always)
# 2nd element is the name (always) # 2nd element is the name (always)
@ -3744,7 +3813,11 @@ sub ActivateShComp
} }
$Component++; $Component++;
} }
# Set theory block in Constraints
TheoryBlock->setText($Full_T_Block); TheoryBlock->setText($Full_T_Block);
# Then clear the text
ConstraintLine->setText("");
FunctionsBlock->setText("");
} }
@ -3763,6 +3836,10 @@ sub InitializeTab
} }
} }
# Initialize Parameters List in function block (constraints).
my $ParametersList="";
ParametersList->setText("");
my %PTable=MSR::PrepParamTable(\%All); my %PTable=MSR::PrepParamTable(\%All);
# Setup the table with the right size # Setup the table with the right size
@ -3771,6 +3848,9 @@ sub InitializeTab
InitParamTable->setNumRows($NParam); InitParamTable->setNumRows($NParam);
} }
# Counter for function block (with out Alpha etc.)
my $ParCount=0;
# Fill the table with labels and values of parametr # Fill the table with labels and values of parametr
for (my $PCount=0;$PCount<$NParam;$PCount++) { for (my $PCount=0;$PCount<$NParam;$PCount++) {
my ($Param,$value,$error,$minvalue,$maxvalue,$RUN) = split(/,/,$PTable{$PCount}); my ($Param,$value,$error,$minvalue,$maxvalue,$RUN) = split(/,/,$PTable{$PCount});
@ -3783,6 +3863,15 @@ sub InitializeTab
InitParamTable->setText($PCount,1,$error); InitParamTable->setText($PCount,1,$error);
InitParamTable->setText($PCount,2,$minvalue); InitParamTable->setText($PCount,2,$minvalue);
InitParamTable->setText($PCount,3,$maxvalue); InitParamTable->setText($PCount,3,$maxvalue);
# 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);
}
} }
} }
@ -3971,21 +4060,6 @@ sub AppendToFunctions
} }
sub ResetFunctions
{
my %All=CreateAllInput();
# Clear drop down parameters menu
# CParamsCombo->clear();
# Then clear the text
ConstraintLine->setText("");
FunctionsBlock->setText("");
my $Full_T_Block= $All{"Full_T_Block"};
TheoryBlock->setText($Full_T_Block);
}
1; 1;

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">
@ -2985,6 +2985,12 @@
<property name="name"> <property name="name">
<cstring>textMSROutput</cstring> <cstring>textMSROutput</cstring>
</property> </property>
<property name="text">
<string></string>
</property>
<property name="wordWrap">
<enum>WidgetWidth</enum>
</property>
<property name="overwriteMode"> <property name="overwriteMode">
<bool>true</bool> <bool>true</bool>
</property> </property>
@ -3671,282 +3677,561 @@
</attribute> </attribute>
<widget class="QLayoutWidget"> <widget class="QLayoutWidget">
<property name="name"> <property name="name">
<cstring>layout31</cstring> <cstring>layout34</cstring>
</property> </property>
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>5</x> <x>6</x>
<y>5</y> <y>1</y>
<width>545</width> <width>540</width>
<height>350</height> <height>360</height>
</rect> </rect>
</property> </property>
<vbox> <vbox>
<property name="name"> <property name="name">
<cstring>unnamed</cstring> <cstring>unnamed</cstring>
</property> </property>
<widget class="QLabel"> <widget class="QLayoutWidget">
<property name="name"> <property name="name">
<cstring>textLabel2_2</cstring> <cstring>layout33</cstring>
</property>
<property name="palette">
<palette>
<active>
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
<color>
<red>230</red>
<green>240</green>
<blue>249</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>242</red>
<green>247</green>
<blue>252</blue>
</color>
<color>
<red>115</red>
<green>120</green>
<blue>124</blue>
</color>
<color>
<red>154</red>
<green>160</green>
<blue>166</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>127</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>128</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</active>
<disabled>
<color>
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
<color>
<red>230</red>
<green>240</green>
<blue>249</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>115</red>
<green>120</green>
<blue>124</blue>
</color>
<color>
<red>154</red>
<green>160</green>
<blue>166</blue>
</color>
<color>
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>127</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>128</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>238</blue>
</color>
<color>
<red>82</red>
<green>24</green>
<blue>139</blue>
</color>
</disabled>
<inactive>
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
<color>
<red>230</red>
<green>240</green>
<blue>249</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>115</red>
<green>120</green>
<blue>124</blue>
</color>
<color>
<red>154</red>
<green>160</green>
<blue>166</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>127</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>128</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>238</blue>
</color>
<color>
<red>82</red>
<green>24</green>
<blue>139</blue>
</color>
</inactive>
</palette>
</property>
<property name="text">
<string>THEORY Block</string>
</property>
</widget>
<widget class="QTextEdit">
<property name="name">
<cstring>TheoryBlock</cstring>
</property> </property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel" row="0" column="0">
<property name="name">
<cstring>TheoryBlock_Label</cstring>
</property>
<property name="palette">
<palette>
<active>
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
<color>
<red>230</red>
<green>240</green>
<blue>249</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>242</red>
<green>247</green>
<blue>252</blue>
</color>
<color>
<red>115</red>
<green>120</green>
<blue>124</blue>
</color>
<color>
<red>154</red>
<green>160</green>
<blue>166</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>127</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>128</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</active>
<disabled>
<color>
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
<color>
<red>230</red>
<green>240</green>
<blue>249</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>115</red>
<green>120</green>
<blue>124</blue>
</color>
<color>
<red>154</red>
<green>160</green>
<blue>166</blue>
</color>
<color>
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>127</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>128</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>238</blue>
</color>
<color>
<red>82</red>
<green>24</green>
<blue>139</blue>
</color>
</disabled>
<inactive>
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
<color>
<red>230</red>
<green>240</green>
<blue>249</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>115</red>
<green>120</green>
<blue>124</blue>
</color>
<color>
<red>154</red>
<green>160</green>
<blue>166</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>127</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>128</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>238</blue>
</color>
<color>
<red>82</red>
<green>24</green>
<blue>139</blue>
</color>
</inactive>
</palette>
</property>
<property name="text">
<string>THEORY Block</string>
</property>
</widget>
<widget class="QTextEdit" row="1" column="0">
<property name="name">
<cstring>TheoryBlock</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
</widget>
<widget class="QLabel" row="0" column="1">
<property name="name">
<cstring>ParametersList_Label</cstring>
</property>
<property name="palette">
<palette>
<active>
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
<color>
<red>230</red>
<green>240</green>
<blue>249</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>242</red>
<green>247</green>
<blue>252</blue>
</color>
<color>
<red>115</red>
<green>120</green>
<blue>124</blue>
</color>
<color>
<red>154</red>
<green>160</green>
<blue>166</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>127</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>128</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</active>
<disabled>
<color>
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
<color>
<red>230</red>
<green>240</green>
<blue>249</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>115</red>
<green>120</green>
<blue>124</blue>
</color>
<color>
<red>154</red>
<green>160</green>
<blue>166</blue>
</color>
<color>
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>128</red>
<green>128</green>
<blue>128</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>127</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>128</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>238</blue>
</color>
<color>
<red>82</red>
<green>24</green>
<blue>139</blue>
</color>
</disabled>
<inactive>
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
<color>
<red>230</red>
<green>240</green>
<blue>249</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>115</red>
<green>120</green>
<blue>124</blue>
</color>
<color>
<red>154</red>
<green>160</green>
<blue>166</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>127</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>128</blue>
</color>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
<color>
<red>0</red>
<green>0</green>
<blue>238</blue>
</color>
<color>
<red>82</red>
<green>24</green>
<blue>139</blue>
</color>
</inactive>
</palette>
</property>
<property name="text">
<string>Parameters List</string>
</property>
</widget>
<widget class="QTextEdit" row="1" column="1">
<property name="name">
<cstring>ParametersList</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</grid>
</widget> </widget>
<widget class="QLayoutWidget"> <widget class="QLayoutWidget">
<property name="name"> <property name="name">
@ -4293,20 +4578,6 @@
<string></string> <string></string>
</property> </property>
</widget> </widget>
<widget class="QPushButton">
<property name="name">
<cstring>ApplyFunc_2</cstring>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>32767</height>
</size>
</property>
<property name="text">
<string>Apply</string>
</property>
</widget>
<widget class="QPushButton"> <widget class="QPushButton">
<property name="name"> <property name="name">
<cstring>ResetFunc</cstring> <cstring>ResetFunc</cstring>
@ -5078,7 +5349,7 @@
<sender>ResetFunc</sender> <sender>ResetFunc</sender>
<signal>clicked()</signal> <signal>clicked()</signal>
<receiver>MuSRFitform</receiver> <receiver>MuSRFitform</receiver>
<slot>ResetFunctions()</slot> <slot>ActivateShComp()</slot>
</connection> </connection>
</connections> </connections>
<tabstops> <tabstops>
@ -5187,7 +5458,6 @@
<slot>RunSelectionToggle()</slot> <slot>RunSelectionToggle()</slot>
<slot>fileBrowse()</slot> <slot>fileBrowse()</slot>
<slot>AppendToFunctions()</slot> <slot>AppendToFunctions()</slot>
<slot>ResetFunctions()</slot>
</slots> </slots>
<layoutdefaults spacing="6" margin="11"/> <layoutdefaults spacing="6" margin="11"/>
</UI> </UI>

View File

@ -337,6 +337,9 @@ void MuSRFitform::CreateAllInput()
$All{"Paramcomp_ref"}=$Paramcomp_ref; $All{"Paramcomp_ref"}=$Paramcomp_ref;
my @Paramcomp = @$Paramcomp_ref; my @Paramcomp = @$Paramcomp_ref;
# Functions block
$All{"FunctionsBlock"}=FunctionsBlock->text;
# Read initial values of paramets from tabel # Read initial values of paramets from tabel
my $erradd = "d"; my $erradd = "d";
my $minadd = "_min"; my $minadd = "_min";
@ -472,12 +475,13 @@ void MuSRFitform::UpdateMSRFileInitTable()
(my $TBlock_ref, my $FPBlock_ref)=MSR::ExtractBlks(@lines); (my $TBlock_ref, my $FPBlock_ref)=MSR::ExtractBlks(@lines);
my @FPBloc = @$FPBlock_ref; my @FPBloc = @$FPBlock_ref;
# Counter for initialization table (including Alpha, N0 and Bg)
my $PCount=0; my $PCount=0;
foreach my $line (@FPBloc) { foreach my $line (@FPBloc) {
$PCount++; $PCount++;
my @Param=split(/\s+/,$line); my @Param=split(/\s+/,$line);
# Depending on home many elements in @Param determine what they mean # Depending on how many elements in @Param determine what they mean
# 0th element is empty (always) # 0th element is empty (always)
# 1st element is the order (always) # 1st element is the order (always)
# 2nd element is the name (always) # 2nd element is the name (always)
@ -609,7 +613,11 @@ void MuSRFitform::ActivateShComp()
} }
$Component++; $Component++;
} }
# Set theory block in Constraints
TheoryBlock->setText($Full_T_Block); TheoryBlock->setText($Full_T_Block);
# Then clear the text
ConstraintLine->setText("");
FunctionsBlock->setText("");
} }
void MuSRFitform::InitializeTab() void MuSRFitform::InitializeTab()
@ -626,6 +634,10 @@ void MuSRFitform::InitializeTab()
} }
} }
# Initialize Parameters List in function block (constraints).
my $ParametersList="";
ParametersList->setText("");
my %PTable=MSR::PrepParamTable(\%All); my %PTable=MSR::PrepParamTable(\%All);
# Setup the table with the right size # Setup the table with the right size
@ -634,6 +646,9 @@ void MuSRFitform::InitializeTab()
InitParamTable->setNumRows($NParam); InitParamTable->setNumRows($NParam);
} }
# Counter for function block (with out Alpha etc.)
my $ParCount=0;
# Fill the table with labels and values of parametr # Fill the table with labels and values of parametr
for (my $PCount=0;$PCount<$NParam;$PCount++) { for (my $PCount=0;$PCount<$NParam;$PCount++) {
my ($Param,$value,$error,$minvalue,$maxvalue,$RUN) = split(/,/,$PTable{$PCount}); my ($Param,$value,$error,$minvalue,$maxvalue,$RUN) = split(/,/,$PTable{$PCount});
@ -646,6 +661,15 @@ void MuSRFitform::InitializeTab()
InitParamTable->setText($PCount,1,$error); InitParamTable->setText($PCount,1,$error);
InitParamTable->setText($PCount,2,$minvalue); InitParamTable->setText($PCount,2,$minvalue);
InitParamTable->setText($PCount,3,$maxvalue); InitParamTable->setText($PCount,3,$maxvalue);
# 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);
}
} }
} }
@ -822,15 +846,3 @@ void MuSRFitform::AppendToFunctions()
TheoryBlock->setText($Full_T_Block); TheoryBlock->setText($Full_T_Block);
} }
void MuSRFitform::ResetFunctions()
{
my %All=CreateAllInput();
# Clear drop down parameters menu
# CParamsCombo->clear();
# Then clear the text
ConstraintLine->setText("");
FunctionsBlock->setText("");
my $Full_T_Block= $All{"Full_T_Block"};
TheoryBlock->setText($Full_T_Block);
}