diff --git a/stixcore/processing/L0toL1.py b/stixcore/processing/L0toL1.py index e25034d7..087b11c5 100644 --- a/stixcore/processing/L0toL1.py +++ b/stixcore/processing/L0toL1.py @@ -50,8 +50,8 @@ def process_fits_files(self, files=None): batch = 0 prio = 3 product_type = str(file.parent) - if "L0" in file._parts: - product_type = tuple(map(int, file._parts[file._parts.index("L0") + 1 : -1])) + if "L0" in file.parts: + product_type = tuple(map(int, file.parts[file.parts.index("L0") + 1 : -1])) if product_type[0] == 21 and product_type[-1] in {20, 21, 22, 23, 24, 42}: # sci data product_types_batch[product_type] += 1 prio = 2 diff --git a/stixcore/products/level1/quicklookL1.py b/stixcore/products/level1/quicklookL1.py index 6265c506..cfe31489 100644 --- a/stixcore/products/level1/quicklookL1.py +++ b/stixcore/products/level1/quicklookL1.py @@ -249,10 +249,16 @@ def from_level0(cls, l0product, parent=""): # fix for wrong calibration in IDB https://github.com/i4Ds/STIXCore/issues/432 # nix00122 was wrong assumed to be in ds but it is plain s l1.control["integration_time"] = l1.control["integration_time"] * 10 + # rescale for idb >= 36 + scale_lt = 100.0 + scale_qt = 100000.0 + if max([int(vl.split(".")[2]) for vl in l1.idb_versions.keys()]) < 36: + scale_lt = 1 + scale_qt = 0.1 # nix00124 was wrong assumed to be in ds but it is unscaled ms - l1.control["live_time"] = (l1.control["live_time"] / 100.0).to("ms").astype(np.uint32) + l1.control["live_time"] = (l1.control["live_time"] / scale_lt).to("ms").astype(np.uint32) # nix00124 was wrong assumed to be in s but it is us - l1.control["quiet_time"] = (l1.control["quiet_time"] / 100000.0).to("us") + l1.control["quiet_time"] = (l1.control["quiet_time"] / scale_qt).to("us") return l1 diff --git a/stixcore/products/product.py b/stixcore/products/product.py index 02712266..21076cc6 100644 --- a/stixcore/products/product.py +++ b/stixcore/products/product.py @@ -1,9 +1,8 @@ from pathlib import Path -from datetime import datetime +from datetime import datetime, timezone from itertools import chain import numpy as np -import pytz from sunpy.time.timerange import TimeRange from sunpy.util.datatype_factory_base import ( BasicRegistrationFactory, @@ -50,7 +49,7 @@ # date when the min integration time was changed from 1.0s to 0.5s needed to fix count and time # offset issue -MIN_INT_TIME_CHANGE = datetime(2021, 9, 6, 13, tzinfo=pytz.UTC) +MIN_INT_TIME_CHANGE = datetime(2021, 9, 6, 13, tzinfo=timezone.utc) def read_qtable(file, hdu, hdul=None):