From 0f506e47d43c1e8c6e60a1a771394cd6c456caa7 Mon Sep 17 00:00:00 2001 From: Steinn Ymir Agustsson Date: Sat, 28 Nov 2020 23:56:52 +0100 Subject: [PATCH 1/2] tentative fix for mono structure --- processor/DldFlashDataframeCreator.py | 11 +++++++---- processor/DldProcessor.py | 6 +++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/processor/DldFlashDataframeCreator.py b/processor/DldFlashDataframeCreator.py index 1494bc5..64f78b9 100644 --- a/processor/DldFlashDataframeCreator.py +++ b/processor/DldFlashDataframeCreator.py @@ -486,10 +486,13 @@ def createDataframePerElectronRange(self, mbIndexStart, mbIndexEnd): colNames.append('gmdBda') if 'monochromatorPhotonEnergy' in self.daqAddresses: - monochromatorPhotonEnergyArray = assignToMircobunch( - self.dldMicrobunchId[mbIndexStart:mbIndexEnd, :].astype(np.float64), - self.monochromatorPhotonEnergy[mbIndexStart:mbIndexEnd, :].astype(np.float64)) - daMonochromatorPhotonEnergy = monochromatorPhotonEnergyArray.flatten() + # monochromatorPhotonEnergyArray = assignToMircobunch( + # self.dldMicrobunchId[mbIndexStart:mbIndexEnd, :].astype(np.float64), + # self.monochromatorPhotonEnergy[mbIndexStart:mbIndexEnd, :].astype(np.float64)) + # daMonochromatorPhotonEnergy = monochromatorPhotonEnergyArray.flatten() + monochromatorPhotonEnergyArray = np.zeros_like(self.dldMicrobunchId[mbIndexStart:mbIndexEnd, :]) + monochromatorPhotonEnergyArray[:, :] = (self.monochromatorPhotonEnergyArray[mbIndexStart:mbIndexEnd])[:, None] + daMonochromatorPhotonEnergy = delayStageArray.flatten() arrayCols.append(daMonochromatorPhotonEnergy) colNames.append('monochromatorPhotonEnergy') diff --git a/processor/DldProcessor.py b/processor/DldProcessor.py index 8e8a716..d6f312c 100644 --- a/processor/DldProcessor.py +++ b/processor/DldProcessor.py @@ -568,17 +568,17 @@ def correct_dldTime_shift(df, func, *args): self.dd['dldTime_corrected'] = self.dd.map_partitions(dfops.applyJitter, amp=jitterAmplitude, col='dldTime_corrected', type=jitterType) - if useAvgSampleBias: + if useAvgSampleBias: # eoffset -= self.dd['sampleBias'].mean() else: eoffset -= self.dd['sampleBias'] - if useAvgMonochormatorEnergy: # TODO: add monocrhomator position, + if useAvgMonochormatorEnergy: # TODO: check what bugs this creates! eoffset += self.dd['monochromatorPhotonEnergy'].mean() else: eoffset += self.dd['monochromatorPhotonEnergy'] - if useAvgToFEnergy: # TODO: add monocrhomator position, + if useAvgToFEnergy: eoffset += self.dd['tofVoltage'].mean() else: eoffset += self.dd['tofVoltage'] From f4eb2793cc3065dd22a742192874b6ded5e8f6e0 Mon Sep 17 00:00:00 2001 From: Unknown Date: Mon, 30 Nov 2020 14:11:51 +0100 Subject: [PATCH 2/2] using tqdm auto --- processor/DldProcessor.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/processor/DldProcessor.py b/processor/DldProcessor.py index 1604938..592e265 100644 --- a/processor/DldProcessor.py +++ b/processor/DldProcessor.py @@ -12,7 +12,7 @@ import h5py import numpy as np import pandas as pd -from tqdm import tqdm, tqdm_notebook +from tqdm.auto import tqdm from configparser import ConfigParser from processor.utilities import misc, io, dfops # warnings.resetwarnings() @@ -580,7 +580,6 @@ def correct_dldTime_shift(df, func, *args): if useAvgToFEnergy: # TODO: add monocrhomator position, eoffset += np.nanmean(self.dd['tofVoltage'].values) - else: eoffset += self.dd['tofVoltage'] @@ -1210,7 +1209,7 @@ def analyzePartNumpy(part): with warnings.catch_warnings(): warnings.simplefilter(warnString) - for i in tqdm_notebook(range(0, self.dd.npartitions, self.N_CORES),disable=not usePbar): + for i in tqdm(range(0, self.dd.npartitions, self.N_CORES),disable=not usePbar): resultsToCalculate = [] # process the data in blocks of n partitions (given by the number # of cores):