Some clean up.

This commit is contained in:
salman 2009-09-01 09:47:45 +00:00
parent d3a40e3aa7
commit 2ba00e09ef
4 changed files with 92 additions and 117 deletions

View File

@ -94,9 +94,6 @@ sub CreateMSR {
my @Paramcomp = @$Paramcomp_ref;
my $TitleLine = $All{"TITLE"}."\n# Run Numbers: ".$All{"RunNumbers"};
$TitleLine =~ s/,/:/g;
# Counter for RUNS
my $iRun = 1;
@ -332,6 +329,31 @@ sub CreateMSR {
# The number of runs is
$NRUNS = $iRun - 1;
# Start constructing all blocks
my $TitleLine = $All{"TITLE"}."\n# Run Numbers: ".$All{"RunNumbers"};
$TitleLine =~ s/,/:/g;
# Get parameter block from MSR::PrepParamTable(\%All);
my $FitParaBlk = "
###################################################################
FITPARAMETER
###################################################################
# No Name Value Err Min Max ";
my %PTable=MSR::PrepParamTable(\%All);
my $NParam=scalar keys( %PTable );
# Fill the table with labels and values of parametr
for (my $PCount=0;$PCount<$NParam;$PCount++) {
my ($Param,$value,$error,$minvalue,$maxvalue) = split(/,/,$PTable{$PCount});
if ( $minvalue == $maxvalue ) {
$minvalue = $EMPTY;
$maxvalue = $EMPTY;
}
$j=$PCount+1;
$FitParaBlk = $FitParaBlk."
$j $Param $value $error $error $minvalue $maxvalue";
}
$Full_T_Block = "
###################################################################
THEORY
@ -399,26 +421,6 @@ phase 8.50";
STATISTIC --- 0000-00-00 00:00:00
*** FIT DID NOT CONVERGE ***";
# Get parameter block from MSR::PrepParamTable(\%All);
my $FitParaBlk = "
###################################################################
FITPARAMETER
###################################################################
# No Name Value Err Min Max ";
my %PTable=MSR::PrepParamTable(\%All);
my $NParam=scalar keys( %PTable );
# Fill the table with labels and values of parametr
for (my $PCount=0;$PCount<$NParam;$PCount++) {
my ($Param,$value,$error,$minvalue,$maxvalue) = split(/,/,$PTable{$PCount});
if ( $minvalue == $maxvalue ) {
$minvalue = $EMPTY;
$maxvalue = $EMPTY;
}
$j=$PCount+1;
$FitParaBlk = $FitParaBlk."
$j $Param $value $error $error $minvalue $maxvalue";
}
# 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";
@ -470,9 +472,6 @@ sub CreateMSRSingleHist {
my @Paramcomp = @$Paramcomp_ref;
my $TitleLine = $All{"TITLE"}."\n# Run Numbers: ".$All{"RunNumbers"};
$TitleLine =~ s/,/:/g;
# Counter for RUNS
my $iRun = 1;
@ -727,6 +726,30 @@ sub CreateMSRSingleHist {
# The number of runs is
$NRUNS = $iRun - 1;
# Start constructing all block
my $TitleLine = $All{"TITLE"}."\n# Run Numbers: ".$All{"RunNumbers"};
$TitleLine =~ s/,/:/g;
# Get parameter block from MSR::PrepParamTable(\%All);
my $FitParaBlk = "
###################################################################
FITPARAMETER
###################################################################
# No Name Value Err Min Max ";
my %PTable=MSR::PrepParamTable(\%All);
my $NParam=scalar keys( %PTable );
# Fill the table with labels and values of parametr
for (my $PCount=0;$PCount<$NParam;$PCount++) {
my ($Param,$value,$error,$minvalue,$maxvalue) = split(/,/,$PTable{$PCount});
if ( $minvalue == $maxvalue ) {
$minvalue = $EMPTY;
$maxvalue = $EMPTY;
}
$j=$PCount+1;
$FitParaBlk = $FitParaBlk."
$j $Param $value $error $error $minvalue $maxvalue";
}
$Full_T_Block = "
###################################################################
THEORY
@ -794,25 +817,6 @@ phase 8.50";
STATISTIC --- 0000-00-00 00:00:00
*** FIT DID NOT CONVERGE ***";
# Get parameter block from MSR::PrepParamTable(\%All);
my $FitParaBlk = "
###################################################################
FITPARAMETER
###################################################################
# No Name Value Err Min Max ";
my %PTable=MSR::PrepParamTable(\%All);
my $NParam=scalar keys( %PTable );
# Fill the table with labels and values of parametr
for (my $PCount=0;$PCount<$NParam;$PCount++) {
my ($Param,$value,$error,$minvalue,$maxvalue) = split(/,/,$PTable{$PCount});
if ( $minvalue == $maxvalue ) {
$minvalue = $EMPTY;
$maxvalue = $EMPTY;
}
$j=$PCount+1;
$FitParaBlk = $FitParaBlk."
$j $Param $value $error $error $minvalue $maxvalue";
}
# 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";

View File

@ -1,6 +1,6 @@
# Form implementation generated from reading ui file 'MuSRFit.ui'
#
# Created: Tue Sep 1 10:53:25 2009
# Created: Tue Sep 1 11:46:17 2009
# by: The PerlQt User Interface Compiler (puic)
#
# WARNING! All changes made in this file will be lost!
@ -106,7 +106,6 @@ use Qt::attributes qw(
ShParam_3_9
InitializationPage
InitParamTable
TableUpdate
FittingPage
textMSROutput
TabPage
@ -885,7 +884,7 @@ sub NEW
InitParamTable->horizontalHeader()->setLabel(InitParamTable->numCols() - 1, trUtf8("Min"));
InitParamTable->setNumCols(InitParamTable->numCols() + 1);
InitParamTable->horizontalHeader()->setLabel(InitParamTable->numCols() - 1, trUtf8("Max"));
InitParamTable->setGeometry( Qt::Rect(5, 5, 545, 325) );
InitParamTable->setGeometry( Qt::Rect(5, 5, 545, 355) );
InitParamTable->setSizePolicy( Qt::SizePolicy(5, 5, 0, 0, InitParamTable->sizePolicy()->hasHeightForWidth()) );
InitParamTable->setMaximumSize( Qt::Size(32767, 32767) );
InitParamTable->setFocusPolicy( &Qt::Table::TabFocus() );
@ -901,17 +900,12 @@ sub NEW
InitParamTable->setShowGrid( 1 );
InitParamTable->setRowMovingEnabled( 0 );
InitParamTable->setFocusStyle( &Qt::Table::SpreadSheet() );
TableUpdate = Qt::PushButton(InitializationPage, "TableUpdate");
TableUpdate->setGeometry( Qt::Rect(460, 335, 90, 30) );
TableUpdate->setMinimumSize( Qt::Size(90, 30) );
TableUpdate->setMaximumSize( Qt::Size(90, 30) );
musrfit_tabs->insertTab( InitializationPage, "" );
FittingPage = Qt::Widget(musrfit_tabs, "FittingPage");
textMSROutput = Qt::TextEdit(FittingPage, "textMSROutput");
textMSROutput->setGeometry( Qt::Rect(5, 5, 545, 365) );
textMSROutput->setGeometry( Qt::Rect(5, 5, 545, 355) );
textMSROutput->setOverwriteMode( 1 );
musrfit_tabs->insertTab( FittingPage, "" );
@ -1270,10 +1264,10 @@ sub NEW
Qt::Object::connect(fileChangeDirAction, SIGNAL "activated()", this, SLOT "fileChangeDir()");
Qt::Object::connect(musrfit_tabs, SIGNAL "selected(const QString&)", this, SLOT "TabChanged()");
Qt::Object::connect(go, SIGNAL "clicked()", this, SLOT "GoFit()");
Qt::Object::connect(TableUpdate, SIGNAL "clicked()", this, SLOT "CallMSRCreate()");
Qt::Object::connect(ShowT0, SIGNAL "clicked()", this, SLOT "ShowMuSRT0()");
Qt::Object::connect(PlotMSR, SIGNAL "clicked()", this, SLOT "GoPlot()");
Qt::Object::connect(BeamLine, SIGNAL "activated(int)", this, SLOT "T0Update()");
Qt::Object::connect(InitParamTable, SIGNAL "valueChanged(int,int)", this, SLOT "CallMSRCreate()");
setTabOrder(musrfit_tabs, TITLE);
setTabOrder(TITLE, FILENAME);
@ -1449,7 +1443,6 @@ sub languageChange
InitParamTable->horizontalHeader()->setLabel( 1, trUtf8("Error") );
InitParamTable->horizontalHeader()->setLabel( 2, trUtf8("Min") );
InitParamTable->horizontalHeader()->setLabel( 3, trUtf8("Max") );
TableUpdate->setText( trUtf8("Update") );
musrfit_tabs->changeTab( InitializationPage, trUtf8("Initialization") );
musrfit_tabs->changeTab( FittingPage, trUtf8("MSR File") );
Minimization->setTitle( trUtf8("Minimization") );
@ -1584,16 +1577,20 @@ sub fileOpen
sub fileSave
{
my %All=CreateAllInput();
my $FILENAME=$All{"FILENAME"}.".msr";
my $file=Qt::FileDialog::getSaveFileName(
"",
"$FILENAME",
"MSR Files (*.msr *.mlog)",
this,
"save file dialog",
"Choose a filename to save under");
my %All=CreateAllInput();
my $FILENAME=$All{"FILENAME"}.".msr";
if (-e $FILENAME) {
# If the user gave a filename the copy to it
print "file-$file\n";
if ($file ne "") {
# TODO: check if the extension is correct, or add it.
if (-e $FILENAME) {
my $cmd="cp $FILENAME $file";
my $pid=system($cmd);
} else {
@ -1602,6 +1599,7 @@ sub fileSave
my $WarningWindow = Qt::MessageBox::information( this, "Warning",$Warning);
}
}
}
}
@ -2067,7 +2065,6 @@ sub InitializeTab
# Setup the table with the right size
my $NParam=scalar keys( %PTable );
# print "Size of P:".$NParam."\n";
if ($NParam>$NRows) {
InitParamTable->setNumRows($NParam);
}

View File

@ -1452,7 +1452,7 @@
<x>5</x>
<y>5</y>
<width>545</width>
<height>325</height>
<height>355</height>
</rect>
</property>
<property name="sizePolicy">
@ -1509,34 +1509,6 @@
<enum>SpreadSheet</enum>
</property>
</widget>
<widget class="QPushButton">
<property name="name">
<cstring>TableUpdate</cstring>
</property>
<property name="geometry">
<rect>
<x>460</x>
<y>335</y>
<width>90</width>
<height>30</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>90</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>90</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>Update</string>
</property>
</widget>
</widget>
<widget class="QWidget">
<property name="name">
@ -1554,7 +1526,7 @@
<x>5</x>
<y>5</y>
<width>545</width>
<height>365</height>
<height>355</height>
</rect>
</property>
<property name="overwriteMode">
@ -2934,12 +2906,6 @@
<receiver>MuSRFitform</receiver>
<slot>GoFit()</slot>
</connection>
<connection>
<sender>TableUpdate</sender>
<signal>clicked()</signal>
<receiver>MuSRFitform</receiver>
<slot>CallMSRCreate()</slot>
</connection>
<connection>
<sender>ShowT0</sender>
<signal>clicked()</signal>
@ -2958,6 +2924,12 @@
<receiver>MuSRFitform</receiver>
<slot>T0Update()</slot>
</connection>
<connection>
<sender>InitParamTable</sender>
<signal>valueChanged(int,int)</signal>
<receiver>MuSRFitform</receiver>
<slot>CallMSRCreate()</slot>
</connection>
</connections>
<tabstops>
<tabstop>musrfit_tabs</tabstop>

View File

@ -47,16 +47,19 @@ void Form1::fileOpen()
void Form1::fileSave()
{
my %All=CreateAllInput();
my $FILENAME=$All{"FILENAME"}.".msr";
my $file=Qt::FileDialog::getSaveFileName(
"",
"$FILENAME",
"MSR Files (*.msr *.mlog)",
this,
"save file dialog",
"Choose a filename to save under");
my %All=CreateAllInput();
my $FILENAME=$All{"FILENAME"}.".msr";
if (-e $FILENAME) {
# If the user gave a filename the copy to it
if ($file ne "") {
# TODO: check if the extension is correct, or add it.
if (-e $FILENAME) {
my $cmd="cp $FILENAME $file";
my $pid=system($cmd);
} else {
@ -65,6 +68,7 @@ void Form1::fileSave()
my $WarningWindow = Qt::MessageBox::information( this, "Warning",$Warning);
}
}
}
}
void MuSRFitform::fileChangeDir()
@ -520,7 +524,6 @@ void MuSRFitform::InitializeTab()
# Setup the table with the right size
my $NParam=scalar keys( %PTable );
# print "Size of P:".$NParam."\n";
if ($NParam>$NRows) {
InitParamTable->setNumRows($NParam);
}
@ -537,7 +540,6 @@ void MuSRFitform::InitializeTab()
}
}
void MuSRFitform::TabChanged()
{
# TODO: First check if there are some runs given, otherwise disbale