More work on Functions block

This commit is contained in:
2010-03-25 15:30:57 +00:00
parent c40244353c
commit db4408e090
4 changed files with 194 additions and 51 deletions

View File

@ -1,6 +1,8 @@
#use strict; #use strict;
package MSR; package MSR;
# This module provides some tools to create, manipulate and extract information from MSR files
my $EMPTY=""; my $EMPTY="";
my $SPACE=" "; my $SPACE=" ";
@ -45,6 +47,8 @@ my $erradd = "d";
my $minadd = "_min"; my $minadd = "_min";
my $maxadd = "_max"; my $maxadd = "_max";
########################################################################## ##########################################################################
# CreateMSR # CreateMSR
# #
@ -111,7 +115,7 @@ sub CreateMSR {
} }
# Proper way # Proper way
if ( $All{"Minimization"} ne "" && $All{"ErrorCalc"} ne "" && $Step ne "PLOT" ) { if ( $All{"Minimization"} ne $EMPTY && $All{"ErrorCalc"} ne $EMPTY && $Step ne "PLOT" ) {
$FITMINTYPE = $All{"Minimization"}."\n".$All{"ErrorCalc"}; $FITMINTYPE = $All{"Minimization"}."\n".$All{"ErrorCalc"};
} }
@ -131,11 +135,11 @@ sub CreateMSR {
# $RUNSType = 0 (Auto) or 1 (Manual) # $RUNSType = 0 (Auto) or 1 (Manual)
my $RUNSType = 0; my $RUNSType = 0;
my @RUNS=(); my @RUNS=();
if ($All{"RunNumbers"} ne "") { if ($All{"RunNumbers"} ne $EMPTY) {
@RUNS=split( /,/, $All{"RunNumbers"}); @RUNS=split( /,/, $All{"RunNumbers"});
$RUNSType = 0; $RUNSType = 0;
} }
elsif ($All{"RunFiles"} ne "") { elsif ($All{"RunFiles"} ne $EMPTY) {
@RUNS=split( /,/, $All{"RunFiles"}); @RUNS=split( /,/, $All{"RunFiles"});
$RUNSType = 1; $RUNSType = 1;
} }
@ -269,13 +273,13 @@ sub CreateMSR {
foreach ("t0","Bg1","Bg2","Data1","Data2") { foreach ("t0","Bg1","Bg2","Data1","Data2") {
$Name = "$_$NHist"; $Name = "$_$NHist";
# If empty fill with defaults # If empty fill with defaults
if ($All{$Name} eq "") { if ($All{$Name} eq $EMPTY) {
$All{$Name}=MSR::T0BgData($_,$Hist,$BeamLine); $All{$Name}=MSR::T0BgData($_,$Hist,$BeamLine);
} }
} }
$Bg_Line = $Bg_Line." ".$All{"Bg1$NHist"}." ".$All{"Bg2$NHist"}; $Bg_Line = $Bg_Line." ".$All{"Bg1$NHist"}." ".$All{"Bg2$NHist"};
$Data_Line =$Data_Line." ".$All{"Data1$NHist"}." ".$All{"Data2$NHist"}; $Data_Line =$Data_Line." ".$All{"Data1$NHist"}." ".$All{"Data2$NHist"};
if ($All{"t0$NHist"} ne "") { if ($All{"t0$NHist"} ne $EMPTY) {
$T0_Line=$T0_Line." ".$All{"Data1$NHist"}; $T0_Line=$T0_Line." ".$All{"Data1$NHist"};
} }
$NHist++; $NHist++;
@ -286,7 +290,6 @@ sub CreateMSR {
if ($T0_Line ne "t0") { if ($T0_Line ne "t0") {
print "I am here\n";
$Data_Line= $Data_Line."\n".$T0_Line; $Data_Line= $Data_Line."\n".$T0_Line;
} }
@ -380,16 +383,19 @@ SAVE
# } # }
} }
my $RRFBlock=MSR::CreateRRFBlock(\%All);
$PLOT_Block = $PLOT_Block =
"############################################################### "###############################################################
PLOT $PLT PLOT $PLT
runs $RUNS_Line runs $RUNS_Line
$PRANGE_Line $PRANGE_Line
$RRFBlock
$logxy"; $logxy";
if ($All{"FUNITS"} eq "") {$All{"FUNITS"}="MHz";} if ($All{"FUNITS"} eq $EMPTY) {$All{"FUNITS"}="MHz";}
if ($All{"FAPODIZATION"} eq "") {$All{"FAPODIZATION"}="STRONG";} if ($All{"FAPODIZATION"} eq $EMPTY) {$All{"FAPODIZATION"}="STRONG";}
if ($All{"FPLOT"} eq "") {$All{"FPLOT"}="POWER";} if ($All{"FPLOT"} eq $EMPTY) {$All{"FPLOT"}="POWER";}
if ($All{"FPHASE"} eq $EMPTY) {$All{"FPHASE"}="8.5";}
$FOURIER_Block= $FOURIER_Block=
@ -399,11 +405,13 @@ units FUNITS # units either 'Gauss', 'MHz', or 'Mc/s'
fourier_power 12 fourier_power 12
apodization FAPODIZATION # NONE, WEAK, MEDIUM, STRONG apodization FAPODIZATION # NONE, WEAK, MEDIUM, STRONG
plot FPLOT # REAL, IMAG, REAL_AND_IMAG, POWER, PHASE plot FPLOT # REAL, IMAG, REAL_AND_IMAG, POWER, PHASE
phase 8.50"; phase FPHASE
#range FRQMIN FRQMAX";
$FOURIER_Block=~ s/FUNITS/$All{"FUNITS"}/g; $FOURIER_Block=~ s/FUNITS/$All{"FUNITS"}/g;
$FOURIER_Block=~ s/FAPODIZATION/$All{"FAPODIZATION"}/g; $FOURIER_Block=~ s/FAPODIZATION/$All{"FAPODIZATION"}/g;
$FOURIER_Block=~ s/FPLOT/$All{"FPLOT"}/g; $FOURIER_Block=~ s/FPLOT/$All{"FPLOT"}/g;
$FOURIER_Block=~ s/FPHASE/$All{"FPHASE"}/g;
# Don't know why but it is needed initially # Don't know why but it is needed initially
$STAT_Block = $STAT_Block =
@ -457,7 +465,7 @@ sub CreateMSRSingleHist {
} }
# Proper way # Proper way
if ( $All{"Minimization"} ne "" && $All{"ErrorCalc"} ne "" && $Step ne "PLOT" ) { if ( $All{"Minimization"} ne $EMPTY && $All{"ErrorCalc"} ne $EMPTY && $Step ne "PLOT" ) {
$FITMINTYPE = $All{"Minimization"}."\n".$All{"ErrorCalc"}; $FITMINTYPE = $All{"Minimization"}."\n".$All{"ErrorCalc"};
} }
@ -476,11 +484,11 @@ sub CreateMSRSingleHist {
# $RUNSType = 0 (Auto) or 1 (Manual) # $RUNSType = 0 (Auto) or 1 (Manual)
my $RUNSType = 0; my $RUNSType = 0;
my @RUNS=(); my @RUNS=();
if ($All{"RunNumbers"} ne "") { if ($All{"RunNumbers"} ne $EMPTY) {
@RUNS=split( /,/, $All{"RunNumbers"}); @RUNS=split( /,/, $All{"RunNumbers"});
$RUNSType = 0; $RUNSType = 0;
} }
elsif ($All{"RunFiles"} ne "") { elsif ($All{"RunFiles"} ne $EMPTY) {
@RUNS=split( /,/, $All{"RunFiles"}); @RUNS=split( /,/, $All{"RunFiles"});
$RUNSType = 1; $RUNSType = 1;
} }
@ -507,6 +515,8 @@ sub CreateMSRSingleHist {
foreach my $RUN (@RUNS) { foreach my $RUN (@RUNS) {
####################################################################### #######################################################################
# 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
# be the same for all histograms
foreach my $Hist (@Hists) { foreach my $Hist (@Hists) {
# Prepare the Parameters and initial values block # Prepare the Parameters and initial values block
@ -626,13 +636,13 @@ sub CreateMSRSingleHist {
foreach ("t0","Bg1","Bg2","Data1","Data2") { foreach ("t0","Bg1","Bg2","Data1","Data2") {
$Name = "$_$Hist"; $Name = "$_$Hist";
# If empty fill with defaults # If empty fill with defaults
if ($All{$Name} eq "") { if ($All{$Name} eq $EMPTY) {
$All{$Name}=MSR::T0BgData($_,$Hist,$BeamLine); $All{$Name}=MSR::T0BgData($_,$Hist,$BeamLine);
} }
} }
$Bg_Line = $Bg_Line." ".$All{"Bg1$Hist"}." ".$All{"Bg2$Hist"}; $Bg_Line = $Bg_Line." ".$All{"Bg1$Hist"}." ".$All{"Bg2$Hist"};
$Data_Line =$Data_Line." ".$All{"Data1$Hist"}." ".$All{"Data2$Hist"}; $Data_Line =$Data_Line." ".$All{"Data1$Hist"}." ".$All{"Data2$Hist"};
if ($All{"t0$Hist"} ne "") { if ($All{"t0$Hist"} ne $EMPTY) {
$Data_Line=$Data_Line."\nt0 ".$All{"t0$Hist"}; $Data_Line=$Data_Line."\nt0 ".$All{"t0$Hist"};
} }
@ -732,16 +742,19 @@ SAVE
# } # }
} }
my $RRFBlock=MSR::CreateRRFBlock(\%All);
$PLOT_Block = $PLOT_Block =
"############################################################### "###############################################################
PLOT $PLT PLOT $PLT
runs $RUNS_Line runs $RUNS_Line
$PRANGE_Line $PRANGE_Line
$RRFBlock
$logxy"; $logxy";
if ($All{"FUNITS"} eq "") {$All{"FUNITS"}="MHz";} if ($All{"FUNITS"} eq $EMPTY) {$All{"FUNITS"}="MHz";}
if ($All{"FAPODIZATION"} eq "") {$All{"FAPODIZATION"}="STRONG";} if ($All{"FAPODIZATION"} eq $EMPTY) {$All{"FAPODIZATION"}="STRONG";}
if ($All{"FPLOT"} eq "") {$All{"FPLOT"}="POWER";} if ($All{"FPLOT"} eq $EMPTY) {$All{"FPLOT"}="POWER";}
if ($All{"FPHASE"} eq $EMPTY) {$All{"FPHASE"}="8.5";}
$FOURIER_Block= $FOURIER_Block=
@ -751,11 +764,13 @@ units FUNITS # units either 'Gauss', 'MHz', or 'Mc/s'
fourier_power 12 fourier_power 12
apodization FAPODIZATION # NONE, WEAK, MEDIUM, STRONG apodization FAPODIZATION # NONE, WEAK, MEDIUM, STRONG
plot FPLOT # REAL, IMAG, REAL_AND_IMAG, POWER, PHASE plot FPLOT # REAL, IMAG, REAL_AND_IMAG, POWER, PHASE
phase 8.50"; phase FPHASE
#range FRQMIN FRQMAX";
$FOURIER_Block=~ s/FUNITS/$All{"FUNITS"}/g; $FOURIER_Block=~ s/FUNITS/$All{"FUNITS"}/g;
$FOURIER_Block=~ s/FAPODIZATION/$All{"FAPODIZATION"}/g; $FOURIER_Block=~ s/FAPODIZATION/$All{"FAPODIZATION"}/g;
$FOURIER_Block=~ s/FPLOT/$All{"FPLOT"}/g; $FOURIER_Block=~ s/FPLOT/$All{"FPLOT"}/g;
$FOURIER_Block=~ s/FPHASE/$All{"FPHASE"}/g;
# Don't know why but it is needed initially # Don't know why but it is needed initially
$STAT_Block = $STAT_Block =
@ -1005,7 +1020,7 @@ sub ExtractBlks {
# Identify different blocks # Identify different blocks
my $i=0; my $i=0;
my $line =""; my $line =$EMPTY;
foreach $line (@file) foreach $line (@file)
{ {
if (grep {/FITPARAMETER/} $line) {$NFITPARAMETERS=$i;} if (grep {/FITPARAMETER/} $line) {$NFITPARAMETERS=$i;}
@ -1103,7 +1118,7 @@ sub PrepParamTable {
"Del_min", "0", "Del_max", "0", "Del_min", "0", "Del_max", "0",
"Sgm", "0.1", "dSgm", "0.01", "Sgm", "0.1", "dSgm", "0.01",
"Sgm_min", "0", "Sgm_max", "0", "Sgm_min", "0", "Sgm_max", "0",
"Aa", "0.1", "dAa", "0.01", "Aa", "60.", "dAa", "0.01",
"Aa_min", "0", "Aa_max", "0", "Aa_min", "0", "Aa_max", "0",
"q", "0.1", "dq", "0.01", "q", "0.1", "dq", "0.01",
"q_min", "0", "q_max", "0", "q_min", "0", "q_max", "0",
@ -1180,7 +1195,7 @@ sub PrepParamTable {
foreach my $Param (@Params) { foreach my $Param (@Params) {
my $Param_ORG = $Param; my $Param_ORG = $Param;
if ( $#FitTypes != 0 && ( $Param ne "Alpha" ) ){ if ( $#FitTypes != 0 && ( $Param ne "Alpha" ) ){
$Param = join( "", $Param, "_", "$Component" ); $Param = join( $EMPTY, $Param, "_", "$Component" );
} }
$Shared = $All{"Sh_$Param"}; $Shared = $All{"Sh_$Param"};
@ -1189,7 +1204,7 @@ sub PrepParamTable {
$Param=$Param."_".$iRun; $Param=$Param."_".$iRun;
# Check if this parameter has been initialized befor. If not take from defaults # Check if this parameter has been initialized befor. If not take from defaults
$value = $All{"$Param"}; $value = $All{"$Param"};
if ( $value ne "" ) { if ( $value ne $EMPTY ) {
$error = $All{"$erradd$Param"}; $error = $All{"$erradd$Param"};
$minvalue = $All{"$Param$minadd"}; $minvalue = $All{"$Param$minadd"};
$maxvalue = $All{"$Param$maxadd"}; $maxvalue = $All{"$Param$maxadd"};
@ -1197,10 +1212,14 @@ sub PrepParamTable {
# I need this although it is already in the MSR.pm module, just for this table # I need this although it is already in the MSR.pm module, just for this table
# We can remove it from the MSR module later... # We can remove it from the MSR module later...
# Or keep in the MSR as function ?? # Or keep in the MSR as function ??
# We have two options here, either take default values or take values of previous
# run if available
# $ParamPrev =~ s/$iRun-1/$iRun/g;
$value = $Defaults{$Param_ORG}; $value = $Defaults{$Param_ORG};
$error = $Defaults{ join( "", $erradd, $Param_ORG ) }; $error = $Defaults{ join( $EMPTY, $erradd, $Param_ORG ) };
$minvalue = $Defaults{ join("", $Param_ORG, $minadd ) }; $minvalue = $Defaults{ join($EMPTY, $Param_ORG, $minadd ) };
$maxvalue = $Defaults{ join("", $Param_ORG, $maxadd ) }; $maxvalue = $Defaults{ join($EMPTY, $Param_ORG, $maxadd ) };
} }
$values=join(",",$Param,$value,$error,$minvalue,$maxvalue,$RUN); $values=join(",",$Param,$value,$error,$minvalue,$maxvalue,$RUN);
$ParTable{$PCount}=$values; $ParTable{$PCount}=$values;
@ -1230,7 +1249,7 @@ sub PrepParamTable {
my $Param_ORG = $Param; my $Param_ORG = $Param;
$Param=$Param.$Hist; $Param=$Param.$Hist;
if ( $#FitTypes != 0 && ( $Param_ORG ne "N0" && $Param_ORG ne "NBg" ) ){ if ( $#FitTypes != 0 && ( $Param_ORG ne "N0" && $Param_ORG ne "NBg" ) ){
$Param = join( "", $Param, "_", "$Component" ); $Param = join( $EMPTY, $Param, "_", "$Component" );
} }
$Shared = $All{"Sh_$Param"}; $Shared = $All{"Sh_$Param"};
@ -1239,7 +1258,7 @@ sub PrepParamTable {
$Param=$Param."_".$iRun; $Param=$Param."_".$iRun;
# Check if this parameter has been initialized befor. If not take from defaults # Check if this parameter has been initialized befor. If not take from defaults
$value = $All{"$Param"}; $value = $All{"$Param"};
if ( $value ne "" ) { if ( $value ne $EMPTY ) {
$error = $All{"$erradd$Param"}; $error = $All{"$erradd$Param"};
$minvalue = $All{"$Param$minadd"}; $minvalue = $All{"$Param$minadd"};
$maxvalue = $All{"$Param$maxadd"}; $maxvalue = $All{"$Param$maxadd"};
@ -1248,9 +1267,9 @@ sub PrepParamTable {
# We can remove it from the MSR module later... # We can remove it from the MSR module later...
# Or keep in the MSR as function ?? # Or keep in the MSR as function ??
$value = $Defaults{$Param_ORG}; $value = $Defaults{$Param_ORG};
$error = $Defaults{ join( "", $erradd, $Param_ORG ) }; $error = $Defaults{ join( $EMPTY, $erradd, $Param_ORG ) };
$minvalue = $Defaults{ join("", $Param_ORG, $minadd ) }; $minvalue = $Defaults{ join($EMPTY, $Param_ORG, $minadd ) };
$maxvalue = $Defaults{ join("", $Param_ORG, $maxadd ) }; $maxvalue = $Defaults{ join($EMPTY, $Param_ORG, $maxadd ) };
} }
$values=join(",",$Param,$value,$error,$minvalue,$maxvalue,$RUN); $values=join(",",$Param,$value,$error,$minvalue,$maxvalue,$RUN);
$ParTable{$PCount}=$values; $ParTable{$PCount}=$values;
@ -1282,7 +1301,7 @@ sub ExportParams {
# First assume nothing is shared # First assume nothing is shared
my $Shared = 0; my $Shared = 0;
my $TABLE=""; my $TABLE=$EMPTY;
my $HEADER="RUN"; my $HEADER="RUN";
my %All = %{$_[0]}; my %All = %{$_[0]};
@ -1341,7 +1360,7 @@ sub ExportParams {
foreach my $Param (@Params) { foreach my $Param (@Params) {
my $Param_ORG = $Param; my $Param_ORG = $Param;
if ( $#FitTypes != 0 && ( $Param ne "Alpha" ) ){ if ( $#FitTypes != 0 && ( $Param ne "Alpha" ) ){
$Param = join( "", $Param, "_", "$Component" ); $Param = join( $EMPTY, $Param, "_", "$Component" );
} }
# $All{"Header"} - 0/1 for with/without header # $All{"Header"} - 0/1 for with/without header
if ($All{"Header"} && $iRun == 1) { if ($All{"Header"} && $iRun == 1) {
@ -1390,7 +1409,7 @@ sub ExportParams {
my $Param_ORG = $Param; my $Param_ORG = $Param;
$Param=$Param.$Hist; $Param=$Param.$Hist;
if ( $#FitTypes != 0 && ( $Param_ORG ne "N0" && $Param_ORG ne "NBg" ) ){ if ( $#FitTypes != 0 && ( $Param_ORG ne "N0" && $Param_ORG ne "NBg" ) ){
$Param = join( "", $Param, "_", "$Component" ); $Param = join( $EMPTY, $Param, "_", "$Component" );
} }
$Shared = $All{"Sh_$Param"}; $Shared = $All{"Sh_$Param"};
@ -1466,12 +1485,11 @@ sub MSR2Dat {
foreach (sort { $RUN{$a} <=> $RUN{$b}} keys %RUN ) { foreach (sort { $RUN{$a} <=> $RUN{$b}} keys %RUN ) {
@RunParams=(); @RunParams=();
$NP=0; $NP=0;
# print $_."=".$MAP{$_}."\n";
@tmp=split(/\s+/,$MAP{$_}); @tmp=split(/\s+/,$MAP{$_});
# Remove first element (map) # Remove first element (map)
shift(@tmp); shift(@tmp);
foreach (@tmp) { foreach (@tmp) {
if ($_ ne "" && $_>0 ) { if ($_ ne $EMPTY && $_>0 ) {
@RunParams=(@RunParams,$_); @RunParams=(@RunParams,$_);
$NP++; $NP++;
} }
@ -1612,6 +1630,28 @@ sub RUNFileNameMan {
return $RUN_Line; return $RUN_Line;
} }
########################
# ExtractInfoLEM
########################
# This creates the RRF related lines, these are the same always
sub CreateRRFBlock {
my %All = %{$_[0]};
$RRFBlock="";
if ($All{"RRFFrq"}!= 0) {
if ($All{"RRFPhase"} eq $EMPTY) {$All{"RRFPhase"}=0;}
if ($All{"RRFPack"} eq $EMPTY) {$All{"RRFPack"}=1;}
$RRFBlock="rrf_freq ".$All{"RRFFrq"}." ".$All{"RRFUnits"}."\n";
$RRFBlock=$RRFBlock."rrf_phase ".$All{"RRFPhase"}."\n";
$RRFBlock=$RRFBlock."rrf_packing ".$All{"RRFPack"}."\n";
}
return $RRFBlock;
}
######################## ########################
# ExtractInfoLEM # ExtractInfoLEM
######################## ########################
@ -1696,4 +1736,6 @@ sub ExtractInfoBulk {
} }
1; 1;

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: Fri Oct 9 23:56:08 2009 # Created: Thu Mar 25 16:29:56 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,7 +42,8 @@ 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
@ -188,6 +189,9 @@ use Qt::attributes qw(
AddConstraint AddConstraint
textLabel2_2_3_4 textLabel2_2_3_4
FunctionsBlock FunctionsBlock
textLabel1_6
ApplyFunc_2
ResetFunc
MenuBar MenuBar
fileMenu fileMenu
Edit Edit
@ -1578,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(23, 270) ); setMinimumSize(Qt::Size(21, 275) );
setIcon($image0 ); setIcon($image0 );
setCentralWidget(Qt::Widget(this, "qt_central_widget")); setCentralWidget(Qt::Widget(this, "qt_central_widget"));
@ -2458,8 +2462,8 @@ 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, 355) ); $LayoutWidget_16->setGeometry( Qt::Rect(5, 5, 545, 350) );
my $layout29_4 = Qt::VBoxLayout($LayoutWidget_16, 11, 6, '$layout29_4'); my $layout31_2 = Qt::VBoxLayout($LayoutWidget_16, 11, 6, '$layout31_2');
textLabel2_2 = Qt::Label($LayoutWidget_16, "textLabel2_2"); textLabel2_2 = Qt::Label($LayoutWidget_16, "textLabel2_2");
$cg->setColor(&Qt::ColorGroup::Foreground, &black); $cg->setColor(&Qt::ColorGroup::Foreground, &black);
@ -2514,10 +2518,10 @@ 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->setPalette( $pal ); textLabel2_2->setPalette( $pal );
$layout29_4->addWidget(textLabel2_2); $layout31_2->addWidget(textLabel2_2);
TheoryBlock = Qt::TextEdit($LayoutWidget_16, "TheoryBlock"); TheoryBlock = Qt::TextEdit($LayoutWidget_16, "TheoryBlock");
$layout29_4->addWidget(TheoryBlock); $layout31_2->addWidget(TheoryBlock);
my $layout25_6 = Qt::HBoxLayout(undef, 0, 6, '$layout25_6'); my $layout25_6 = Qt::HBoxLayout(undef, 0, 6, '$layout25_6');
@ -2536,7 +2540,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);
$layout29_4->addLayout($layout25_6); $layout31_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);
@ -2591,10 +2595,24 @@ 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 );
$layout29_4->addWidget(textLabel2_2_3_4); $layout31_2->addWidget(textLabel2_2_3_4);
FunctionsBlock = Qt::TextEdit($LayoutWidget_16, "FunctionsBlock"); FunctionsBlock = Qt::TextEdit($LayoutWidget_16, "FunctionsBlock");
$layout29_4->addWidget(FunctionsBlock); $layout31_2->addWidget(FunctionsBlock);
my $layout30 = Qt::HBoxLayout(undef, 0, 6, '$layout30');
textLabel1_6 = Qt::Label($LayoutWidget_16, "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->setMaximumSize( Qt::Size(100, 32767) );
$layout30->addWidget(ResetFunc);
$layout31_2->addLayout($layout30);
musrfit_tabs->insertTab( ConstPage, "" ); musrfit_tabs->insertTab( ConstPage, "" );
fileNewAction= Qt::Action(this, "fileNewAction"); fileNewAction= Qt::Action(this, "fileNewAction");
@ -2757,6 +2775,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()");
setTabOrder(musrfit_tabs, RunNumbers); setTabOrder(musrfit_tabs, RunNumbers);
setTabOrder(RunNumbers, BeamLine); setTabOrder(RunNumbers, BeamLine);
@ -3041,6 +3060,9 @@ sub languageChange
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 );
ApplyFunc_2->setText( trUtf8("Apply") );
ResetFunc->setText( trUtf8("Reset") );
musrfit_tabs->changeTab( ConstPage, trUtf8("Constraints") ); musrfit_tabs->changeTab( ConstPage, trUtf8("Constraints") );
fileNewAction->setText( trUtf8("&New") ); fileNewAction->setText( trUtf8("&New") );
fileNewAction->setMenuText( trUtf8("&New") ); fileNewAction->setMenuText( trUtf8("&New") );
@ -3949,6 +3971,20 @@ sub AppendToFunctions
} }
sub ResetFunctions
{
# 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

@ -22,8 +22,8 @@
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>23</width> <width>21</width>
<height>270</height> <height>275</height>
</size> </size>
</property> </property>
<property name="caption"> <property name="caption">
@ -3671,19 +3671,19 @@
</attribute> </attribute>
<widget class="QLayoutWidget"> <widget class="QLayoutWidget">
<property name="name"> <property name="name">
<cstring>layout29_4</cstring> <cstring>layout31</cstring>
</property> </property>
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>5</x> <x>5</x>
<y>5</y> <y>5</y>
<width>545</width> <width>545</width>
<height>355</height> <height>350</height>
</rect> </rect>
</property> </property>
<vbox> <vbox>
<property name="name"> <property name="name">
<cstring>unnamed_2</cstring> <cstring>unnamed</cstring>
</property> </property>
<widget class="QLabel"> <widget class="QLabel">
<property name="name"> <property name="name">
@ -4277,6 +4277,52 @@
<cstring>FunctionsBlock</cstring> <cstring>FunctionsBlock</cstring>
</property> </property>
</widget> </widget>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout30</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<property name="name">
<cstring>textLabel1_6</cstring>
</property>
<property name="text">
<string></string>
</property>
</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">
<property name="name">
<cstring>ResetFunc</cstring>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>32767</height>
</size>
</property>
<property name="text">
<string>Reset</string>
</property>
</widget>
</hbox>
</widget>
</vbox> </vbox>
</widget> </widget>
</widget> </widget>
@ -5028,6 +5074,12 @@
<receiver>MuSRFitform</receiver> <receiver>MuSRFitform</receiver>
<slot>AppendToFunctions()</slot> <slot>AppendToFunctions()</slot>
</connection> </connection>
<connection>
<sender>ResetFunc</sender>
<signal>clicked()</signal>
<receiver>MuSRFitform</receiver>
<slot>ResetFunctions()</slot>
</connection>
</connections> </connections>
<tabstops> <tabstops>
<tabstop>musrfit_tabs</tabstop> <tabstop>musrfit_tabs</tabstop>
@ -5135,6 +5187,7 @@
<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

@ -821,3 +821,15 @@ void MuSRFitform::AppendToFunctions()
$Full_T_Block=~ s/$ParName/fun$i/; $Full_T_Block=~ s/$ParName/fun$i/;
TheoryBlock->setText($Full_T_Block); TheoryBlock->setText($Full_T_Block);
} }
void MuSRFitform::ResetFunctions()
{
# 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);
}