Begin implementation of export fit paramets.
This commit is contained in:
139
src/external/MuSRFitGUI/MSR.pm
vendored
139
src/external/MuSRFitGUI/MSR.pm
vendored
@ -1226,6 +1226,145 @@ sub PrepParamTable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
########################
|
||||||
|
# ExportParams
|
||||||
|
# Function return a tab separated table of parameters for the fit
|
||||||
|
# input should be
|
||||||
|
# %All
|
||||||
|
########################
|
||||||
|
sub ExportParams {
|
||||||
|
my $erradd = "d";
|
||||||
|
my $minadd = "_min";
|
||||||
|
my $maxadd = "_max";
|
||||||
|
|
||||||
|
# First assume nothing is shared
|
||||||
|
my $Shared = 0;
|
||||||
|
|
||||||
|
my $TABLE="";
|
||||||
|
|
||||||
|
my %All = %{$_[0]};
|
||||||
|
my @RUNS = ();
|
||||||
|
if ($All{"RUNSType"}) {
|
||||||
|
@RUNS = split( /,/, $All{"RunFiles"} );
|
||||||
|
} else {
|
||||||
|
@RUNS = split( /,/, $All{"RunNumbers"} );
|
||||||
|
}
|
||||||
|
my @Hists = split( /,/, $All{"LRBF"} );
|
||||||
|
|
||||||
|
my @FitTypes =();
|
||||||
|
foreach my $FitType ($All{"FitType1"}, $All{"FitType2"}, $All{"FitType3"}) {
|
||||||
|
if ( $FitType ne "None" ) { push( @FitTypes, $FitType ); }
|
||||||
|
}
|
||||||
|
# Get theory block 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"};
|
||||||
|
|
||||||
|
# Extract parameter block form the MSR file
|
||||||
|
# my $FILENAME=$All{"FILENAME"};
|
||||||
|
# open (MSRF,q{<},"$FILENAME.msr" );
|
||||||
|
# my @lines = <MSRF>;
|
||||||
|
# close(IFILE);
|
||||||
|
# my $FPBlock_ref=MSR::ExtractParamBlk(@lines);
|
||||||
|
# my @FPBloc = @$FPBlock_ref;
|
||||||
|
|
||||||
|
# Then loop over expected parameters and extract their values and error bar
|
||||||
|
my $PCount =0;
|
||||||
|
my $iRun =0;
|
||||||
|
my $value =0;
|
||||||
|
my $error = 0;
|
||||||
|
my $minvalue = 0;
|
||||||
|
my $maxvalue = 0;
|
||||||
|
my $Component=1;
|
||||||
|
|
||||||
|
foreach my $RUN (@RUNS) {
|
||||||
|
my $line="$RUN";
|
||||||
|
$iRun++;
|
||||||
|
$Component=1;
|
||||||
|
if ($All{"FitAsyType"} eq "Asymmetry") {
|
||||||
|
foreach my $FitType (@FitTypes) {
|
||||||
|
my $Parameters=$Paramcomp[$Component-1];
|
||||||
|
my @Params = split( /\s+/, $Parameters );
|
||||||
|
if ( $Component == 1 ) {
|
||||||
|
unshift( @Params, "Alpha" );
|
||||||
|
}
|
||||||
|
|
||||||
|
# This is the counter for parameters of this component
|
||||||
|
my $NP=1;
|
||||||
|
$Shared = 0;
|
||||||
|
# Change state/label of parameters
|
||||||
|
foreach my $Param (@Params) {
|
||||||
|
my $Param_ORG = $Param;
|
||||||
|
if ( $#FitTypes != 0 && ( $Param ne "Alpha" ) ){
|
||||||
|
$Param = join( "", $Param, "_", "$Component" );
|
||||||
|
}
|
||||||
|
|
||||||
|
$Shared = $All{"Sh_$Param"};
|
||||||
|
if ( $Shared!=1 || $iRun == 1 ) {
|
||||||
|
# It there are multiple runs index the parameters accordingly
|
||||||
|
$Param=$Param."_".$iRun;
|
||||||
|
# Check if this parameter has been initialized befor. (should be)
|
||||||
|
$value = $All{"$Param"};
|
||||||
|
$error = $All{"$erradd$Param"};
|
||||||
|
|
||||||
|
$line=join("\t",$line,$value,$error);
|
||||||
|
$PCount++;
|
||||||
|
}
|
||||||
|
$NP++;
|
||||||
|
}
|
||||||
|
$Component++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elsif ($All{"FitAsyType"} eq "SingleHist") {
|
||||||
|
# For a single histogram fit we basically need to repeat this for each hist
|
||||||
|
foreach my $Hist (@Hists) {
|
||||||
|
$Component=1;
|
||||||
|
foreach my $FitType (@FitTypes) {
|
||||||
|
my $Parameters=$Paramcomp[$Component-1];
|
||||||
|
my @Params = split( /\s+/, $Parameters );
|
||||||
|
if ( $Component == 1 ) {
|
||||||
|
unshift( @Params, ( "N0", "NBg" ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
# This is the counter for parameters of this component
|
||||||
|
my $NP=1;
|
||||||
|
$Shared = 0;
|
||||||
|
# Change state/label of parameters
|
||||||
|
foreach my $Param (@Params) {
|
||||||
|
my $Param_ORG = $Param;
|
||||||
|
$Param=$Param.$Hist;
|
||||||
|
if ( $#FitTypes != 0 && ( $Param_ORG ne "N0" && $Param_ORG ne "NBg" ) ){
|
||||||
|
$Param = join( "", $Param, "_", "$Component" );
|
||||||
|
}
|
||||||
|
|
||||||
|
$Shared = $All{"Sh_$Param"};
|
||||||
|
if ( $Shared!=1 || $iRun == 1 ) {
|
||||||
|
# It there are multiple runs index the parameters accordingly
|
||||||
|
$Param=$Param."_".$iRun;
|
||||||
|
# Check if this parameter has been initialized befor. (should be)
|
||||||
|
$value = $All{"$Param"};
|
||||||
|
$error = $All{"$erradd$Param"};
|
||||||
|
$minvalue = $All{"$Param$minadd"};
|
||||||
|
$maxvalue = $All{"$Param$maxadd"};
|
||||||
|
|
||||||
|
$values=join("\t",$Param,$value,$error,$minvalue,$maxvalue,$RUN);
|
||||||
|
$ParTable{$PCount}=$values;
|
||||||
|
$PCount++;
|
||||||
|
}
|
||||||
|
$NP++;
|
||||||
|
}
|
||||||
|
$Component++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$TABLE=$TABLE."$line\n"
|
||||||
|
}
|
||||||
|
return $TABLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
########################
|
########################
|
||||||
# RUNFileNameAuto
|
# RUNFileNameAuto
|
||||||
# Function return the RUN_Line for a given RUN
|
# Function return the RUN_Line for a given RUN
|
||||||
|
89
src/external/MuSRFitGUI/MuSRFit.pl
vendored
89
src/external/MuSRFitGUI/MuSRFit.pl
vendored
@ -1,6 +1,6 @@
|
|||||||
# Form implementation generated from reading ui file 'MuSRFit.ui'
|
# Form implementation generated from reading ui file 'MuSRFit.ui'
|
||||||
#
|
#
|
||||||
# Created: Thu Sep 10 08:22:47 2009
|
# Created: Sun Sep 13 23:09:01 2009
|
||||||
# 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!
|
||||||
@ -19,6 +19,8 @@ use Qt::slots
|
|||||||
fileChangeDir => [],
|
fileChangeDir => [],
|
||||||
filePrint => [],
|
filePrint => [],
|
||||||
fileExit => [],
|
fileExit => [],
|
||||||
|
parametersExport => [],
|
||||||
|
parametersAppend => [],
|
||||||
editUndo => [],
|
editUndo => [],
|
||||||
editRedo => [],
|
editRedo => [],
|
||||||
editCut => [],
|
editCut => [],
|
||||||
@ -179,6 +181,7 @@ use Qt::attributes qw(
|
|||||||
ShowT0
|
ShowT0
|
||||||
MenuBar
|
MenuBar
|
||||||
fileMenu
|
fileMenu
|
||||||
|
Parameters
|
||||||
editMenu
|
editMenu
|
||||||
Options
|
Options
|
||||||
helpMenu
|
helpMenu
|
||||||
@ -206,6 +209,8 @@ use Qt::attributes qw(
|
|||||||
Action_2
|
Action_2
|
||||||
Action_3
|
Action_3
|
||||||
optionsnew_itemAction
|
optionsnew_itemAction
|
||||||
|
parametersExport_AsAction
|
||||||
|
parametersAppend_ToAction
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -1513,6 +1518,8 @@ sub NEW
|
|||||||
Action_2= Qt::Action(this, "Action_2");
|
Action_2= Qt::Action(this, "Action_2");
|
||||||
Action_3= Qt::Action(this, "Action_3");
|
Action_3= Qt::Action(this, "Action_3");
|
||||||
optionsnew_itemAction= Qt::Action(this, "optionsnew_itemAction");
|
optionsnew_itemAction= Qt::Action(this, "optionsnew_itemAction");
|
||||||
|
parametersExport_AsAction= Qt::Action(this, "parametersExport_AsAction");
|
||||||
|
parametersAppend_ToAction= Qt::Action(this, "parametersAppend_ToAction");
|
||||||
|
|
||||||
|
|
||||||
toolBar = Qt::ToolBar("", this, &DockTop);
|
toolBar = Qt::ToolBar("", this, &DockTop);
|
||||||
@ -1538,6 +1545,11 @@ sub NEW
|
|||||||
fileExitAction->addTo( fileMenu );
|
fileExitAction->addTo( fileMenu );
|
||||||
MenuBar->insertItem( "", fileMenu, 2 );
|
MenuBar->insertItem( "", fileMenu, 2 );
|
||||||
|
|
||||||
|
Parameters = Qt::PopupMenu( this );
|
||||||
|
parametersExport_AsAction->addTo( Parameters );
|
||||||
|
parametersAppend_ToAction->addTo( Parameters );
|
||||||
|
MenuBar->insertItem( "", Parameters, 3 );
|
||||||
|
|
||||||
editMenu = Qt::PopupMenu( this );
|
editMenu = Qt::PopupMenu( this );
|
||||||
editUndoAction->addTo( editMenu );
|
editUndoAction->addTo( editMenu );
|
||||||
editRedoAction->addTo( editMenu );
|
editRedoAction->addTo( editMenu );
|
||||||
@ -1545,21 +1557,21 @@ sub NEW
|
|||||||
editCutAction->addTo( editMenu );
|
editCutAction->addTo( editMenu );
|
||||||
editCopyAction->addTo( editMenu );
|
editCopyAction->addTo( editMenu );
|
||||||
editPasteAction->addTo( editMenu );
|
editPasteAction->addTo( editMenu );
|
||||||
MenuBar->insertItem( "", editMenu, 3 );
|
MenuBar->insertItem( "", editMenu, 4 );
|
||||||
|
|
||||||
Options = Qt::PopupMenu( this );
|
Options = Qt::PopupMenu( this );
|
||||||
FileExistCheck->addTo( Options );
|
FileExistCheck->addTo( Options );
|
||||||
ManualFile->addTo( Options );
|
ManualFile->addTo( Options );
|
||||||
MenuBar->insertItem( "", Options, 4 );
|
MenuBar->insertItem( "", Options, 5 );
|
||||||
|
|
||||||
helpMenu = Qt::PopupMenu( this );
|
helpMenu = Qt::PopupMenu( this );
|
||||||
helpContentsAction->addTo( helpMenu );
|
helpContentsAction->addTo( helpMenu );
|
||||||
helpIndexAction->addTo( helpMenu );
|
helpIndexAction->addTo( helpMenu );
|
||||||
helpMenu->insertSeparator();
|
helpMenu->insertSeparator();
|
||||||
helpAboutAction->addTo( helpMenu );
|
helpAboutAction->addTo( helpMenu );
|
||||||
MenuBar->insertItem( "", helpMenu, 5 );
|
MenuBar->insertItem( "", helpMenu, 6 );
|
||||||
|
|
||||||
MenuBar->insertSeparator( 6 );
|
MenuBar->insertSeparator( 7 );
|
||||||
|
|
||||||
languageChange();
|
languageChange();
|
||||||
my $resize = Qt::Size(579, 501);
|
my $resize = Qt::Size(579, 501);
|
||||||
@ -1590,6 +1602,8 @@ sub NEW
|
|||||||
Qt::Object::connect(PlotMSR_2, SIGNAL "pressed()", this, SLOT "GoPlot()");
|
Qt::Object::connect(PlotMSR_2, SIGNAL "pressed()", this, SLOT "GoPlot()");
|
||||||
Qt::Object::connect(Browse, SIGNAL "clicked()", this, SLOT "fileBrowse()");
|
Qt::Object::connect(Browse, SIGNAL "clicked()", this, SLOT "fileBrowse()");
|
||||||
Qt::Object::connect(BeamLine, SIGNAL "activated(int)", this, SLOT "T0Update()");
|
Qt::Object::connect(BeamLine, SIGNAL "activated(int)", this, SLOT "T0Update()");
|
||||||
|
Qt::Object::connect(parametersExport_AsAction, SIGNAL "activated()", this, SLOT "parametersExport()");
|
||||||
|
Qt::Object::connect(parametersAppend_ToAction, SIGNAL "activated()", this, SLOT "parametersAppend()");
|
||||||
|
|
||||||
setTabOrder(musrfit_tabs, RunNumbers);
|
setTabOrder(musrfit_tabs, RunNumbers);
|
||||||
setTabOrder(RunNumbers, BeamLine);
|
setTabOrder(RunNumbers, BeamLine);
|
||||||
@ -1883,8 +1897,8 @@ sub languageChange
|
|||||||
fileOpenAction->setText( trUtf8("&Open MSR...") );
|
fileOpenAction->setText( trUtf8("&Open MSR...") );
|
||||||
fileOpenAction->setMenuText( trUtf8("&Open MSR...") );
|
fileOpenAction->setMenuText( trUtf8("&Open MSR...") );
|
||||||
fileOpenAction->setAccel( Qt::KeySequence( trUtf8("Ctrl+O") ) );
|
fileOpenAction->setAccel( Qt::KeySequence( trUtf8("Ctrl+O") ) );
|
||||||
fileSaveAction->setText( trUtf8("&Save MSR") );
|
fileSaveAction->setText( trUtf8("&Save MSR...") );
|
||||||
fileSaveAction->setMenuText( trUtf8("&Save MSR") );
|
fileSaveAction->setMenuText( trUtf8("&Save MSR...") );
|
||||||
fileSaveAction->setStatusTip( trUtf8("&Save MSR") );
|
fileSaveAction->setStatusTip( trUtf8("&Save MSR") );
|
||||||
fileSaveAction->setAccel( Qt::KeySequence( trUtf8("Ctrl+S") ) );
|
fileSaveAction->setAccel( Qt::KeySequence( trUtf8("Ctrl+S") ) );
|
||||||
fileSaveAsAction->setText( trUtf8("Save MSR &As...") );
|
fileSaveAsAction->setText( trUtf8("Save MSR &As...") );
|
||||||
@ -1939,11 +1953,16 @@ sub languageChange
|
|||||||
Action_3->setText( trUtf8("Unnamed") );
|
Action_3->setText( trUtf8("Unnamed") );
|
||||||
optionsnew_itemAction->setText( trUtf8("new item") );
|
optionsnew_itemAction->setText( trUtf8("new item") );
|
||||||
optionsnew_itemAction->setMenuText( trUtf8("new item") );
|
optionsnew_itemAction->setMenuText( trUtf8("new item") );
|
||||||
|
parametersExport_AsAction->setText( trUtf8("&Export As...") );
|
||||||
|
parametersExport_AsAction->setMenuText( trUtf8("&Export As...") );
|
||||||
|
parametersAppend_ToAction->setText( trUtf8("&Append To...") );
|
||||||
|
parametersAppend_ToAction->setMenuText( trUtf8("&Append To...") );
|
||||||
toolBar->setLabel( trUtf8("Tools") );
|
toolBar->setLabel( trUtf8("Tools") );
|
||||||
MenuBar->findItem( 2 )->setText( trUtf8("&File") );
|
MenuBar->findItem( 2 )->setText( trUtf8("&File") );
|
||||||
MenuBar->findItem( 3 )->setText( trUtf8("&Edit") );
|
MenuBar->findItem( 3 )->setText( trUtf8("Parameters") );
|
||||||
MenuBar->findItem( 4 )->setText( trUtf8("Options") );
|
MenuBar->findItem( 4 )->setText( trUtf8("&Edit") );
|
||||||
MenuBar->findItem( 5 )->setText( trUtf8("&Help") );
|
MenuBar->findItem( 5 )->setText( trUtf8("Options") );
|
||||||
|
MenuBar->findItem( 6 )->setText( trUtf8("&Help") );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2018,6 +2037,54 @@ sub fileExit
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub parametersExport
|
||||||
|
{
|
||||||
|
|
||||||
|
my %All=CreateAllInput();
|
||||||
|
my $FILENAME=$All{"FILENAME"}.".dat";
|
||||||
|
my $file=Qt::FileDialog::getSaveFileName(
|
||||||
|
"$FILENAME",
|
||||||
|
"Data Files (*.dat)",
|
||||||
|
this,
|
||||||
|
"export file dialog",
|
||||||
|
"Choose a filename to export to");
|
||||||
|
|
||||||
|
# If the user gave a filename the copy to it
|
||||||
|
if ($file ne "") {
|
||||||
|
my $Text = MSR::ExportParams(\%All);
|
||||||
|
print $Text;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
sub parametersAppend
|
||||||
|
{
|
||||||
|
|
||||||
|
my %All=CreateAllInput();
|
||||||
|
my $FILENAME=$All{"FILENAME"}.".dat";
|
||||||
|
my $file=Qt::FileDialog::getOpneFileName(
|
||||||
|
"./",
|
||||||
|
"Data Files (*.dat)",
|
||||||
|
this,
|
||||||
|
"append file dialog",
|
||||||
|
"Choose a filename to append to");
|
||||||
|
|
||||||
|
# If the user gave a filename the copy to it
|
||||||
|
if ($file ne "") {
|
||||||
|
if (-e $FILENAME) {
|
||||||
|
my $Text = MSR::ExportParams(\%All);
|
||||||
|
print $Text;
|
||||||
|
} else {
|
||||||
|
if ($file ne "") {
|
||||||
|
my $Warning = "Warning: No data file found yet!";
|
||||||
|
my $WarningWindow = Qt::MessageBox::information( this, "Warning",$Warning);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MSR::ExportParams(\%All);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
sub editUndo
|
sub editUndo
|
||||||
{
|
{
|
||||||
print "MuSRFitform->editUndo(): Not implemented yet.\n";
|
print "MuSRFitform->editUndo(): Not implemented yet.\n";
|
||||||
@ -2168,7 +2235,7 @@ sub CreateAllInput
|
|||||||
$All{"Paramcomp_ref"}=$Paramcomp_ref;
|
$All{"Paramcomp_ref"}=$Paramcomp_ref;
|
||||||
my @Paramcomp = @$Paramcomp_ref;
|
my @Paramcomp = @$Paramcomp_ref;
|
||||||
|
|
||||||
# TODO: 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";
|
||||||
my $maxadd = "_max";
|
my $maxadd = "_max";
|
||||||
|
48
src/external/MuSRFitGUI/MuSRFit.ui
vendored
48
src/external/MuSRFitGUI/MuSRFit.ui
vendored
@ -22,8 +22,8 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>21</width>
|
<width>23</width>
|
||||||
<height>227</height>
|
<height>246</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="caption">
|
<property name="caption">
|
||||||
@ -3905,6 +3905,10 @@
|
|||||||
<separator/>
|
<separator/>
|
||||||
<action name="fileExitAction"/>
|
<action name="fileExitAction"/>
|
||||||
</item>
|
</item>
|
||||||
|
<item text="Parameters" name="Parameters">
|
||||||
|
<action name="parametersExport_AsAction"/>
|
||||||
|
<action name="parametersAppend_ToAction"/>
|
||||||
|
</item>
|
||||||
<item text="&Edit" name="editMenu">
|
<item text="&Edit" name="editMenu">
|
||||||
<action name="editUndoAction"/>
|
<action name="editUndoAction"/>
|
||||||
<action name="editRedoAction"/>
|
<action name="editRedoAction"/>
|
||||||
@ -3986,10 +3990,10 @@
|
|||||||
<iconset>image3</iconset>
|
<iconset>image3</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Save MSR</string>
|
<string>&Save MSR...</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="menuText">
|
<property name="menuText">
|
||||||
<string>&Save MSR</string>
|
<string>&Save MSR...</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="statusTip">
|
<property name="statusTip">
|
||||||
<string>&Save MSR</string>
|
<string>&Save MSR</string>
|
||||||
@ -4308,6 +4312,28 @@
|
|||||||
<string>new item</string>
|
<string>new item</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action>
|
||||||
|
<property name="name">
|
||||||
|
<cstring>parametersExport_AsAction</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Export As...</string>
|
||||||
|
</property>
|
||||||
|
<property name="menuText">
|
||||||
|
<string>&Export As...</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action>
|
||||||
|
<property name="name">
|
||||||
|
<cstring>parametersAppend_ToAction</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Append To...</string>
|
||||||
|
</property>
|
||||||
|
<property name="menuText">
|
||||||
|
<string>&Append To...</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</actions>
|
</actions>
|
||||||
<images>
|
<images>
|
||||||
<image name="image0">
|
<image name="image0">
|
||||||
@ -4483,6 +4509,18 @@
|
|||||||
<receiver>MuSRFitform</receiver>
|
<receiver>MuSRFitform</receiver>
|
||||||
<slot>T0Update()</slot>
|
<slot>T0Update()</slot>
|
||||||
</connection>
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>parametersExport_AsAction</sender>
|
||||||
|
<signal>activated()</signal>
|
||||||
|
<receiver>MuSRFitform</receiver>
|
||||||
|
<slot>parametersExport()</slot>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>parametersAppend_ToAction</sender>
|
||||||
|
<signal>activated()</signal>
|
||||||
|
<receiver>MuSRFitform</receiver>
|
||||||
|
<slot>parametersAppend()</slot>
|
||||||
|
</connection>
|
||||||
</connections>
|
</connections>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>musrfit_tabs</tabstop>
|
<tabstop>musrfit_tabs</tabstop>
|
||||||
@ -4573,6 +4611,8 @@
|
|||||||
<slot>fileChangeDir()</slot>
|
<slot>fileChangeDir()</slot>
|
||||||
<slot>filePrint()</slot>
|
<slot>filePrint()</slot>
|
||||||
<slot>fileExit()</slot>
|
<slot>fileExit()</slot>
|
||||||
|
<slot>parametersExport()</slot>
|
||||||
|
<slot>parametersAppend()</slot>
|
||||||
<slot>editUndo()</slot>
|
<slot>editUndo()</slot>
|
||||||
<slot>editRedo()</slot>
|
<slot>editRedo()</slot>
|
||||||
<slot>editCut()</slot>
|
<slot>editCut()</slot>
|
||||||
|
47
src/external/MuSRFitGUI/MuSRFit.ui.h
vendored
47
src/external/MuSRFitGUI/MuSRFit.ui.h
vendored
@ -93,6 +93,51 @@ void Form1::fileExit()
|
|||||||
Qt::Application::exit( 0 );
|
Qt::Application::exit( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Form1::parametersExport()
|
||||||
|
{
|
||||||
|
my %All=CreateAllInput();
|
||||||
|
my $FILENAME=$All{"FILENAME"}.".dat";
|
||||||
|
my $file=Qt::FileDialog::getSaveFileName(
|
||||||
|
"$FILENAME",
|
||||||
|
"Data Files (*.dat)",
|
||||||
|
this,
|
||||||
|
"export file dialog",
|
||||||
|
"Choose a filename to export to");
|
||||||
|
|
||||||
|
# If the user gave a filename the copy to it
|
||||||
|
if ($file ne "") {
|
||||||
|
my $Text = MSR::ExportParams(\%All);
|
||||||
|
print $Text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Form1::parametersAppend()
|
||||||
|
{
|
||||||
|
my %All=CreateAllInput();
|
||||||
|
my $FILENAME=$All{"FILENAME"}.".dat";
|
||||||
|
my $file=Qt::FileDialog::getOpneFileName(
|
||||||
|
"./",
|
||||||
|
"Data Files (*.dat)",
|
||||||
|
this,
|
||||||
|
"append file dialog",
|
||||||
|
"Choose a filename to append to");
|
||||||
|
|
||||||
|
# If the user gave a filename the copy to it
|
||||||
|
if ($file ne "") {
|
||||||
|
if (-e $FILENAME) {
|
||||||
|
my $Text = MSR::ExportParams(\%All);
|
||||||
|
print $Text;
|
||||||
|
} else {
|
||||||
|
if ($file ne "") {
|
||||||
|
my $Warning = "Warning: No data file found yet!";
|
||||||
|
my $WarningWindow = Qt::MessageBox::information( this, "Warning",$Warning);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MSR::ExportParams(\%All);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Form1::editUndo()
|
void Form1::editUndo()
|
||||||
{
|
{
|
||||||
@ -247,7 +292,7 @@ void MuSRFitform::CreateAllInput()
|
|||||||
$All{"Paramcomp_ref"}=$Paramcomp_ref;
|
$All{"Paramcomp_ref"}=$Paramcomp_ref;
|
||||||
my @Paramcomp = @$Paramcomp_ref;
|
my @Paramcomp = @$Paramcomp_ref;
|
||||||
|
|
||||||
# TODO: 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";
|
||||||
my $maxadd = "_max";
|
my $maxadd = "_max";
|
||||||
|
139
src/external/MuSRFitGUI/devel/MSR.pm
vendored
139
src/external/MuSRFitGUI/devel/MSR.pm
vendored
@ -1226,6 +1226,145 @@ sub PrepParamTable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
########################
|
||||||
|
# ExportParams
|
||||||
|
# Function return a tab separated table of parameters for the fit
|
||||||
|
# input should be
|
||||||
|
# %All
|
||||||
|
########################
|
||||||
|
sub ExportParams {
|
||||||
|
my $erradd = "d";
|
||||||
|
my $minadd = "_min";
|
||||||
|
my $maxadd = "_max";
|
||||||
|
|
||||||
|
# First assume nothing is shared
|
||||||
|
my $Shared = 0;
|
||||||
|
|
||||||
|
my $TABLE="";
|
||||||
|
|
||||||
|
my %All = %{$_[0]};
|
||||||
|
my @RUNS = ();
|
||||||
|
if ($All{"RUNSType"}) {
|
||||||
|
@RUNS = split( /,/, $All{"RunFiles"} );
|
||||||
|
} else {
|
||||||
|
@RUNS = split( /,/, $All{"RunNumbers"} );
|
||||||
|
}
|
||||||
|
my @Hists = split( /,/, $All{"LRBF"} );
|
||||||
|
|
||||||
|
my @FitTypes =();
|
||||||
|
foreach my $FitType ($All{"FitType1"}, $All{"FitType2"}, $All{"FitType3"}) {
|
||||||
|
if ( $FitType ne "None" ) { push( @FitTypes, $FitType ); }
|
||||||
|
}
|
||||||
|
# Get theory block 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"};
|
||||||
|
|
||||||
|
# Extract parameter block form the MSR file
|
||||||
|
# my $FILENAME=$All{"FILENAME"};
|
||||||
|
# open (MSRF,q{<},"$FILENAME.msr" );
|
||||||
|
# my @lines = <MSRF>;
|
||||||
|
# close(IFILE);
|
||||||
|
# my $FPBlock_ref=MSR::ExtractParamBlk(@lines);
|
||||||
|
# my @FPBloc = @$FPBlock_ref;
|
||||||
|
|
||||||
|
# Then loop over expected parameters and extract their values and error bar
|
||||||
|
my $PCount =0;
|
||||||
|
my $iRun =0;
|
||||||
|
my $value =0;
|
||||||
|
my $error = 0;
|
||||||
|
my $minvalue = 0;
|
||||||
|
my $maxvalue = 0;
|
||||||
|
my $Component=1;
|
||||||
|
|
||||||
|
foreach my $RUN (@RUNS) {
|
||||||
|
my $line="$RUN";
|
||||||
|
$iRun++;
|
||||||
|
$Component=1;
|
||||||
|
if ($All{"FitAsyType"} eq "Asymmetry") {
|
||||||
|
foreach my $FitType (@FitTypes) {
|
||||||
|
my $Parameters=$Paramcomp[$Component-1];
|
||||||
|
my @Params = split( /\s+/, $Parameters );
|
||||||
|
if ( $Component == 1 ) {
|
||||||
|
unshift( @Params, "Alpha" );
|
||||||
|
}
|
||||||
|
|
||||||
|
# This is the counter for parameters of this component
|
||||||
|
my $NP=1;
|
||||||
|
$Shared = 0;
|
||||||
|
# Change state/label of parameters
|
||||||
|
foreach my $Param (@Params) {
|
||||||
|
my $Param_ORG = $Param;
|
||||||
|
if ( $#FitTypes != 0 && ( $Param ne "Alpha" ) ){
|
||||||
|
$Param = join( "", $Param, "_", "$Component" );
|
||||||
|
}
|
||||||
|
|
||||||
|
$Shared = $All{"Sh_$Param"};
|
||||||
|
if ( $Shared!=1 || $iRun == 1 ) {
|
||||||
|
# It there are multiple runs index the parameters accordingly
|
||||||
|
$Param=$Param."_".$iRun;
|
||||||
|
# Check if this parameter has been initialized befor. (should be)
|
||||||
|
$value = $All{"$Param"};
|
||||||
|
$error = $All{"$erradd$Param"};
|
||||||
|
|
||||||
|
$line=join("\t",$line,$value,$error);
|
||||||
|
$PCount++;
|
||||||
|
}
|
||||||
|
$NP++;
|
||||||
|
}
|
||||||
|
$Component++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elsif ($All{"FitAsyType"} eq "SingleHist") {
|
||||||
|
# For a single histogram fit we basically need to repeat this for each hist
|
||||||
|
foreach my $Hist (@Hists) {
|
||||||
|
$Component=1;
|
||||||
|
foreach my $FitType (@FitTypes) {
|
||||||
|
my $Parameters=$Paramcomp[$Component-1];
|
||||||
|
my @Params = split( /\s+/, $Parameters );
|
||||||
|
if ( $Component == 1 ) {
|
||||||
|
unshift( @Params, ( "N0", "NBg" ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
# This is the counter for parameters of this component
|
||||||
|
my $NP=1;
|
||||||
|
$Shared = 0;
|
||||||
|
# Change state/label of parameters
|
||||||
|
foreach my $Param (@Params) {
|
||||||
|
my $Param_ORG = $Param;
|
||||||
|
$Param=$Param.$Hist;
|
||||||
|
if ( $#FitTypes != 0 && ( $Param_ORG ne "N0" && $Param_ORG ne "NBg" ) ){
|
||||||
|
$Param = join( "", $Param, "_", "$Component" );
|
||||||
|
}
|
||||||
|
|
||||||
|
$Shared = $All{"Sh_$Param"};
|
||||||
|
if ( $Shared!=1 || $iRun == 1 ) {
|
||||||
|
# It there are multiple runs index the parameters accordingly
|
||||||
|
$Param=$Param."_".$iRun;
|
||||||
|
# Check if this parameter has been initialized befor. (should be)
|
||||||
|
$value = $All{"$Param"};
|
||||||
|
$error = $All{"$erradd$Param"};
|
||||||
|
$minvalue = $All{"$Param$minadd"};
|
||||||
|
$maxvalue = $All{"$Param$maxadd"};
|
||||||
|
|
||||||
|
$values=join("\t",$Param,$value,$error,$minvalue,$maxvalue,$RUN);
|
||||||
|
$ParTable{$PCount}=$values;
|
||||||
|
$PCount++;
|
||||||
|
}
|
||||||
|
$NP++;
|
||||||
|
}
|
||||||
|
$Component++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$TABLE=$TABLE."$line\n"
|
||||||
|
}
|
||||||
|
return $TABLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
########################
|
########################
|
||||||
# RUNFileNameAuto
|
# RUNFileNameAuto
|
||||||
# Function return the RUN_Line for a given RUN
|
# Function return the RUN_Line for a given RUN
|
||||||
|
30
src/external/MuSRFitGUI/devel/MuSRFit.pl
vendored
30
src/external/MuSRFitGUI/devel/MuSRFit.pl
vendored
@ -1,6 +1,6 @@
|
|||||||
# Form implementation generated from reading ui file 'MuSRFit.ui'
|
# Form implementation generated from reading ui file 'MuSRFit.ui'
|
||||||
#
|
#
|
||||||
# Created: Fri Sep 11 15:56:45 2009
|
# Created: Sun Sep 13 23:02:53 2009
|
||||||
# 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!
|
||||||
@ -585,7 +585,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, 251) );
|
setMinimumSize(Qt::Size(23, 246) );
|
||||||
setIcon($image0 );
|
setIcon($image0 );
|
||||||
|
|
||||||
setCentralWidget(Qt::Widget(this, "qt_central_widget"));
|
setCentralWidget(Qt::Widget(this, "qt_central_widget"));
|
||||||
@ -2208,16 +2208,8 @@ sub parametersExport
|
|||||||
|
|
||||||
# If the user gave a filename the copy to it
|
# If the user gave a filename the copy to it
|
||||||
if ($file ne "") {
|
if ($file ne "") {
|
||||||
# TODO: check if the extension is correct, or add it.
|
my $Text = MSR::ExportParams(\%All);
|
||||||
if (-e $FILENAME) {
|
print $Text;
|
||||||
# my $cmd="cp $FILENAME $file";
|
|
||||||
# my $pid=system($cmd);
|
|
||||||
} else {
|
|
||||||
if ($file ne "") {
|
|
||||||
# my $Warning = "Warning: No MSR file found yet!";
|
|
||||||
# my $WarningWindow = Qt::MessageBox::information( this, "Warning",$Warning);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -2227,8 +2219,8 @@ sub parametersAppend
|
|||||||
|
|
||||||
my %All=CreateAllInput();
|
my %All=CreateAllInput();
|
||||||
my $FILENAME=$All{"FILENAME"}.".dat";
|
my $FILENAME=$All{"FILENAME"}.".dat";
|
||||||
my $file=Qt::FileDialog::getSaveFileName(
|
my $file=Qt::FileDialog::getOpneFileName(
|
||||||
"$FILENAME",
|
"./",
|
||||||
"Data Files (*.dat)",
|
"Data Files (*.dat)",
|
||||||
this,
|
this,
|
||||||
"append file dialog",
|
"append file dialog",
|
||||||
@ -2236,17 +2228,17 @@ sub parametersAppend
|
|||||||
|
|
||||||
# If the user gave a filename the copy to it
|
# If the user gave a filename the copy to it
|
||||||
if ($file ne "") {
|
if ($file ne "") {
|
||||||
# TODO: check if the extension is correct, or add it.
|
|
||||||
if (-e $FILENAME) {
|
if (-e $FILENAME) {
|
||||||
# my $cmd="cp $FILENAME $file";
|
my $Text = MSR::ExportParams(\%All);
|
||||||
# my $pid=system($cmd);
|
print $Text;
|
||||||
} else {
|
} else {
|
||||||
if ($file ne "") {
|
if ($file ne "") {
|
||||||
# my $Warning = "Warning: No MSR file found yet!";
|
my $Warning = "Warning: No data file found yet!";
|
||||||
# my $WarningWindow = Qt::MessageBox::information( this, "Warning",$Warning);
|
my $WarningWindow = Qt::MessageBox::information( this, "Warning",$Warning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
MSR::ExportParams(\%All);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4
src/external/MuSRFitGUI/devel/MuSRFit.ui
vendored
4
src/external/MuSRFitGUI/devel/MuSRFit.ui
vendored
@ -22,8 +22,8 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>21</width>
|
<width>23</width>
|
||||||
<height>251</height>
|
<height>246</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="caption">
|
<property name="caption">
|
||||||
|
26
src/external/MuSRFitGUI/devel/MuSRFit.ui.h
vendored
26
src/external/MuSRFitGUI/devel/MuSRFit.ui.h
vendored
@ -106,16 +106,8 @@ void Form1::parametersExport()
|
|||||||
|
|
||||||
# If the user gave a filename the copy to it
|
# If the user gave a filename the copy to it
|
||||||
if ($file ne "") {
|
if ($file ne "") {
|
||||||
# TODO: check if the extension is correct, or add it.
|
my $Text = MSR::ExportParams(\%All);
|
||||||
if (-e $FILENAME) {
|
print $Text;
|
||||||
# my $cmd="cp $FILENAME $file";
|
|
||||||
# my $pid=system($cmd);
|
|
||||||
} else {
|
|
||||||
if ($file ne "") {
|
|
||||||
# my $Warning = "Warning: No MSR file found yet!";
|
|
||||||
# my $WarningWindow = Qt::MessageBox::information( this, "Warning",$Warning);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,8 +116,8 @@ void Form1::parametersAppend()
|
|||||||
{
|
{
|
||||||
my %All=CreateAllInput();
|
my %All=CreateAllInput();
|
||||||
my $FILENAME=$All{"FILENAME"}.".dat";
|
my $FILENAME=$All{"FILENAME"}.".dat";
|
||||||
my $file=Qt::FileDialog::getSaveFileName(
|
my $file=Qt::FileDialog::getOpneFileName(
|
||||||
"$FILENAME",
|
"./",
|
||||||
"Data Files (*.dat)",
|
"Data Files (*.dat)",
|
||||||
this,
|
this,
|
||||||
"append file dialog",
|
"append file dialog",
|
||||||
@ -133,17 +125,17 @@ void Form1::parametersAppend()
|
|||||||
|
|
||||||
# If the user gave a filename the copy to it
|
# If the user gave a filename the copy to it
|
||||||
if ($file ne "") {
|
if ($file ne "") {
|
||||||
# TODO: check if the extension is correct, or add it.
|
|
||||||
if (-e $FILENAME) {
|
if (-e $FILENAME) {
|
||||||
# my $cmd="cp $FILENAME $file";
|
my $Text = MSR::ExportParams(\%All);
|
||||||
# my $pid=system($cmd);
|
print $Text;
|
||||||
} else {
|
} else {
|
||||||
if ($file ne "") {
|
if ($file ne "") {
|
||||||
# my $Warning = "Warning: No MSR file found yet!";
|
my $Warning = "Warning: No data file found yet!";
|
||||||
# my $WarningWindow = Qt::MessageBox::information( this, "Warning",$Warning);
|
my $WarningWindow = Qt::MessageBox::information( this, "Warning",$Warning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
MSR::ExportParams(\%All);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user