From 1c0e0ebb734ec145cdfcbadcf656ef3483e81342 Mon Sep 17 00:00:00 2001 From: Steinn Ymir Agustsson Date: Mon, 9 Oct 2023 15:19:18 +0200 Subject: [PATCH] bugfix --- sed/core/processor.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/sed/core/processor.py b/sed/core/processor.py index c52994ce..d3f86220 100644 --- a/sed/core/processor.py +++ b/sed/core/processor.py @@ -12,6 +12,7 @@ from typing import Union import dask.dataframe as ddf +import dask.array as dda import matplotlib.pyplot as plt import numpy as np import pandas as pd @@ -1193,7 +1194,7 @@ def calibrate_delay_axis( def convert_8s_time( self, step_to_tof:float=None, - sector_delays:Sequece[float]=None, + sector_delays:Sequence[float]=None, ) -> None: """Converts the 8s time in steps to time in ns and sectorID. @@ -1209,17 +1210,18 @@ def convert_8s_time( if step_to_tof is None: step_to_tof = self._config["dataframe"]["step_to_tof"] if sector_delays is None: - sector_delays = self._config["dataframe"].get(["sector_delays"], [0.0] * 8) + sector_delays = self._config["dataframe"].get("sector_delays", [0.0] * 8) - sector_id = self._dataframe["dldTimeSteps"] & 0b111 + sector_id = self._dataframe["dldTimeSteps"] % 8 self._dataframe["dldTime"] = ( - self._dataframe["dldTimeSteps"] >> 3 + self._dataframe["dldTimeSteps"] // 8 ) # convert to ns self._dataframe["dldTime"] *= step_to_tof - # Apply sector delays in nanoseconds - self._dataframe["dldTime"] -= sector_delays[sector_id] - self._dataframe["dldSectorID"] = sector_id + self._dataframe["dldSectorID"] = sector_id.astype(np.int8) + # Apply sector delays in nanoseconds + + self._dataframe["dldTime"] = dda.from_array(sector_delays)[self._dataframe["dldSectorID"].values] metadata = {} metadata["applied"] = True