Sync with muonspin/musrfit

This commit is contained in:
Zaher Salman 2015-02-20 12:41:07 +01:00
commit 22ad7b1c59
12 changed files with 128 additions and 56 deletions

View File

@ -4,6 +4,8 @@
changes since 0.13.0
===================================
NEW 2015-02-20 add a switch to musrview that it plots initially the Fouier data rather
than the time domain data.
NEW 2015-02-19 added a first preliminary user interface for musrFT within musredit.
NEW 2015-02-16 changed the data export handling from musrview. It is now more
main line and follows the implementation of musrFT.

View File

@ -1,7 +1,7 @@
AC_REVISION([m4_esyscmd_s([git describe --always])])
AC_PREREQ(2.63)
AC_INIT([musrfit],[0.13.0],[andreas.suter@psi.ch])
AC_INIT([musrfit],[0.14.0],[andreas.suter@psi.ch])
AC_CONFIG_AUX_DIR(admin)
AC_CANONICAL_HOST
#AC_MSG_RESULT([${host} ${host_cpu} ${host_vendor} ${host_os}])
@ -35,7 +35,7 @@ dnl -----------------------------------------------
#release versioning
MUSR_MAJOR_VERSION=0
MUSR_MINOR_VERSION=13
MUSR_MINOR_VERSION=14
MUSR_MICRO_VERSION=0
#release versioning

View File

@ -2861,29 +2861,6 @@ Bool_t PMsrHandler::HandleGlobalEntry(PMsrLines &lines)
fGlobal = global;
}
/*
cout << endl << "debug> PMsrHandler::HandleGlobalEntry: Global: fittype : " << fGlobal.GetFitType();
cout << endl << "debug> PMsrHandler::HandleGlobalEntry: Global: data bin range: ";
for (UInt_t i=0; i<4; i++) {
cout << fGlobal.GetDataRange(i) << ", ";
}
cout << endl << "debug> PMsrHandler::HandleGlobalEntry: Global: t0's : ";
for (UInt_t i=0; i<fGlobal.GetT0BinSize(); i++)
cout << fGlobal.GetT0Bin(i) << ", ";
cout << endl << "debug> PMsrHandler::HandleGlobalEntry: Global: addt0's : ";
for (UInt_t i=0; i<fGlobal.GetAddT0BinEntries(); i++) {
cout << endl << " debug> --> " << i << ": ";
for (UInt_t j=0; j<(UInt_t)fGlobal.GetAddT0BinSize(i); j++) {
cout << fGlobal.GetAddT0Bin(i,j) << ", ";
}
}
cout << endl << "debug> PMsrHandler::HandleGlobalEntry: Global: fit in bin: " << fGlobal.IsFitRangeInBin();
cout << endl << "debug> PMsrHandler::HandleGlobalEntry: Global: fit offset: " << fGlobal.GetFitRangeOffset(0) << ", " << fGlobal.GetFitRangeOffset(1);
cout << endl << "debug> PMsrHandler::HandleGlobalEntry: Global: fit : " << fGlobal.GetFitRange(0) << ", " << fGlobal.GetFitRange(1);
cout << endl << "debug> PMsrHandler::HandleGlobalEntry: Global: packing : " << fGlobal.GetPacking();
cout << endl;
*/
return !error;
}

View File

@ -185,8 +185,8 @@ PMusrCanvas::PMusrCanvas()
*/
PMusrCanvas::PMusrCanvas(const Int_t number, const Char_t* title,
Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh,
const Bool_t batch) :
fBatchMode(batch), fPlotNumber(number)
const Bool_t batch, const Bool_t fourier) :
fStartWithFourier(fourier), fBatchMode(batch), fPlotNumber(number)
{
fTimeout = 0;
fTimeoutTimer = 0;
@ -240,8 +240,8 @@ PMusrCanvas::PMusrCanvas(const Int_t number, const Char_t* title,
Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh,
PMsrFourierStructure fourierDefault,
const PIntVector markerList, const PIntVector colorList,
const Bool_t batch) :
fBatchMode(batch),
const Bool_t batch, const Bool_t fourier) :
fStartWithFourier(fourier), fBatchMode(batch),
fPlotNumber(number), fFourier(fourierDefault),
fMarkerList(markerList), fColorList(colorList)
{
@ -707,7 +707,49 @@ void PMusrCanvas::UpdateDataTheoryPad()
}
// generate the histo plot
if (!fStartWithFourier || (fPlotType == MSR_PLOT_NON_MUSR)) {
PlotData();
} else { // show Fourier straight ahead.
// set the menu properly
fPopupMain->UnCheckEntry(P_MENU_ID_DATA+P_MENU_PLOT_OFFSET*fPlotNumber);
// filter proper Fourier plot tag, and set the menu tags properly
switch (fFourier.fPlotTag) {
case FOURIER_PLOT_REAL:
fCurrentPlotView = PV_FOURIER_REAL;
fPopupFourier->CheckEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_REAL);
fPopupFourier->EnableEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE_PLUS);
fPopupFourier->EnableEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE_MINUS);
break;
case FOURIER_PLOT_IMAG:
fCurrentPlotView = PV_FOURIER_IMAG;
fPopupFourier->CheckEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_IMAG);
fPopupFourier->EnableEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE_PLUS);
fPopupFourier->EnableEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE_MINUS);
break;
case FOURIER_PLOT_REAL_AND_IMAG:
fCurrentPlotView = PV_FOURIER_REAL_AND_IMAG;
fPopupFourier->CheckEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_REAL_AND_IMAG);
fPopupFourier->EnableEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE_PLUS);
fPopupFourier->EnableEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE_MINUS);
break;
case FOURIER_PLOT_POWER:
fCurrentPlotView = PV_FOURIER_PWR;
fPopupFourier->CheckEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PWR);
break;
case FOURIER_PLOT_PHASE:
fCurrentPlotView = PV_FOURIER_PHASE;
fPopupFourier->CheckEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PHASE);
break;
default:
fCurrentPlotView = PV_FOURIER_PWR;
fPopupFourier->CheckEntry(P_MENU_ID_FOURIER+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_FOURIER_PWR);
break;
}
HandleFourier();
PlotFourier();
}
}
//--------------------------------------------------------------------------
@ -3351,10 +3393,14 @@ void PMusrCanvas::HandleFourier()
// check if fourier needs to be calculated
if (fData[0].dataFourierRe == 0) {
Int_t bin;
double startTime = fXmin;
double endTime = fXmax;
if (!fStartWithFourier) { // fHistoFrame presen, hence get start/end from it
bin = fHistoFrame->GetXaxis()->GetFirst();
double startTime = fHistoFrame->GetBinCenter(bin);
startTime = fHistoFrame->GetBinCenter(bin);
bin = fHistoFrame->GetXaxis()->GetLast();
double endTime = fHistoFrame->GetBinCenter(bin);
endTime = fHistoFrame->GetBinCenter(bin);
}
for (UInt_t i=0; i<fData.size(); i++) {
// calculate fourier transform of the data
PFourier fourierData(fData[i].data, fFourier.fUnits, startTime, endTime, fFourier.fDCCorrected, fFourier.fFourierPower);

View File

@ -202,11 +202,13 @@ class PMusrCanvas : public TObject, public TQObject
public:
PMusrCanvas();
PMusrCanvas(const Int_t number, const Char_t* title,
Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh, const Bool_t batch);
Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh, const Bool_t batch,
const Bool_t fourier=false);
PMusrCanvas(const Int_t number, const Char_t* title,
Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh,
PMsrFourierStructure fourierDefault,
const PIntVector markerList, const PIntVector colorList, const Bool_t batch);
const PIntVector markerList, const PIntVector colorList, const Bool_t batch,
const Bool_t fourier=false);
virtual ~PMusrCanvas();
virtual Bool_t IsValid() { return fValid; }
@ -230,6 +232,7 @@ class PMusrCanvas : public TObject, public TQObject
virtual void ExportData(const Char_t *fileName);
private:
Bool_t fStartWithFourier; ///< flag if true, the Fourier transform will be presented bypassing the time domain representation
Int_t fTimeout; ///< timeout after which the Done signal should be emited. If timeout <= 0, no timeout is taking place
Bool_t fScaleN0AndBkg; ///< true=N0 and background is scaled to (1/ns), otherwise (1/bin) for the single histogram case
Bool_t fBatchMode; ///< musrview in ROOT batch mode

View File

@ -85,6 +85,8 @@ bool PAdminXMLParser::startElement( const QString&, const QString&,
fKeyWord = eDefaultSavePath;
} else if (qName == "title_from_data_file") {
fKeyWord = eTitleFromDataFile;
} else if (qName == "musrview_show_fourier") {
fKeyWord = eMusrviewShowFourier;
} else if (qName == "enable_musrt0") {
fKeyWord = eEnableMusrT0;
} else if (qName == "keep_minuit2_output") {
@ -242,6 +244,13 @@ bool PAdminXMLParser::characters(const QString& str)
flag = false;
fAdmin->setTitleFromDataFileFlag(flag);
break;
case eMusrviewShowFourier:
if (str == "y")
flag = true;
else
flag = false;
fAdmin->setMusrviewShowFourierFlag(flag);
break;
case eEnableMusrT0:
if (str == "y")
flag = true;
@ -603,6 +612,8 @@ PAdmin::PAdmin() : QObject()
fInstitute = QString("");
fFileFormat = QString("");
fMusrviewShowFourier = false;
fTitleFromDataFile = false;
fEnableMusrT0 = false;
fLifetimeCorrection = true;

View File

@ -69,7 +69,7 @@ class PAdminXMLParser : public QXmlDefaultHandler
private:
enum EAdminKeyWords {eEmpty, eTimeout, eKeepMinuit2Output, eDumpAscii, eDumpRoot,
eTitleFromDataFile, eChisqPreRunBlock, eEstimateN0, eEnableMusrT0,
eTitleFromDataFile, eChisqPreRunBlock, eEstimateN0, eMusrviewShowFourier, eEnableMusrT0,
eFontName, eFontSize, eExecPath, eDefaultSavePath,
eRecentFile, eBeamline, eInstitute, eFileFormat, eLifetimeCorrection, eMsrDefaultFilePath,
eTheoFuncPixmapPath, eFunc, eFuncName, eFuncComment, eFuncLabel,
@ -118,6 +118,7 @@ class PAdmin : public QObject
QString getExecPath() { return fExecPath; }
QString getDefaultSavePath() { return fDefaultSavePath; }
bool getTitleFromDataFileFlag() { return fTitleFromDataFile; }
bool getMusrviewShowFourierFlag() { return fMusrviewShowFourier; }
bool getEnableMusrT0Flag() { return fEnableMusrT0; }
bool getKeepMinuit2OutputFlag() { return fKeepMinuit2Output; }
bool getDumpAsciiFlag() { return fDumpAscii; }
@ -139,6 +140,7 @@ class PAdmin : public QObject
void setTimeout(const int ival) { fTimeout = ival; }
void setTitleFromDataFileFlag(const bool flag) { fTitleFromDataFile = flag; }
void setMusrviewShowFourierFlag(const bool flag) { fMusrviewShowFourier = flag; }
void setEnableMusrT0Flag(const bool flag) { fEnableMusrT0 = flag; }
void setKeepMinuit2OutputFlag(const bool flag) { fKeepMinuit2Output = flag; }
void setDumpAsciiFlag(const bool flag) { fDumpAscii = flag; }
@ -180,6 +182,7 @@ class PAdmin : public QObject
QVector<QString> fRecentFile; ///< keep vector of recent path-file names
bool fMusrviewShowFourier; ///< flag indicating if musrview should show at startup data (=false) or Fourier of data (=true).
bool fKeepMinuit2Output; ///< flag indicating if the Minuit2 output shall be kept (default: no)
bool fDumpAscii; ///< flag indicating if musrfit shall make an ascii-dump file (for debugging purposes, default: no).
bool fDumpRoot; ///< flag indicating if musrfit shall make an root-dump file (for debugging purposes, default: no).

View File

@ -61,6 +61,7 @@ PPrefsDialog::PPrefsDialog(PAdmin *admin) : fAdmin(admin)
fEnableMusrT0_checkBox->setChecked(fAdmin->getEnableMusrT0Flag());
fPerRunBlockChisq_checkBox->setChecked(fAdmin->getChisqPerRunBlockFlag());
fEstimateN0_checkBox->setChecked(fAdmin->getEstimateN0Flag());
fFourier_checkBox->setChecked(fAdmin->getMusrviewShowFourierFlag());
fTimeout_lineEdit->setText(QString("%1").arg(fAdmin->getTimeout()));
fTimeout_lineEdit->setValidator(new QIntValidator(fTimeout_lineEdit));

View File

@ -46,6 +46,7 @@ class PPrefsDialog : public QDialog, private Ui::PPrefsDialog
public:
PPrefsDialog(PAdmin *admin);
bool getMusrviewShowFourierFlag() { return fFourier_checkBox->isChecked(); }
bool getKeepMinuit2OutputFlag() { return fKeepMn2Output_checkBox->isChecked(); }
bool getTitleFromDataFileFlag() { return fTitleFromData_checkBox->isChecked(); }
bool getEnableMusrT0Flag() { return fEnableMusrT0_checkBox->isChecked(); }

View File

@ -2191,7 +2191,10 @@ void PTextEdit::musrView()
str = *fFilenames.find( currentEditor() );
QString numStr;
numStr.setNum(fAdmin->getTimeout());
cmd += str + "\" --timeout " + numStr + " &";
cmd += str + "\" --timeout " + numStr;
if (fAdmin->getMusrviewShowFourierFlag())
cmd += " -f ";
cmd += " &";
int status=system(cmd.toLatin1());
}
@ -2272,6 +2275,7 @@ void PTextEdit::musrPrefs()
}
if (dlg->exec() == QDialog::Accepted) {
fAdmin->setMusrviewShowFourierFlag(dlg->getMusrviewShowFourierFlag());
fAdmin->setKeepMinuit2OutputFlag(dlg->getKeepMinuit2OutputFlag());
fAdmin->setTitleFromDataFileFlag(dlg->getTitleFromDataFileFlag());
fAdmin->setEnableMusrT0Flag(dlg->getEnableMusrT0Flag());

View File

@ -33,9 +33,9 @@
<item>
<widget class="QTabWidget" name="fTabWidget">
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="tab_3">
<widget class="QWidget" name="fGeneral_tab">
<attribute name="title">
<string>general</string>
</attribute>
@ -75,7 +75,7 @@
</layout>
</widget>
</widget>
<widget class="QWidget" name="tab">
<widget class="QWidget" name="fMusrfit_tab">
<attribute name="title">
<string>musrfit</string>
</attribute>
@ -158,7 +158,25 @@
</property>
</widget>
</widget>
<widget class="QWidget" name="tab_2">
<widget class="QWidget" name="fMusrview_tab">
<attribute name="title">
<string>musrview</string>
</attribute>
<widget class="QCheckBox" name="fFourier_checkBox">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>141</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>start with Fourier</string>
</property>
</widget>
</widget>
<widget class="QWidget" name="fMusrt0_tab">
<attribute name="title">
<string>musrt0</string>
</attribute>

View File

@ -57,9 +57,12 @@ using namespace std;
*/
void musrview_syntax()
{
cout << endl << "usage: musrview <msr-file> [--<graphic-format-extension>] [--timeout <timeout>] | --version | --help";
cout << endl << "usage: musrview <msr-file> [Options]";
cout << endl << " <msr-file>: msr/mlog input file";
cout << endl << " 'musrview <msr-file>' will execute musrview";
cout << endl << " Options:";
cout << endl << " --help : display this help and exit.";
cout << endl << " --version : output version information and exit.";
cout << endl << " -f, --fourier: will directly present the Fourier transform of the <msr-file>.";
cout << endl << " --<graphic-format-extension>: ";
cout << endl << " will produce a graphics-output-file without starting a root session.";
cout << endl << " the name is based on the <msr-file>, e.g. 3310.msr -> 3310_0.png";
@ -71,9 +74,6 @@ void musrview_syntax()
cout << endl << " will produce an ascii dump of the data and fit as plotted.";
cout << endl << " --timeout <timeout>: <timeout> given in seconds after which musrview terminates.";
cout << endl << " If <timeout> <= 0, no timeout will take place. Default <timeout> is 0.";
cout << endl;
cout << endl << " 'musrview' or 'musrview --help' will show this help";
cout << endl << " 'musrview --version' will print the musrview version";
cout << endl << endl;
}
@ -101,6 +101,7 @@ int main(int argc, char *argv[])
int status;
bool success = true;
char fileName[128];
bool fourier = false;
bool graphicsOutput = false;
bool asciiOutput = false;
char graphicsExtension[128];
@ -132,6 +133,8 @@ int main(int argc, char *argv[])
} else if (!strcmp(argv[i], "--help")) {
show_syntax = true;
break;
} else if (!strcmp(argv[i], "-f") || !strcmp(argv[i], "--fourier")) {
fourier = true;
} else if (!strcmp(argv[i], "--eps") || !strcmp(argv[i], "--pdf") || !strcmp(argv[i], "--gif") ||
!strcmp(argv[i], "--jpg") || !strcmp(argv[i], "--png") || !strcmp(argv[i], "--svg") ||
!strcmp(argv[i], "--xpm") || !strcmp(argv[i], "--root")) {
@ -304,10 +307,13 @@ int main(int argc, char *argv[])
startupHandler->GetFourierDefaults(),
startupHandler->GetMarkerList(),
startupHandler->GetColorList(),
graphicsOutput||asciiOutput);
graphicsOutput||asciiOutput,
fourier);
else
musrCanvas = new PMusrCanvas(i, msrHandler->GetMsrTitle()->Data(),
10+i*100, 10+i*100, 800, 600, graphicsOutput||asciiOutput);
10+i*100, 10+i*100, 800, 600,
graphicsOutput||asciiOutput,
fourier);
if (!musrCanvas->IsValid()) {
cerr << endl << ">> musrview **SEVERE ERROR** Couldn't invoke all necessary objects, will quit.";