From 36d9d5675fef77c90f86f56afe6420269da89482 Mon Sep 17 00:00:00 2001 From: Yossi Mosbacher Date: Mon, 21 Aug 2023 17:59:03 +0300 Subject: [PATCH 1/7] expand user --- xedocs/data_locations/data_folder.py | 1 + 1 file changed, 1 insertion(+) diff --git a/xedocs/data_locations/data_folder.py b/xedocs/data_locations/data_folder.py index a5e373d..933b7c0 100644 --- a/xedocs/data_locations/data_folder.py +++ b/xedocs/data_locations/data_folder.py @@ -24,6 +24,7 @@ def storage_kwargs(self, path): def abs_path(self, path): if isinstance(path, list): return [self.abs_path(p) for p in path] + path = os.path.expanduser(path) if not os.path.isabs(path) and self.root is not None: path = os.path.join(self.root, path) return path From 3d4ea17f6096d99b1850972d79d3265d0e3af95d Mon Sep 17 00:00:00 2001 From: Yossi Mosbacher Date: Mon, 21 Aug 2023 18:04:35 +0300 Subject: [PATCH 2/7] expanduser for root also --- xedocs/data_locations/data_folder.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xedocs/data_locations/data_folder.py b/xedocs/data_locations/data_folder.py index 933b7c0..3786228 100644 --- a/xedocs/data_locations/data_folder.py +++ b/xedocs/data_locations/data_folder.py @@ -3,7 +3,7 @@ import yaml import fsspec -from pydantic import BaseSettings +from pydantic import BaseSettings, validator from ..utils import Database, LazyFileAccessor @@ -17,6 +17,9 @@ class Config: protocol: str = "file" config_path: str = "datasets.yml" + @validator("root", pre=True) + def exapnd_user(cls, value): + return os.path.expanduser(value) def storage_kwargs(self, path): return {} From 836470a018ea8d78638cbbf4e7f7d98a8bb44876 Mon Sep 17 00:00:00 2001 From: Yossi Mosbacher Date: Mon, 21 Aug 2023 18:08:24 +0300 Subject: [PATCH 3/7] handle case of root=None --- xedocs/data_locations/data_folder.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xedocs/data_locations/data_folder.py b/xedocs/data_locations/data_folder.py index 3786228..b1d4125 100644 --- a/xedocs/data_locations/data_folder.py +++ b/xedocs/data_locations/data_folder.py @@ -18,8 +18,10 @@ class Config: config_path: str = "datasets.yml" @validator("root", pre=True) - def exapnd_user(cls, value): - return os.path.expanduser(value) + def expand_user(cls, value): + if isinstance(value, str): + value = os.path.expanduser(value) + return value def storage_kwargs(self, path): return {} From c4046dc5a66c2691a8f77ead43f2ae0882499bc9 Mon Sep 17 00:00:00 2001 From: dachengx Date: Tue, 22 Aug 2023 15:41:24 -0500 Subject: [PATCH 4/7] Add z_bias_map schema, time interval piece-wise correction --- xedocs/schemas/corrections/z_bias.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 xedocs/schemas/corrections/z_bias.py diff --git a/xedocs/schemas/corrections/z_bias.py b/xedocs/schemas/corrections/z_bias.py new file mode 100644 index 0000000..b44cecf --- /dev/null +++ b/xedocs/schemas/corrections/z_bias.py @@ -0,0 +1,11 @@ +""" +The 'z_bias_map' calculate the z correction due to non-uniform drift velocity based on +the observed r(r_obs) and z(z_obs). + +Reference: xenon:xenonnt:terliuk:drift_field_z_bias_correction +""" + +from .base_corrections import TimeIntervalCorrection + +class ZBias(TimeIntervalCorrection): + _ALIAS = 'z_bias_map' From c318a236b5c148cfb9e7950b6f44f93d82d3b148 Mon Sep 17 00:00:00 2001 From: dachengx Date: Wed, 23 Aug 2023 09:57:27 -0500 Subject: [PATCH 5/7] Add value attribute --- xedocs/schemas/corrections/z_bias.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xedocs/schemas/corrections/z_bias.py b/xedocs/schemas/corrections/z_bias.py index b44cecf..a517a9f 100644 --- a/xedocs/schemas/corrections/z_bias.py +++ b/xedocs/schemas/corrections/z_bias.py @@ -8,4 +8,5 @@ from .base_corrections import TimeIntervalCorrection class ZBias(TimeIntervalCorrection): - _ALIAS = 'z_bias_map' + _ALIAS = 'z_bias_maps' + value: str From dbf095af1a39828ebfce853719d06435c2dde650 Mon Sep 17 00:00:00 2001 From: dachengx Date: Wed, 23 Aug 2023 13:16:35 -0500 Subject: [PATCH 6/7] Use BaseResourceReference instead, and set fmt to json.gz --- xedocs/schemas/corrections/z_bias.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xedocs/schemas/corrections/z_bias.py b/xedocs/schemas/corrections/z_bias.py index a517a9f..05bc16d 100644 --- a/xedocs/schemas/corrections/z_bias.py +++ b/xedocs/schemas/corrections/z_bias.py @@ -5,8 +5,8 @@ Reference: xenon:xenonnt:terliuk:drift_field_z_bias_correction """ -from .base_corrections import TimeIntervalCorrection +from .base_references import BaseResourceReference -class ZBias(TimeIntervalCorrection): +class ZBias(BaseResourceReference): _ALIAS = 'z_bias_maps' - value: str + fmt = 'json.gz' From a8564dfd739054b4cd2c2134abd7448be7e59531 Mon Sep 17 00:00:00 2001 From: Yossi Mosbacher Date: Wed, 23 Aug 2023 21:22:12 +0300 Subject: [PATCH 7/7] add import in __init__ --- xedocs/schemas/corrections/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/xedocs/schemas/corrections/__init__.py b/xedocs/schemas/corrections/__init__.py index c398893..6dd5dc3 100644 --- a/xedocs/schemas/corrections/__init__.py +++ b/xedocs/schemas/corrections/__init__.py @@ -22,3 +22,4 @@ from .som_network import * from .hotspot_veto_cut import * from .photoionization_strength import * +from .z_bias import *