Merged muonspin/musrfit into master
This commit is contained in:
@ -4,10 +4,14 @@
|
|||||||
|
|
||||||
changes since 0.13.0
|
changes since 0.13.0
|
||||||
===================================
|
===================================
|
||||||
|
NEW 2015-02-16 changed the data export handling from musrview. It is now more
|
||||||
|
main line and follows the implementation of musrFT.
|
||||||
NEW 2015-02-13 first implementation of a standalone Fourier transform/plotter:
|
NEW 2015-02-13 first implementation of a standalone Fourier transform/plotter:
|
||||||
musrFT. Initially it is meant to be used for HAL-9500,
|
musrFT. Initially it is meant to be used for HAL-9500,
|
||||||
i.e. Fourier transform WITHOUT lifetime correction.
|
i.e. Fourier transform WITHOUT lifetime correction.
|
||||||
A first simple minded lifetime correction is implemented as well.
|
A first simple minded lifetime correction is implemented as well.
|
||||||
|
NEW 2015-02-04 Integration of libBNMR for fitting beta-NMR relaxation data
|
||||||
|
into automake of musrfit.
|
||||||
NEW 2014-12-18 first implementation of a GLOBAL block which allows to shorten
|
NEW 2014-12-18 first implementation of a GLOBAL block which allows to shorten
|
||||||
a typical msr-file. Duplicate entries from the RUN blocks can be
|
a typical msr-file. Duplicate entries from the RUN blocks can be
|
||||||
added here. Furthermore, the 'lifetimecorrection' flag is
|
added here. Furthermore, the 'lifetimecorrection' flag is
|
||||||
@ -17,9 +21,6 @@ NEW 2014-12-18 first implementation of a GLOBAL block which allows to shorten
|
|||||||
parameters (t0, data, fit) has been encapsulated into its own
|
parameters (t0, data, fit) has been encapsulated into its own
|
||||||
functions.
|
functions.
|
||||||
|
|
||||||
NEW 2015-02-04 Integration of libBNMR for fitting beta-NMR relaxation data
|
|
||||||
into automake of musrfit.
|
|
||||||
|
|
||||||
changes since 0.12.0
|
changes since 0.12.0
|
||||||
===================================
|
===================================
|
||||||
NEW 2014-12-04 Fourier: added the unit 'Tesla' needed e.g. for HAL-9500
|
NEW 2014-12-04 Fourier: added the unit 'Tesla' needed e.g. for HAL-9500
|
||||||
|
@ -35,10 +35,15 @@ using namespace std;
|
|||||||
#include <TRandom.h>
|
#include <TRandom.h>
|
||||||
#include <TROOT.h>
|
#include <TROOT.h>
|
||||||
#include <TObjString.h>
|
#include <TObjString.h>
|
||||||
|
#include <TGFileDialog.h>
|
||||||
|
|
||||||
#include "PMusrCanvas.h"
|
#include "PMusrCanvas.h"
|
||||||
#include "PFourier.h"
|
#include "PFourier.h"
|
||||||
|
|
||||||
|
static const char *gFiletypes[] = { "Data files", "*.dat",
|
||||||
|
"All files", "*",
|
||||||
|
0, 0 };
|
||||||
|
|
||||||
ClassImp(PMusrCanvasPlotRange)
|
ClassImp(PMusrCanvasPlotRange)
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
@ -128,7 +133,6 @@ PMusrCanvas::PMusrCanvas()
|
|||||||
fImp = 0;
|
fImp = 0;
|
||||||
fBar = 0;
|
fBar = 0;
|
||||||
fPopupMain = 0;
|
fPopupMain = 0;
|
||||||
fPopupSave = 0;
|
|
||||||
fPopupFourier = 0;
|
fPopupFourier = 0;
|
||||||
|
|
||||||
fStyle = 0;
|
fStyle = 0;
|
||||||
@ -1282,8 +1286,16 @@ void PMusrCanvas::HandleMenuPopup(Int_t id)
|
|||||||
cout << "**INFO** averaging of a single data set doesn't make any sense, will ignore 'a' ..." << endl;
|
cout << "**INFO** averaging of a single data set doesn't make any sense, will ignore 'a' ..." << endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (id == P_MENU_ID_SAVE_DATA+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_SAVE_ASCII) {
|
} else if (id == P_MENU_ID_EXPORT_DATA+P_MENU_PLOT_OFFSET*fPlotNumber) {
|
||||||
SaveDataAscii();
|
static TString dir(".");
|
||||||
|
TGFileInfo fi;
|
||||||
|
fi.fFileTypes = gFiletypes;
|
||||||
|
fi.fIniDir = StrDup(dir);
|
||||||
|
fi.fOverwrite = true;
|
||||||
|
new TGFileDialog(0, fImp, kFDSave, &fi);
|
||||||
|
if (fi.fFilename && strlen(fi.fFilename)) {
|
||||||
|
ExportData(fi.fFilename);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if phase increment/decrement needs to be ghost
|
// check if phase increment/decrement needs to be ghost
|
||||||
@ -1362,13 +1374,20 @@ void PMusrCanvas::SaveGraphicsAndQuit(Char_t *fileName, Char_t *graphicsFormat)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
// SaveDataAscii
|
// ExportData
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* <p>Saves the currently seen data (data, difference, Fourier spectra, ...) in ascii column format.
|
* <p>Saves the currently seen data (data, difference, Fourier spectra, ...) in ascii column format.
|
||||||
|
*
|
||||||
|
* \param fileName file name to be used to save the data.
|
||||||
*/
|
*/
|
||||||
void PMusrCanvas::SaveDataAscii()
|
void PMusrCanvas::ExportData(const Char_t *fileName)
|
||||||
{
|
{
|
||||||
|
if (fileName == 0) { // path file name NOT provided, generate a default path file name
|
||||||
|
cerr << endl << ">> PMusrCanvas::ExportData **ERROR** NO path file name provided. Will do nothing." << endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// collect relevant data
|
// collect relevant data
|
||||||
PMusrCanvasAsciiDump dump;
|
PMusrCanvasAsciiDump dump;
|
||||||
PMusrCanvasAsciiDumpVector dumpVector;
|
PMusrCanvasAsciiDumpVector dumpVector;
|
||||||
@ -2014,35 +2033,13 @@ void PMusrCanvas::SaveDataAscii()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// generate output filename
|
|
||||||
|
|
||||||
// in order to handle names with "." correctly this slightly odd data-filename generation
|
|
||||||
TObjArray *tokens = fMsrHandler->GetFileName().Tokenize(".");
|
|
||||||
TObjString *ostr;
|
|
||||||
TString str;
|
|
||||||
TString fln = TString("");
|
|
||||||
for (Int_t i=0; i<tokens->GetEntries()-1; i++) {
|
|
||||||
ostr = dynamic_cast<TObjString*>(tokens->At(i));
|
|
||||||
fln += ostr->GetString() + TString(".");
|
|
||||||
}
|
|
||||||
if (!fDifferenceView) {
|
|
||||||
fln += "data.ascii";
|
|
||||||
} else {
|
|
||||||
fln += "diff.ascii";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tokens) {
|
|
||||||
delete tokens;
|
|
||||||
tokens = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// open file
|
// open file
|
||||||
ofstream fout;
|
ofstream fout;
|
||||||
|
|
||||||
// open output data-file
|
// open output data-file
|
||||||
fout.open(fln.Data(), iostream::out);
|
fout.open(fileName, iostream::out);
|
||||||
if (!fout.is_open()) {
|
if (!fout.is_open()) {
|
||||||
cerr << endl << ">> PMusrCanvas::SaveDataAscii: **ERROR** couldn't open file " << fln.Data() << " for writing." << endl;
|
cerr << endl << ">> PMusrCanvas::ExportData: **ERROR** couldn't open file " << fileName << " for writing." << endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2366,7 +2363,6 @@ void PMusrCanvas::InitMusrCanvas(const Char_t* title, Int_t wtopx, Int_t wtopy,
|
|||||||
fImp = 0;
|
fImp = 0;
|
||||||
fBar = 0;
|
fBar = 0;
|
||||||
fPopupMain = 0;
|
fPopupMain = 0;
|
||||||
fPopupSave = 0;
|
|
||||||
fPopupFourier = 0;
|
fPopupFourier = 0;
|
||||||
|
|
||||||
fMainCanvas = 0;
|
fMainCanvas = 0;
|
||||||
@ -2415,10 +2411,7 @@ void PMusrCanvas::InitMusrCanvas(const Char_t* title, Int_t wtopx, Int_t wtopy,
|
|||||||
fPopupMain->AddEntry("Average", P_MENU_ID_AVERAGE+P_MENU_PLOT_OFFSET*fPlotNumber);
|
fPopupMain->AddEntry("Average", P_MENU_ID_AVERAGE+P_MENU_PLOT_OFFSET*fPlotNumber);
|
||||||
fPopupMain->AddSeparator();
|
fPopupMain->AddSeparator();
|
||||||
|
|
||||||
fPopupSave = new TGPopupMenu();
|
fPopupMain->AddEntry("Export Data", P_MENU_ID_EXPORT_DATA+P_MENU_PLOT_OFFSET*fPlotNumber);
|
||||||
fPopupSave->AddEntry("Save ascii", P_MENU_ID_SAVE_DATA+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_SAVE_ASCII);
|
|
||||||
|
|
||||||
fPopupMain->AddPopup("&Save Data", fPopupSave);
|
|
||||||
fBar->MapSubwindows();
|
fBar->MapSubwindows();
|
||||||
fBar->Layout();
|
fBar->Layout();
|
||||||
|
|
||||||
|
@ -127,7 +127,6 @@ class PFourierCanvas : public TObject, public TQObject
|
|||||||
TRootCanvas *fImp; ///< ROOT native GUI version of main window with menubar and drawing area
|
TRootCanvas *fImp; ///< ROOT native GUI version of main window with menubar and drawing area
|
||||||
TGMenuBar *fBar; ///< menu bar
|
TGMenuBar *fBar; ///< menu bar
|
||||||
TGPopupMenu *fPopupMain; ///< popup menu MusrFT in the main menu bar
|
TGPopupMenu *fPopupMain; ///< popup menu MusrFT in the main menu bar
|
||||||
// TGPopupMenu *fPopupSave; ///< popup menu of the MusrFT/Save Data sub menu
|
|
||||||
TGPopupMenu *fPopupFourier; ///< popup menu of the MusrFT/Fourier sub menu
|
TGPopupMenu *fPopupFourier; ///< popup menu of the MusrFT/Fourier sub menu
|
||||||
|
|
||||||
// canvas related variables
|
// canvas related variables
|
||||||
|
@ -67,7 +67,7 @@
|
|||||||
#define P_MENU_ID_FOURIER 10002
|
#define P_MENU_ID_FOURIER 10002
|
||||||
#define P_MENU_ID_DIFFERENCE 10003
|
#define P_MENU_ID_DIFFERENCE 10003
|
||||||
#define P_MENU_ID_AVERAGE 10004
|
#define P_MENU_ID_AVERAGE 10004
|
||||||
#define P_MENU_ID_SAVE_DATA 10005
|
#define P_MENU_ID_EXPORT_DATA 10005
|
||||||
|
|
||||||
#define P_MENU_PLOT_OFFSET 1000
|
#define P_MENU_PLOT_OFFSET 1000
|
||||||
|
|
||||||
@ -79,8 +79,6 @@
|
|||||||
#define P_MENU_ID_FOURIER_PHASE_PLUS 105
|
#define P_MENU_ID_FOURIER_PHASE_PLUS 105
|
||||||
#define P_MENU_ID_FOURIER_PHASE_MINUS 106
|
#define P_MENU_ID_FOURIER_PHASE_MINUS 106
|
||||||
|
|
||||||
#define P_MENU_ID_SAVE_ASCII 200
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@ -229,7 +227,7 @@ class PMusrCanvas : public TObject, public TQObject
|
|||||||
virtual void LastCanvasClosed(); // SLOT
|
virtual void LastCanvasClosed(); // SLOT
|
||||||
|
|
||||||
virtual void SaveGraphicsAndQuit(Char_t *fileName, Char_t *graphicsFormat);
|
virtual void SaveGraphicsAndQuit(Char_t *fileName, Char_t *graphicsFormat);
|
||||||
virtual void SaveDataAscii();
|
virtual void ExportData(const Char_t *fileName);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Int_t fTimeout; ///< timeout after which the Done signal should be emited. If timeout <= 0, no timeout is taking place
|
Int_t fTimeout; ///< timeout after which the Done signal should be emited. If timeout <= 0, no timeout is taking place
|
||||||
@ -259,7 +257,6 @@ class PMusrCanvas : public TObject, public TQObject
|
|||||||
TRootCanvas *fImp; ///< ROOT native GUI version of main window with menubar and drawing area
|
TRootCanvas *fImp; ///< ROOT native GUI version of main window with menubar and drawing area
|
||||||
TGMenuBar *fBar; ///< menu bar
|
TGMenuBar *fBar; ///< menu bar
|
||||||
TGPopupMenu *fPopupMain; ///< popup menu Musrfit in the main menu bar
|
TGPopupMenu *fPopupMain; ///< popup menu Musrfit in the main menu bar
|
||||||
TGPopupMenu *fPopupSave; ///< popup menu of the Musrfit/Save Data sub menu
|
|
||||||
TGPopupMenu *fPopupFourier; ///< popup menu of the Musrfit/Fourier sub menu
|
TGPopupMenu *fPopupFourier; ///< popup menu of the Musrfit/Fourier sub menu
|
||||||
|
|
||||||
// canvas related variables
|
// canvas related variables
|
||||||
|
@ -340,8 +340,12 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (asciiOutput) {
|
if (asciiOutput) {
|
||||||
|
// generate export data file name
|
||||||
|
TString str(fileName);
|
||||||
|
str.Remove(str.Last('.'));
|
||||||
|
str += ".dat";
|
||||||
// save data in batch mode
|
// save data in batch mode
|
||||||
musrCanvas->SaveDataAscii();
|
musrCanvas->ExportData(str.Data());
|
||||||
musrCanvas->Done(0);
|
musrCanvas->Done(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user