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,6 +4181,14 @@ sub GoFit
{ {
my %All=CreateAllInput(); my %All=CreateAllInput();
# Check here is the number of histograms makes sense
# other wise give error.
my @Hists = split( /,/, $All{"LRBF"} );
if ($All{"FitAsyType"} eq "Asymmetry" && $#Hists != 1) {
# we have a problem here send error message
my $Warning = "Error: The number of histograms should be 2 for an asymmetry fit!";
my $WarningWindow = Qt::MessageBox::information( this, "Error",$Warning);
} else {
musrfit_tabs->setCurrentPage(1); musrfit_tabs->setCurrentPage(1);
my $Answer=CallMSRCreate(); my $Answer=CallMSRCreate();
if ($Answer) { if ($Answer) {
@ -4201,7 +4209,7 @@ sub GoFit
# update MSR File tab and initialization table # update MSR File tab and initialization table
UpdateMSRFileInitTable(); UpdateMSRFileInitTable();
} }
}
return; return;
} }
@ -4210,9 +4218,16 @@ sub GoPlot
{ {
my %All=CreateAllInput(); my %All=CreateAllInput();
# Check here is the number of histograms makes sense
# other wise give error.
my @Hists = split( /,/, $All{"LRBF"} );
if ($All{"FitAsyType"} eq "Asymmetry" && $#Hists != 1) {
# we have a problem here send error message
my $Warning = "Error: The number of histograms should be 2 for an asymmetry fit!";
my $WarningWindow = Qt::MessageBox::information( this, "Error",$Warning);
} else {
my $Answer=CallMSRCreate(); my $Answer=CallMSRCreate();
my $FILENAME=$All{"FILENAME"}.".msr"; my $FILENAME=$All{"FILENAME"}.".msr";
if ($Answer) { if ($Answer) {
if (-e $FILENAME) { if (-e $FILENAME) {
my $cmd="musrview $FILENAME &"; my $cmd="musrview $FILENAME &";
@ -4222,6 +4237,7 @@ sub GoPlot
FitTextOutput->append("-----------------------------------------------------------------------------------------------------------------------------"); 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,6 +701,14 @@ void MuSRFitform::TabChanged()
void MuSRFitform::GoFit() void MuSRFitform::GoFit()
{ {
my %All=CreateAllInput(); my %All=CreateAllInput();
# Check here is the number of histograms makes sense
# other wise give error.
my @Hists = split( /,/, $All{"LRBF"} );
if ($All{"FitAsyType"} eq "Asymmetry" && $#Hists != 1) {
# we have a problem here send error message
my $Warning = "Error: The number of histograms should be 2 for an asymmetry fit!";
my $WarningWindow = Qt::MessageBox::information( this, "Error",$Warning);
} else {
musrfit_tabs->setCurrentPage(1); musrfit_tabs->setCurrentPage(1);
my $Answer=CallMSRCreate(); my $Answer=CallMSRCreate();
if ($Answer) { if ($Answer) {
@ -721,16 +729,23 @@ void MuSRFitform::GoFit()
# 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();
# Check here is the number of histograms makes sense
# other wise give error.
my @Hists = split( /,/, $All{"LRBF"} );
if ($All{"FitAsyType"} eq "Asymmetry" && $#Hists != 1) {
# we have a problem here send error message
my $Warning = "Error: The number of histograms should be 2 for an asymmetry fit!";
my $WarningWindow = Qt::MessageBox::information( this, "Error",$Warning);
} else {
my $Answer=CallMSRCreate(); my $Answer=CallMSRCreate();
my $FILENAME=$All{"FILENAME"}.".msr"; my $FILENAME=$All{"FILENAME"}.".msr";
if ($Answer) { if ($Answer) {
if (-e $FILENAME) { if (-e $FILENAME) {
my $cmd="musrview $FILENAME &"; my $cmd="musrview $FILENAME &";
@ -740,6 +755,7 @@ void MuSRFitform::GoPlot()
FitTextOutput->append("-----------------------------------------------------------------------------------------------------------------------------"); 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,6 +703,14 @@ void MuSRFitform::TabChanged()
void MuSRFitform::GoFit() void MuSRFitform::GoFit()
{ {
my %All=CreateAllInput(); my %All=CreateAllInput();
# Check here is the number of histograms makes sense
# other wise give error.
my @Hists = split( /,/, $All{"LRBF"} );
if ($All{"FitAsyType"} eq "Asymmetry" && $#Hists != 1) {
# we have a problem here send error message
my $Warning = "Error: The number of histograms should be 2 for an asymmetry fit!";
my $WarningWindow = Qt::MessageBox::information( this, "Error",$Warning);
} else {
musrfit_tabs->setCurrentPage(1); musrfit_tabs->setCurrentPage(1);
my $Answer=CallMSRCreate(); my $Answer=CallMSRCreate();
if ($Answer) { if ($Answer) {
@ -723,16 +731,23 @@ void MuSRFitform::GoFit()
# 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();
# Check here is the number of histograms makes sense
# other wise give error.
my @Hists = split( /,/, $All{"LRBF"} );
if ($All{"FitAsyType"} eq "Asymmetry" && $#Hists != 1) {
# we have a problem here send error message
my $Warning = "Error: The number of histograms should be 2 for an asymmetry fit!";
my $WarningWindow = Qt::MessageBox::information( this, "Error",$Warning);
} else {
my $Answer=CallMSRCreate(); my $Answer=CallMSRCreate();
my $FILENAME=$All{"FILENAME"}.".msr"; my $FILENAME=$All{"FILENAME"}.".msr";
if ($Answer) { if ($Answer) {
if (-e $FILENAME) { if (-e $FILENAME) {
my $cmd="musrview $FILENAME &"; my $cmd="musrview $FILENAME &";
@ -742,6 +757,7 @@ void MuSRFitform::GoPlot()
FitTextOutput->append("-----------------------------------------------------------------------------------------------------------------------------"); FitTextOutput->append("-----------------------------------------------------------------------------------------------------------------------------");
} }
} }
}
return; return;
} }