Merged muonspin/musrfit into master
This commit is contained in:
@ -4,10 +4,14 @@
|
||||
|
||||
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:
|
||||
musrFT. Initially it is meant to be used for HAL-9500,
|
||||
i.e. Fourier transform WITHOUT lifetime correction.
|
||||
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
|
||||
a typical msr-file. Duplicate entries from the RUN blocks can be
|
||||
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
|
||||
functions.
|
||||
|
||||
NEW 2015-02-04 Integration of libBNMR for fitting beta-NMR relaxation data
|
||||
into automake of musrfit.
|
||||
|
||||
changes since 0.12.0
|
||||
===================================
|
||||
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 <TROOT.h>
|
||||
#include <TObjString.h>
|
||||
#include <TGFileDialog.h>
|
||||
|
||||
#include "PMusrCanvas.h"
|
||||
#include "PFourier.h"
|
||||
|
||||
static const char *gFiletypes[] = { "Data files", "*.dat",
|
||||
"All files", "*",
|
||||
0, 0 };
|
||||
|
||||
ClassImp(PMusrCanvasPlotRange)
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@ -128,7 +133,6 @@ PMusrCanvas::PMusrCanvas()
|
||||
fImp = 0;
|
||||
fBar = 0;
|
||||
fPopupMain = 0;
|
||||
fPopupSave = 0;
|
||||
fPopupFourier = 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;
|
||||
return;
|
||||
}
|
||||
} else if (id == P_MENU_ID_SAVE_DATA+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_SAVE_ASCII) {
|
||||
SaveDataAscii();
|
||||
} else if (id == P_MENU_ID_EXPORT_DATA+P_MENU_PLOT_OFFSET*fPlotNumber) {
|
||||
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
|
||||
@ -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.
|
||||
*
|
||||
* \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
|
||||
PMusrCanvasAsciiDump dump;
|
||||
PMusrCanvasAsciiDumpVector dumpVector;
|
||||
@ -2014,35 +2033,13 @@ void PMusrCanvas::SaveDataAscii()
|
||||
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
|
||||
ofstream fout;
|
||||
|
||||
// open output data-file
|
||||
fout.open(fln.Data(), iostream::out);
|
||||
fout.open(fileName, iostream::out);
|
||||
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;
|
||||
}
|
||||
|
||||
@ -2366,7 +2363,6 @@ void PMusrCanvas::InitMusrCanvas(const Char_t* title, Int_t wtopx, Int_t wtopy,
|
||||
fImp = 0;
|
||||
fBar = 0;
|
||||
fPopupMain = 0;
|
||||
fPopupSave = 0;
|
||||
fPopupFourier = 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->AddSeparator();
|
||||
|
||||
fPopupSave = new TGPopupMenu();
|
||||
fPopupSave->AddEntry("Save ascii", P_MENU_ID_SAVE_DATA+P_MENU_PLOT_OFFSET*fPlotNumber+P_MENU_ID_SAVE_ASCII);
|
||||
|
||||
fPopupMain->AddPopup("&Save Data", fPopupSave);
|
||||
fPopupMain->AddEntry("Export Data", P_MENU_ID_EXPORT_DATA+P_MENU_PLOT_OFFSET*fPlotNumber);
|
||||
fBar->MapSubwindows();
|
||||
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
|
||||
TGMenuBar *fBar; ///< 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
|
||||
|
||||
// canvas related variables
|
||||
|
@ -67,7 +67,7 @@
|
||||
#define P_MENU_ID_FOURIER 10002
|
||||
#define P_MENU_ID_DIFFERENCE 10003
|
||||
#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
|
||||
|
||||
@ -79,8 +79,6 @@
|
||||
#define P_MENU_ID_FOURIER_PHASE_PLUS 105
|
||||
#define P_MENU_ID_FOURIER_PHASE_MINUS 106
|
||||
|
||||
#define P_MENU_ID_SAVE_ASCII 200
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
@ -229,7 +227,7 @@ class PMusrCanvas : public TObject, public TQObject
|
||||
virtual void LastCanvasClosed(); // SLOT
|
||||
|
||||
virtual void SaveGraphicsAndQuit(Char_t *fileName, Char_t *graphicsFormat);
|
||||
virtual void SaveDataAscii();
|
||||
virtual void ExportData(const Char_t *fileName);
|
||||
|
||||
private:
|
||||
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
|
||||
TGMenuBar *fBar; ///< 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
|
||||
|
||||
// canvas related variables
|
||||
|
@ -340,8 +340,12 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
if (asciiOutput) {
|
||||
// generate export data file name
|
||||
TString str(fileName);
|
||||
str.Remove(str.Last('.'));
|
||||
str += ".dat";
|
||||
// save data in batch mode
|
||||
musrCanvas->SaveDataAscii();
|
||||
musrCanvas->ExportData(str.Data());
|
||||
musrCanvas->Done(0);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user