New development branch.
This commit is contained in:
parent
41267b9fef
commit
b3c85ef61a
4039
src/external/MuSRFitGUI/devel/MuSRFit.ui
vendored
4039
src/external/MuSRFitGUI/devel/MuSRFit.ui
vendored
File diff suppressed because it is too large
Load Diff
196
src/external/MuSRFitGUI/devel/MuSRFit.ui.h
vendored
196
src/external/MuSRFitGUI/devel/MuSRFit.ui.h
vendored
@ -90,7 +90,12 @@ void Form1::filePrint()
|
||||
|
||||
void Form1::fileExit()
|
||||
{
|
||||
Qt::Application::exit( 0 );
|
||||
my $Ans = Qt::MessageBox::question( this, "Quit?","Are you sure you want to quit?","&Yes","&No","",0,1);
|
||||
if ($Ans==0) {
|
||||
# Then quit
|
||||
Qt::Application::exit( 0 );
|
||||
}
|
||||
# Otherwize go back
|
||||
}
|
||||
|
||||
void Form1::parametersExport()
|
||||
@ -207,31 +212,56 @@ void Form1::helpAbout()
|
||||
|
||||
void MuSRFitform::CreateAllInput()
|
||||
{
|
||||
# TODO: Need to deliver shared parameters also
|
||||
# TODO: Need to automatically generage years list depending on beamline
|
||||
my %All=();
|
||||
# From RUNS Tab
|
||||
$All{"TITLE"}= TITLE->text;
|
||||
$All{"FILENAME"}= FILENAME->text;
|
||||
|
||||
# From RUNS Tab
|
||||
# Run data file
|
||||
$All{"RunNumbers"} = RunNumbers->text;
|
||||
$All{"RunFiles"} = RunFiles->text;
|
||||
$All{"BeamLine"} = BeamLine->currentText;
|
||||
$All{"RUNSType"} = ManualFile->isOn();
|
||||
$All{"optionsFourier"} = optionsFourier->isOn();
|
||||
$All{"optionsT0"} = optionsT0->isOn();
|
||||
$All{"YEAR"} =YEAR->currentText;
|
||||
# Time range and BINS
|
||||
$All{"Tis"} = Tis->text;
|
||||
$All{"Tfs"} = Tfs->text;
|
||||
$All{"BINS"} = BINS->text;
|
||||
$All{"FitAsyType"} = FitAsyType->currentText;
|
||||
$All{"LRBF"} = LRBF->text;
|
||||
my @Hists = split(/,/, $All{"LRBF"} );
|
||||
# Lifetime corrections in enabled/visible only for SingleHis fits
|
||||
if ( $All{"FitAsyType"} eq "Asymmetry" ) {
|
||||
ltc->setHidden(1);
|
||||
}
|
||||
elsif ( $All{"FitAsyType"} eq "SingleHist" ) {
|
||||
ltc->setHidden(0);
|
||||
}
|
||||
|
||||
# From Fitting Tab
|
||||
# Plot range
|
||||
$All{"Xi"}=Xi->text;
|
||||
$All{"Xf"}=Xf->text;
|
||||
$All{"Yi"}=Yi->text;
|
||||
$All{"Yf"}=Yf->text;
|
||||
|
||||
# Life time correction
|
||||
if (ltc->isChecked()) {
|
||||
$All{"ltc"}="y";
|
||||
} else {
|
||||
$All{"ltc"}="n";
|
||||
}
|
||||
# Minuit commands
|
||||
if ( $All{"go"} eq "" ) {
|
||||
$All{"go"}="PLOT";
|
||||
}
|
||||
# Get minimization process
|
||||
$All{"Minimization"} = Minimization->currentText();
|
||||
$All{"go"}=$All{"Minimization"};
|
||||
|
||||
# Get Error calculation process
|
||||
$All{"ErrorCalc"} = ErrorCalc->currentText();
|
||||
$All{"go"}=$All{"ErrorCalc"};
|
||||
|
||||
RunSelectionToggle();
|
||||
my @RUNS = ();
|
||||
@ -241,13 +271,18 @@ void MuSRFitform::CreateAllInput()
|
||||
$All{"RunNumbers"} =~ s/[\ \.\~\/\&\*\[\;\>\<\^\$\(\)\`\|\]\'\@]/,/g;
|
||||
@RUNS = split( /,/, $All{"RunNumbers"} );
|
||||
}
|
||||
|
||||
my @Hists = split(/,/, $All{"LRBF"} );
|
||||
|
||||
|
||||
# From MSR File Tab
|
||||
$All{"TITLE"}= TITLE->text;
|
||||
$All{"FILENAME"}= FILENAME->text;
|
||||
|
||||
# From Fourier Tab
|
||||
$All{"FUNITS"}= FUnits->currentText;
|
||||
$All{"FAPODIZATION"}= FApodization->currentText;
|
||||
$All{"FPLOT"}= FPlot->currentText;
|
||||
# Fourier range
|
||||
$All{"FrqMin"}=FrqMin->text;
|
||||
$All{"FrqMax"}=FrqMax->text;
|
||||
|
||||
# Get values of t0 and Bg/Data bins if given
|
||||
my $NHist = 1;
|
||||
@ -379,17 +414,7 @@ void MuSRFitform::CreateAllInput()
|
||||
$All{"FILENAME"}="TMP";
|
||||
}
|
||||
|
||||
if ( $All{"go"} eq "" ) {
|
||||
$All{"go"}="PLOT";
|
||||
}
|
||||
|
||||
# Get minimization process
|
||||
$All{"Minimization"} = Minimization->currentText();
|
||||
$All{"go"}=$All{"Minimization"};
|
||||
|
||||
# Get Error calculation process
|
||||
$All{"ErrorCalc"} = ErrorCalc->currentText();
|
||||
$All{"go"}=$All{"ErrorCalc"};
|
||||
|
||||
# Return Hash with all important values
|
||||
return %All;
|
||||
@ -399,15 +424,37 @@ void MuSRFitform::CallMSRCreate()
|
||||
{
|
||||
use MSR;
|
||||
my %All=CreateAllInput();
|
||||
|
||||
# Check if the option for checking for existing files is selected
|
||||
my $FileExistCheck= FileExistCheck->isOn();
|
||||
my $FILENAME=$All{"FILENAME"}.".msr";
|
||||
my $Answer=0;
|
||||
if ($All{"RunNumbers"} ne "" || $All{"RunFiles"} ne "") {
|
||||
if ( $All{"FitAsyType"} eq "Asymmetry" ) {
|
||||
my ($Full_T_Block,$Paramcomp_ref)= MSR::CreateMSR(\%All);
|
||||
if ( $FileExistCheck==1 ) {
|
||||
if (-e $FILENAME) {
|
||||
# Warning: MSR file exists
|
||||
# my $Warning = "Warning: MSR file $FILENAME Already exists!\nIf you continue it will overwriten.";
|
||||
my $Warning = "Warning: MSR file $FILENAME Already exists!\nDo you want to overwrite it?";
|
||||
# my $WarningWindow = Qt::MessageBox::information( this, "Warning",$Warning);
|
||||
# $Answer =1,0 for yes and no
|
||||
$Answer= Qt::MessageBox::warning( this, "Warning",$Warning, "&No", "&Yes", undef, 1,1);
|
||||
}
|
||||
} else {
|
||||
# Just overwrite file
|
||||
$Answer=1;
|
||||
}
|
||||
elsif ( $All{"FitAsyType"} eq "SingleHist" ) {
|
||||
my ($Full_T_Block,$Paramcomp_ref)= MSR::CreateMSRSingleHist(\%All);
|
||||
|
||||
if ($Answer) {
|
||||
if ( $All{"FitAsyType"} eq "Asymmetry" ) {
|
||||
my ($Full_T_Block,$Paramcomp_ref)= MSR::CreateMSR(\%All);
|
||||
}
|
||||
elsif ( $All{"FitAsyType"} eq "SingleHist" ) {
|
||||
my ($Full_T_Block,$Paramcomp_ref)= MSR::CreateMSRSingleHist(\%All);
|
||||
}
|
||||
UpdateMSRFileInitTable();
|
||||
}
|
||||
UpdateMSRFileInitTable();
|
||||
}
|
||||
return $Answer;
|
||||
}
|
||||
|
||||
void MuSRFitform::UpdateMSRFileInitTable()
|
||||
@ -583,7 +630,7 @@ void MuSRFitform::InitializeTab()
|
||||
my $NParam=scalar keys( %PTable );
|
||||
if ($NParam>$NRows) {
|
||||
InitParamTable->setNumRows($NParam);
|
||||
}
|
||||
}
|
||||
|
||||
# Fill the table with labels and values of parametr
|
||||
for (my $PCount=0;$PCount<$NParam;$PCount++) {
|
||||
@ -603,24 +650,8 @@ void MuSRFitform::InitializeTab()
|
||||
void MuSRFitform::TabChanged()
|
||||
{
|
||||
# TODO: First check if there are some runs given, otherwise disbale
|
||||
# TODO: Check if the MSR file exists and decide whether to use it or not
|
||||
my %All=CreateAllInput();
|
||||
|
||||
my $SlectedTab = musrfit_tabs->currentPageIndex;
|
||||
# Check if the option for checking for existing files is selected
|
||||
my $FileExistCheck= FileExistCheck->isOn();
|
||||
my $FILENAME=$All{"FILENAME"}.".msr";
|
||||
if ($All{"RunNumbers"} ne "" && $SlectedTab==4 && $FileExistCheck==1) {
|
||||
if (-e $FILENAME) {
|
||||
# Warning: MSR file exists
|
||||
my $Warning = "Warning: MSR file $FILENAME Already exists!\nIf you continue it will overwriten.";
|
||||
my $WarningWindow = Qt::MessageBox::information( this, "Warning",$Warning);
|
||||
# my $Answer= Qt::MessageBox::warning( this, "Warning",$Warning, "&No", "&Yes", undef, 1,1);
|
||||
# $Answer =1,0 for yes and no
|
||||
# print "Answer=$Answer\n";
|
||||
}
|
||||
}
|
||||
|
||||
# First make sure we have sharing initialized
|
||||
ActivateShComp();
|
||||
InitializeTab();
|
||||
@ -634,38 +665,43 @@ void MuSRFitform::GoFit()
|
||||
{
|
||||
my %All=CreateAllInput();
|
||||
musrfit_tabs->setCurrentPage(1);
|
||||
CallMSRCreate();
|
||||
my $FILENAME=$All{"FILENAME"}.".msr";
|
||||
if (-e $FILENAME) {
|
||||
my $cmd="musrfit -t $FILENAME";
|
||||
my $pid = open(FTO,"$cmd 2>&1 |");
|
||||
while (<FTO>) {
|
||||
FitTextOutput->append("$_");
|
||||
# print "line= ".$_;
|
||||
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);
|
||||
$cmd="musrview $FILENAME &";
|
||||
$pid = system($cmd);
|
||||
} else {
|
||||
FitTextOutput->append("Cannot find MSR file!");
|
||||
}
|
||||
FitTextOutput->append("-----------------------------------------------------------------------------------------------------------------------------");
|
||||
FitTextOutput->append("-----------------------------------------------------------------------------------------------------------------------------");
|
||||
# update MSR File tab and initialization table
|
||||
UpdateMSRFileInitTable();
|
||||
UpdateMSRFileInitTable();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void MuSRFitform::GoPlot()
|
||||
{
|
||||
my %All=CreateAllInput();
|
||||
CallMSRCreate();
|
||||
my $Answer=CallMSRCreate();
|
||||
my $FILENAME=$All{"FILENAME"}.".msr";
|
||||
if (-e $FILENAME) {
|
||||
my $cmd="musrview $FILENAME &";
|
||||
my $pid = system($cmd);
|
||||
} else {
|
||||
FitTextOutput->append("Cannot find MSR file!");
|
||||
FitTextOutput->append("-----------------------------------------------------------------------------------------------------------------------------");
|
||||
|
||||
if ($Answer) {
|
||||
if (-e $FILENAME) {
|
||||
my $cmd="musrview $FILENAME &";
|
||||
my $pid = system($cmd);
|
||||
} else {
|
||||
FitTextOutput->append("Cannot find MSR file!");
|
||||
FitTextOutput->append("-----------------------------------------------------------------------------------------------------------------------------");
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -676,13 +712,16 @@ void MuSRFitform::ShowMuSRT0()
|
||||
my %All=CreateAllInput();
|
||||
musrfit_tabs->setCurrentPage(6);
|
||||
# Create MSR file and then run musrt0
|
||||
CallMSRCreate();
|
||||
my $FILENAME=$All{"FILENAME"}.".msr";
|
||||
if (-e $FILENAME) {
|
||||
my $cmd="musrt0 $FILENAME &";
|
||||
my $pid = system($cmd);
|
||||
} else {
|
||||
print STDERR "Cannot find MSR file!\n";
|
||||
my $Answer=CallMSRCreate();
|
||||
|
||||
if ($Answer) {
|
||||
my $FILENAME=$All{"FILENAME"}.".msr";
|
||||
if (-e $FILENAME) {
|
||||
my $cmd="musrt0 $FILENAME &";
|
||||
my $pid = system($cmd);
|
||||
} else {
|
||||
print STDERR "Cannot find MSR file!\n";
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -725,6 +764,20 @@ void MuSRFitform::RunSelectionToggle()
|
||||
RUNSAuto->setEnabled(1);
|
||||
RUNSAuto->setHidden(0);
|
||||
}
|
||||
|
||||
# Also use this for other options
|
||||
# Fourier toggle
|
||||
my $Fourier=optionsFourier->isOn();
|
||||
if ($Fourier) {
|
||||
# Fourier tab visible
|
||||
# musrfit_tabs->addTab(FourierPage,"Fourier");
|
||||
# musrfit_tabs->showPage(FourierPage);
|
||||
# FourierPage->hide();
|
||||
} else {
|
||||
# Fourier tab invisible
|
||||
# musrfit_tabs->removePage(FourierPage);
|
||||
# FourierPage->show();
|
||||
}
|
||||
}
|
||||
|
||||
void MuSRFitform::fileBrowse()
|
||||
@ -747,4 +800,3 @@ void MuSRFitform::fileBrowse()
|
||||
}
|
||||
RunFiles->setText($RunFiles);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user