def test_Convert_binning(): subprocess.check_output(['MJOLNIRConvert', dataFiles[0]]) f = DataFile.DataFile(dataFiles[0].replace('hdf', 'nxs')) assert (f.binning == 8) subprocess.check_output(['MJOLNIRConvert', dataFiles[0], '-b 1']) f = DataFile.DataFile(dataFiles[0].replace('hdf', 'nxs')) assert (f.name == dataFiles[0].split('/')[1].replace('hdf', 'nxs')) assert (f.binning == 1)
def test_Convert_SaveLocation(): if not os.path.isdir('Data/Data'): os.makedirs('Data/Data') subprocess.check_output(['MJOLNIRConvert', dataFiles[0], '-s Data/']) fileName = dataFiles[0].split('/')[1].replace('hdf', 'nxs') f = DataFile.DataFile('Data/' + fileName) assert (f.binning == 8) print(fileName) print(f.name) assert (f.name == fileName)
def test_Convert_SaveLocation(): if not os.path.isdir(os.path.join('Data','Data')): os.makedirs(os.path.join('Data','Data')) subprocess.check_output(['MJOLNIRConvert',dataFiles[0],'-s Data'+os.path.sep]) fileName = dataFiles[0].split(os.path.sep)[1].replace('hdf','nxs') f = DataFile.DataFile('Data'+os.path.sep+fileName) assert(f.binning == 8) print(fileName) print(f.name) assert(f.name == fileName) os.remove('Data'+os.path.sep+fileName.replace('hdf','nxs'))
import sys, os sys.path.append('/home/lass/Dropbox/PhD/Software/MJOLNIR/') from MJOLNIR.Data import DataFile DataFile.assertFile('Data/camea2018n000137.nxs') from MJOLNIR.Data import DataSet from MJOLNIR import _tools def test_cut2D(show=False): import numpy as np import matplotlib.pyplot as plt file = 'Data/camea2018n000137.hdf' DataObj = DataSet.DataSet(dataFiles=file) DataObj.convertDataFile() energy = DataObj.energy EnergyBins = _tools.binEdges(energy, tolerance=0.125) q1 = np.array([1.0, 0]) q2 = np.array([0, 1.0]) width = 0.1 # 1/A minPixel = 0.01 ax, DataList, qBnLit, centerPos, binDIstance = DataObj.plotCutQE( q1, q2, width, minPixel, EnergyBins, rlu=False) plt.colorbar(ax.pmeshs[0]) ax.set_clim(0, 10) plt.tight_layout() ## Cut and plot 1D ax2, DataList, Bins, binCenter, binDistance = DataObj.plotCut1D(
_tools.updateSetting(settingsName, directory) plot = args.plotList binning = args.binning argsIdx = [] booleanList = np.zeros((len(PlotType)), dtype=bool) for arg in plot: argsIdx.append(switch(arg)) argsIdx = np.unique([x for x in argsIdx if x is not None]) booleanList[np.array(argsIdx)] = True File = DataFile.DataFile(file) for id in argsIdx: if PlotType[id] == 'A4': File.plotA4(binning=binning) if PlotType[id] == 'Normalization': File.plotNormalization(binning=binning) if PlotType[id] == 'Ef': File.plotEf(binning=binning) if PlotType[id] == 'EfOverview': File.plotEfOverview(binning=binning)