Added check for correct number of histograms for asymmetry fit.

This commit is contained in:
salman 2011-09-28 13:53:13 +00:00
parent 4ba15e49f8
commit 79dd2cf4a9
3 changed files with 135 additions and 87 deletions

View File

@ -1,6 +1,6 @@
# Form implementation generated from reading ui file 'MuSRFit.ui' # Form implementation generated from reading ui file 'MuSRFit.ui'
# #
# Created: Wed May 25 16:46:00 2011 # Created: Wed Sep 28 15:51:27 2011
# 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!
@ -4181,27 +4181,35 @@ sub GoFit
{ {
my %All=CreateAllInput(); my %All=CreateAllInput();
musrfit_tabs->setCurrentPage(1); # Check here is the number of histograms makes sense
my $Answer=CallMSRCreate(); # other wise give error.
if ($Answer) { my @Hists = split( /,/, $All{"LRBF"} );
my $FILENAME=$All{"FILENAME"}.".msr"; if ($All{"FitAsyType"} eq "Asymmetry" && $#Hists != 1) {
if (-e $FILENAME) { # we have a problem here send error message
my $cmd="musrfit -t $FILENAME"; my $Warning = "Error: The number of histograms should be 2 for an asymmetry fit!";
my $pid = open(FTO,"$cmd 2>&1 |"); my $WarningWindow = Qt::MessageBox::information( this, "Error",$Warning);
while (<FTO>) { } else {
FitTextOutput->append("$_"); musrfit_tabs->setCurrentPage(1);
my $Answer=CallMSRCreate();
if ($Answer) {
my $FILENAME=$All{"FILENAME"}.".msr";
if (-e $FILENAME) {
my $cmd="musrfit -t $FILENAME";
my $pid = open(FTO,"$cmd 2>&1 |");
while (<FTO>) {
FitTextOutput->append("$_");
}
close(FTO);
$cmd="musrview $FILENAME &";
$pid = system($cmd);
} else {
FitTextOutput->append("Cannot find MSR file!");
} }
close(FTO); FitTextOutput->append("-----------------------------------------------------------------------------------------------------------------------------");
$cmd="musrview $FILENAME &";
$pid = system($cmd);
} else {
FitTextOutput->append("Cannot find MSR file!");
}
FitTextOutput->append("-----------------------------------------------------------------------------------------------------------------------------");
# update MSR File tab and initialization table # update MSR File tab and initialization table
UpdateMSRFileInitTable(); UpdateMSRFileInitTable();
}
} }
return; return;
} }
@ -4210,16 +4218,24 @@ sub GoPlot
{ {
my %All=CreateAllInput(); my %All=CreateAllInput();
my $Answer=CallMSRCreate(); # Check here is the number of histograms makes sense
my $FILENAME=$All{"FILENAME"}.".msr"; # other wise give error.
my @Hists = split( /,/, $All{"LRBF"} );
if ($Answer) { if ($All{"FitAsyType"} eq "Asymmetry" && $#Hists != 1) {
if (-e $FILENAME) { # we have a problem here send error message
my $cmd="musrview $FILENAME &"; my $Warning = "Error: The number of histograms should be 2 for an asymmetry fit!";
my $pid = system($cmd); my $WarningWindow = Qt::MessageBox::information( this, "Error",$Warning);
} else { } else {
FitTextOutput->append("Cannot find MSR file!"); my $Answer=CallMSRCreate();
FitTextOutput->append("-----------------------------------------------------------------------------------------------------------------------------"); my $FILENAME=$All{"FILENAME"}.".msr";
if ($Answer) {
if (-e $FILENAME) {
my $cmd="musrview $FILENAME &";
my $pid = system($cmd);
} else {
FitTextOutput->append("Cannot find MSR file!");
FitTextOutput->append("-----------------------------------------------------------------------------------------------------------------------------");
}
} }
} }
return; return;

View File

@ -6,7 +6,7 @@
** **
** You should not define a constructor or destructor in this file. ** You should not define a constructor or destructor in this file.
** Instead, write your code in functions called init() and destroy(). ** Instead, write your code in functions called init() and destroy().
** These will automatically be called by the form's constructor and ** These will automatically be called by theform's constructor and
** destructor. ** destructor.
*****************************************************************************/ *****************************************************************************/
@ -701,43 +701,59 @@ void MuSRFitform::TabChanged()
void MuSRFitform::GoFit() void MuSRFitform::GoFit()
{ {
my %All=CreateAllInput(); my %All=CreateAllInput();
musrfit_tabs->setCurrentPage(1); # Check here is the number of histograms makes sense
my $Answer=CallMSRCreate(); # other wise give error.
if ($Answer) { my @Hists = split( /,/, $All{"LRBF"} );
my $FILENAME=$All{"FILENAME"}.".msr"; if ($All{"FitAsyType"} eq "Asymmetry" && $#Hists != 1) {
if (-e $FILENAME) { # we have a problem here send error message
my $cmd="musrfit -t $FILENAME"; my $Warning = "Error: The number of histograms should be 2 for an asymmetry fit!";
my $pid = open(FTO,"$cmd 2>&1 |"); my $WarningWindow = Qt::MessageBox::information( this, "Error",$Warning);
while (<FTO>) { } else {
FitTextOutput->append("$_"); musrfit_tabs->setCurrentPage(1);
my $Answer=CallMSRCreate();
if ($Answer) {
my $FILENAME=$All{"FILENAME"}.".msr";
if (-e $FILENAME) {
my $cmd="musrfit -t $FILENAME";
my $pid = open(FTO,"$cmd 2>&1 |");
while (<FTO>) {
FitTextOutput->append("$_");
}
close(FTO);
$cmd="musrview $FILENAME &";
$pid = system($cmd);
} else {
FitTextOutput->append("Cannot find MSR file!");
} }
close(FTO); FitTextOutput->append("-----------------------------------------------------------------------------------------------------------------------------");
$cmd="musrview $FILENAME &";
$pid = system($cmd);
} else {
FitTextOutput->append("Cannot find MSR file!");
}
FitTextOutput->append("-----------------------------------------------------------------------------------------------------------------------------");
# update MSR File tab and initialization table # update MSR File tab and initialization table
UpdateMSRFileInitTable(); UpdateMSRFileInitTable();
}
} }
return; return;
} }
void MuSRFitform::GoPlot() void MuSRFitform::GoPlot()
{ {
my %All=CreateAllInput(); my %All=CreateAllInput();
my $Answer=CallMSRCreate(); # Check here is the number of histograms makes sense
my $FILENAME=$All{"FILENAME"}.".msr"; # other wise give error.
my @Hists = split( /,/, $All{"LRBF"} );
if ($Answer) { if ($All{"FitAsyType"} eq "Asymmetry" && $#Hists != 1) {
if (-e $FILENAME) { # we have a problem here send error message
my $cmd="musrview $FILENAME &"; my $Warning = "Error: The number of histograms should be 2 for an asymmetry fit!";
my $pid = system($cmd); my $WarningWindow = Qt::MessageBox::information( this, "Error",$Warning);
} else { } else {
FitTextOutput->append("Cannot find MSR file!"); my $Answer=CallMSRCreate();
FitTextOutput->append("-----------------------------------------------------------------------------------------------------------------------------"); my $FILENAME=$All{"FILENAME"}.".msr";
if ($Answer) {
if (-e $FILENAME) {
my $cmd="musrview $FILENAME &";
my $pid = system($cmd);
} else {
FitTextOutput->append("Cannot find MSR file!");
FitTextOutput->append("-----------------------------------------------------------------------------------------------------------------------------");
}
} }
} }
return; return;

View File

@ -6,7 +6,7 @@
** **
** You should not define a constructor or destructor in this file. ** You should not define a constructor or destructor in this file.
** Instead, write your code in functions called init() and destroy(). ** Instead, write your code in functions called init() and destroy().
** These will automatically be called by the form's constructor and ** These will automatically be called by theform's constructor and
** destructor. ** destructor.
*****************************************************************************/ *****************************************************************************/
@ -703,43 +703,59 @@ void MuSRFitform::TabChanged()
void MuSRFitform::GoFit() void MuSRFitform::GoFit()
{ {
my %All=CreateAllInput(); my %All=CreateAllInput();
musrfit_tabs->setCurrentPage(1); # Check here is the number of histograms makes sense
my $Answer=CallMSRCreate(); # other wise give error.
if ($Answer) { my @Hists = split( /,/, $All{"LRBF"} );
my $FILENAME=$All{"FILENAME"}.".msr"; if ($All{"FitAsyType"} eq "Asymmetry" && $#Hists != 1) {
if (-e $FILENAME) { # we have a problem here send error message
my $cmd="musrfit -t $FILENAME"; my $Warning = "Error: The number of histograms should be 2 for an asymmetry fit!";
my $pid = open(FTO,"$cmd 2>&1 |"); my $WarningWindow = Qt::MessageBox::information( this, "Error",$Warning);
while (<FTO>) { } else {
FitTextOutput->append("$_"); musrfit_tabs->setCurrentPage(1);
my $Answer=CallMSRCreate();
if ($Answer) {
my $FILENAME=$All{"FILENAME"}.".msr";
if (-e $FILENAME) {
my $cmd="musrfit -t $FILENAME";
my $pid = open(FTO,"$cmd 2>&1 |");
while (<FTO>) {
FitTextOutput->append("$_");
}
close(FTO);
$cmd="musrview $FILENAME &";
$pid = system($cmd);
} else {
FitTextOutput->append("Cannot find MSR file!");
} }
close(FTO); FitTextOutput->append("-----------------------------------------------------------------------------------------------------------------------------");
$cmd="musrview $FILENAME &";
$pid = system($cmd);
} else {
FitTextOutput->append("Cannot find MSR file!");
}
FitTextOutput->append("-----------------------------------------------------------------------------------------------------------------------------");
# update MSR File tab and initialization table # update MSR File tab and initialization table
UpdateMSRFileInitTable(); UpdateMSRFileInitTable();
}
} }
return; return;
} }
void MuSRFitform::GoPlot() void MuSRFitform::GoPlot()
{ {
my %All=CreateAllInput(); my %All=CreateAllInput();
my $Answer=CallMSRCreate(); # Check here is the number of histograms makes sense
my $FILENAME=$All{"FILENAME"}.".msr"; # other wise give error.
my @Hists = split( /,/, $All{"LRBF"} );
if ($Answer) { if ($All{"FitAsyType"} eq "Asymmetry" && $#Hists != 1) {
if (-e $FILENAME) { # we have a problem here send error message
my $cmd="musrview $FILENAME &"; my $Warning = "Error: The number of histograms should be 2 for an asymmetry fit!";
my $pid = system($cmd); my $WarningWindow = Qt::MessageBox::information( this, "Error",$Warning);
} else { } else {
FitTextOutput->append("Cannot find MSR file!"); my $Answer=CallMSRCreate();
FitTextOutput->append("-----------------------------------------------------------------------------------------------------------------------------"); my $FILENAME=$All{"FILENAME"}.".msr";
if ($Answer) {
if (-e $FILENAME) {
my $cmd="musrview $FILENAME &";
my $pid = system($cmd);
} else {
FitTextOutput->append("Cannot find MSR file!");
FitTextOutput->append("-----------------------------------------------------------------------------------------------------------------------------");
}
} }
} }
return; return;