xedocs 0.2.25__tar.gz → 0.2.27__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. xedocs-0.2.27/AUTHORS.rst +13 -0
  2. {xedocs-0.2.25 → xedocs-0.2.27}/PKG-INFO +7 -4
  3. {xedocs-0.2.25 → xedocs-0.2.27}/README.rst +4 -2
  4. {xedocs-0.2.25 → xedocs-0.2.27}/pyproject.toml +2 -2
  5. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/__init__.py +1 -1
  6. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/_straxen_plugin.py +4 -1
  7. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/data_locations/mongodb.py +21 -4
  8. xedocs-0.2.27/xedocs/schemas/corrections/__init__.py +3 -0
  9. {xedocs-0.2.25/xedocs/schemas/corrections → xedocs-0.2.27/xedocs/schemas/corrections/implementations}/__init__.py +1 -2
  10. {xedocs-0.2.25/xedocs/schemas/corrections → xedocs-0.2.27/xedocs/schemas/corrections/implementations}/avg_se_gain.py +3 -3
  11. {xedocs-0.2.25/xedocs/schemas/corrections → xedocs-0.2.27/xedocs/schemas/corrections/implementations}/baseline_samples_nv.py +1 -1
  12. {xedocs-0.2.25/xedocs/schemas/corrections → xedocs-0.2.27/xedocs/schemas/corrections/implementations}/bayes_model.py +1 -1
  13. {xedocs-0.2.25/xedocs/schemas/corrections → xedocs-0.2.27/xedocs/schemas/corrections/implementations}/cs2_aft_corrections.py +1 -1
  14. {xedocs-0.2.25/xedocs/schemas/corrections → xedocs-0.2.27/xedocs/schemas/corrections/implementations}/electron_diffusion_cte.py +1 -1
  15. {xedocs-0.2.25/xedocs/schemas/corrections → xedocs-0.2.27/xedocs/schemas/corrections/implementations}/electron_drift.py +1 -1
  16. {xedocs-0.2.25/xedocs/schemas/corrections → xedocs-0.2.27/xedocs/schemas/corrections/implementations}/electron_lifetime.py +1 -1
  17. {xedocs-0.2.25/xedocs/schemas/corrections → xedocs-0.2.27/xedocs/schemas/corrections/implementations}/extraction_efficiency.py +2 -2
  18. {xedocs-0.2.25/xedocs/schemas/corrections → xedocs-0.2.27/xedocs/schemas/corrections/implementations}/field_distortion.py +1 -1
  19. {xedocs-0.2.25/xedocs/schemas/corrections → xedocs-0.2.27/xedocs/schemas/corrections/implementations}/global_versions.py +1 -1
  20. {xedocs-0.2.25/xedocs/schemas/corrections → xedocs-0.2.27/xedocs/schemas/corrections/implementations}/hit_thresholds.py +2 -2
  21. {xedocs-0.2.25/xedocs/schemas/corrections → xedocs-0.2.27/xedocs/schemas/corrections/implementations}/hotspot_veto_cut.py +1 -1
  22. {xedocs-0.2.25/xedocs/schemas/corrections → xedocs-0.2.27/xedocs/schemas/corrections/implementations}/photoionization_strength.py +1 -1
  23. {xedocs-0.2.25/xedocs/schemas/corrections → xedocs-0.2.27/xedocs/schemas/corrections/implementations}/pmt_area_to_pe.py +2 -2
  24. {xedocs-0.2.25/xedocs/schemas/corrections → xedocs-0.2.27/xedocs/schemas/corrections/implementations}/position_reconstruction.py +1 -1
  25. {xedocs-0.2.25/xedocs/schemas/corrections → xedocs-0.2.27/xedocs/schemas/corrections/implementations}/relative_light_yield.py +1 -1
  26. {xedocs-0.2.25/xedocs/schemas/corrections → xedocs-0.2.27/xedocs/schemas/corrections/implementations}/s1_aft_xyz.py +1 -1
  27. {xedocs-0.2.25/xedocs/schemas/corrections → xedocs-0.2.27/xedocs/schemas/corrections/implementations}/s1_pattern_maps.py +1 -1
  28. {xedocs-0.2.25/xedocs/schemas/corrections → xedocs-0.2.27/xedocs/schemas/corrections/implementations}/s1_xyz.py +1 -1
  29. {xedocs-0.2.25/xedocs/schemas/corrections → xedocs-0.2.27/xedocs/schemas/corrections/implementations}/s2_pattern_maps.py +1 -1
  30. {xedocs-0.2.25/xedocs/schemas/corrections → xedocs-0.2.27/xedocs/schemas/corrections/implementations}/s2_xy.py +1 -1
  31. xedocs-0.2.27/xedocs/schemas/corrections/implementations/se_gain_partition.py +21 -0
  32. {xedocs-0.2.25/xedocs/schemas/corrections → xedocs-0.2.27/xedocs/schemas/corrections/implementations}/se_gains.py +2 -2
  33. {xedocs-0.2.25/xedocs/schemas/corrections → xedocs-0.2.27/xedocs/schemas/corrections/implementations}/som_network.py +1 -1
  34. {xedocs-0.2.25/xedocs/schemas/corrections → xedocs-0.2.27/xedocs/schemas/corrections/implementations}/z_bias.py +1 -1
  35. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/xedocs.py +38 -3
  36. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/xenon_config.py +1 -0
  37. {xedocs-0.2.25 → xedocs-0.2.27}/tests/__init__.py +0 -0
  38. {xedocs-0.2.25 → xedocs-0.2.27}/tests/test_corrections.py +0 -0
  39. {xedocs-0.2.25 → xedocs-0.2.27}/tests/test_xedocs.py +0 -0
  40. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/_settings.py +0 -0
  41. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/cli.py +0 -0
  42. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/clock.py +0 -0
  43. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/data_locations/__init__.py +0 -0
  44. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/data_locations/api.py +0 -0
  45. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/data_locations/corrections_repo.py +0 -0
  46. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/data_locations/data_folder.py +0 -0
  47. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/data_locations/github.py +0 -0
  48. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/databases.py +0 -0
  49. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/dispatchers.py +0 -0
  50. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/entrypoints.py +0 -0
  51. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/json_records.py +0 -0
  52. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/regex_dispatcher.py +0 -0
  53. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/schemas/__init__.py +0 -0
  54. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/schemas/analysis/__init__.py +0 -0
  55. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/schemas/analysis/base_analysis.py +0 -0
  56. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/schemas/analysis/processing_requests.py +0 -0
  57. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/schemas/base_schemas.py +0 -0
  58. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/schemas/calibrations/__init__.py +0 -0
  59. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/schemas/calibrations/base_calibrations.py +0 -0
  60. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/schemas/calibrations/diffused_calibration.py +0 -0
  61. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/schemas/calibrations/ibelt_calibrations.py +0 -0
  62. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/schemas/calibrations/sources.py +0 -0
  63. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/schemas/calibrations/utube_calibrations.py +0 -0
  64. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/schemas/constants.py +0 -0
  65. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/schemas/context_config.py +0 -0
  66. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/schemas/context_lineage.py +0 -0
  67. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/schemas/corrections/base_corrections.py +0 -0
  68. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/schemas/corrections/base_references.py +0 -0
  69. {xedocs-0.2.25/xedocs/schemas/corrections → xedocs-0.2.27/xedocs/schemas/corrections/implementations}/field_simulation.py +0 -0
  70. {xedocs-0.2.25/xedocs/schemas/corrections → xedocs-0.2.27/xedocs/schemas/corrections/implementations}/lone_hits.py +0 -0
  71. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/schemas/detector_numbers.py +0 -0
  72. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/schemas/fax.py +0 -0
  73. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/schemas/historian_reader.py +0 -0
  74. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/schemas/operations_reports/__init__.py +0 -0
  75. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/schemas/operations_reports/abnormal_rates.py +0 -0
  76. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/schemas/operations_reports/anode_ramp.py +0 -0
  77. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/schemas/operations_reports/anode_washing.py +0 -0
  78. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/schemas/operations_reports/base_report.py +0 -0
  79. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/schemas/operations_reports/hotspot.py +0 -0
  80. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/schemas/plugin_lineages.py +0 -0
  81. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/schemas/pmt_data/__init__.py +0 -0
  82. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/schemas/pmt_data/base_pmt_data.py +0 -0
  83. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/schemas/pmt_data/gain_calculation.py +0 -0
  84. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/schemas/pmt_data/pmt_installs.py +0 -0
  85. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/schemas/pmt_data/pmts.py +0 -0
  86. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/schemas/pmt_data/voltage_changes.py +0 -0
  87. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/schemas/pmt_data/voltage_settings.py +0 -0
  88. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/utils.py +0 -0
  89. {xedocs-0.2.25 → xedocs-0.2.27}/xedocs/widgets.py +0 -0
@@ -0,0 +1,13 @@
1
+ =======
2
+ Credits
3
+ =======
4
+
5
+ Development Lead
6
+ ----------------
7
+
8
+ * Yossi Mosbacher <joe.mosbacher@gmail.com>
9
+
10
+ Contributors
11
+ ------------
12
+
13
+ None yet. Why not be the first?
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: xedocs
3
- Version: 0.2.25
3
+ Version: 0.2.27
4
4
  Summary: Top-level package for xedocs.
5
5
  Home-page: https://github.com/XENONnT/xedocs
6
6
  Author: Yossi Mosbacher
@@ -14,6 +14,7 @@ Classifier: Programming Language :: Python :: 3.8
14
14
  Classifier: Programming Language :: Python :: 3.9
15
15
  Classifier: Programming Language :: Python :: 3.10
16
16
  Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
17
18
  Provides-Extra: all
18
19
  Provides-Extra: db
19
20
  Requires-Dist: appdirs (>=1.4.4,<2.0.0)
@@ -21,7 +22,7 @@ Requires-Dist: click
21
22
  Requires-Dist: parse (>=1.19.1,<2.0.0)
22
23
  Requires-Dist: pymongo ; extra == "db"
23
24
  Requires-Dist: pyyaml (>=6.0,<7.0)
24
- Requires-Dist: rframe (>=0.2.10,<0.3.0)
25
+ Requires-Dist: rframe (>=0.2.20,<0.3.0)
25
26
  Requires-Dist: rich
26
27
  Requires-Dist: tinydb (>=4.7.0,<5.0.0)
27
28
  Requires-Dist: tqdm (>=4.64.1,<5.0.0)
@@ -31,8 +32,10 @@ Description-Content-Type: text/x-rst
31
32
  =======================================
32
33
  XeDocs - XENON Metadata management tool
33
34
  =======================================
34
- xedocs is meant to replace cmt and bodega as well as helping tracking all shared documents especially if
35
- they need to be versioned.
35
+
36
+ XeDocs manages tracking versioned detector numbers, replacing CMT and ideally all hard-coded values.
37
+ XeDocs both looks up data from its own online database, and uses straxen URL-style lookup to find other resources.
38
+ To upload data to the XeDocs database, you must submit it as a PR to https://github.com/XENONnT/corrections
36
39
 
37
40
  What does Xedocs give you
38
41
  =========================
@@ -1,8 +1,10 @@
1
1
  =======================================
2
2
  XeDocs - XENON Metadata management tool
3
3
  =======================================
4
- xedocs is meant to replace cmt and bodega as well as helping tracking all shared documents especially if
5
- they need to be versioned.
4
+
5
+ XeDocs manages tracking versioned detector numbers, replacing CMT and ideally all hard-coded values.
6
+ XeDocs both looks up data from its own online database, and uses straxen URL-style lookup to find other resources.
7
+ To upload data to the XeDocs database, you must submit it as a PR to https://github.com/XENONnT/corrections
6
8
 
7
9
  What does Xedocs give you
8
10
  =========================
@@ -1,7 +1,7 @@
1
1
  [tool]
2
2
  [tool.poetry]
3
3
  name = "xedocs"
4
- version = "0.2.25"
4
+ version = "0.2.27"
5
5
  homepage = "https://github.com/XENONnT/xedocs"
6
6
  description = "Top-level package for xedocs."
7
7
  authors = ["Yossi Mosbacher <joe.mosbacher@gmail.com>"]
@@ -23,7 +23,7 @@ packages = [
23
23
  python = ">=3.8,<4.0"
24
24
  click = "*"
25
25
  rich = "*"
26
- rframe = "^0.2.10"
26
+ rframe = "^0.2.20"
27
27
  pymongo = {version = "*", optional = true}
28
28
  appdirs = "^1.4.4"
29
29
  tinydb = "^4.7.0"
@@ -2,7 +2,7 @@
2
2
 
3
3
  __author__ = """Yossi Mosbacher"""
4
4
  __email__ = "joe.mosbacher@gmail.com"
5
- __version__ = "0.2.25"
5
+ __version__ = "0.2.27"
6
6
 
7
7
 
8
8
  import logging
@@ -50,7 +50,10 @@ def xedocs_protocol(
50
50
  docs = accessor.find_docs(**kwargs)
51
51
 
52
52
  if not docs:
53
- raise KeyError(f"No matching documents found for {name}.")
53
+ raise KeyError(
54
+ f"No matching documents found for {name}. "
55
+ "It is possible that there is no corresponding data."
56
+ )
54
57
 
55
58
  if isinstance(sort, str):
56
59
  docs = sorted(docs, key=lambda x: getattr(x, sort))
@@ -5,9 +5,9 @@ from rframe import DataAccessor
5
5
 
6
6
 
7
7
  def xenon_config_source(settings: BaseSettings) -> Dict[str, Any]:
8
- from xedocs import settings
8
+ from xedocs import settings as xenon_settings
9
9
 
10
- cfg = settings.xenon_config.RunDB
10
+ cfg = xenon_settings.xenon_config.RunDB
11
11
  data = {}
12
12
  if cfg.xent_url:
13
13
  data['host'] = cfg.xent_url
@@ -17,6 +17,14 @@ def xenon_config_source(settings: BaseSettings) -> Dict[str, Any]:
17
17
  data['password'] = cfg.xent_password
18
18
  if cfg.xent_database:
19
19
  data['auth_db'] = cfg.xent_database
20
+ if cfg.max_pool_size:
21
+ data['max_pool_size'] = cfg.max_pool_size
22
+ if cfg.socket_timeout:
23
+ data['socket_timeout'] = cfg.socket_timeout
24
+ if cfg.connect_timeout:
25
+ data['connect_timeout'] = cfg.connect_timeout
26
+ if cfg.read_preference:
27
+ data['read_preference'] = cfg.read_preference
20
28
  return data
21
29
 
22
30
 
@@ -50,17 +58,26 @@ class MongoDB(BaseSettings):
50
58
  host: str = "localhost"
51
59
  connection_uri: str = None
52
60
 
61
+ max_pool_size: int = 100
62
+ socket_timeout: int = 60000
63
+ connect_timeout: int = 60000
64
+ read_preference: str = "secondaryPreferred"
65
+
53
66
  @property
54
67
  def client(self):
55
68
  if self.connection_uri is None:
56
- self.connection_uri = f"mongodb://{self.username}:{self.password}@{self.host}?authSource={self.auth_db}&readPreference=secondary"
69
+ self.connection_uri = f"mongodb://{self.username}:{self.password}@{self.host}?authSource={self.auth_db}"
57
70
  if self.connection_uri not in self.CLIENT_CACHE:
58
71
  self.CLIENT_CACHE[self.connection_uri] = self.make_client(self.connection_uri)
59
72
  return self.CLIENT_CACHE[self.connection_uri]
60
73
 
61
74
  def make_client(self, connection_uri):
62
75
  import pymongo
63
- return pymongo.MongoClient(connection_uri)
76
+ return pymongo.MongoClient(connection_uri,
77
+ maxPoolSize=self.max_pool_size,
78
+ socketTimeoutMS=self.socket_timeout,
79
+ connectTimeoutMS=self.connect_timeout,
80
+ readPreference=self.read_preference)
64
81
 
65
82
  @classmethod
66
83
  def from_utilix(cls, **kwargs):
@@ -0,0 +1,3 @@
1
+ from .implementations import *
2
+ from .base_corrections import *
3
+ from .base_references import *
@@ -1,5 +1,3 @@
1
- from .base_corrections import *
2
- from .base_references import *
3
1
  from .electron_drift import *
4
2
  from .electron_lifetime import *
5
3
  from .extraction_efficiency import *
@@ -26,3 +24,4 @@ from .s2_pattern_maps import *
26
24
  from .s1_pattern_maps import *
27
25
  from .z_bias import *
28
26
  from .cs2_aft_corrections import *
27
+ from .se_gain_partition import *
@@ -9,11 +9,11 @@ wiki:
9
9
 
10
10
  import rframe
11
11
 
12
- from .base_corrections import TimeSampledCorrection
13
- from ..constants import PARTITION
12
+ from ..base_corrections import TimeIntervalCorrection
13
+ from ...constants import PARTITION
14
14
 
15
15
 
16
- class AvgSingleElectronGain(TimeSampledCorrection):
16
+ class AvgSingleElectronGain(TimeIntervalCorrection):
17
17
 
18
18
  _ALIAS = "avg_se_gains"
19
19
  partition: PARTITION = rframe.Index(default="all_tpc")
@@ -8,7 +8,7 @@ wiki:
8
8
  """
9
9
 
10
10
 
11
- from .base_corrections import TimeSampledCorrection
11
+ from ..base_corrections import TimeSampledCorrection
12
12
 
13
13
 
14
14
  class BaselineSamplesNV(TimeSampledCorrection):
@@ -5,7 +5,7 @@ import datetime
5
5
  from typing import Literal
6
6
  import rframe
7
7
 
8
- from .base_references import BaseResourceReference
8
+ from ..base_references import BaseResourceReference
9
9
 
10
10
 
11
11
  class NaiveBayesClassifier(BaseResourceReference):
@@ -6,7 +6,7 @@ https://xe1t-wiki.lngs.infn.it/doku.php?id=xenon:xenonnt:zihao:sr1_s2aft_photoni
6
6
 
7
7
  """
8
8
 
9
- from .base_corrections import TimeSampledCorrection
9
+ from ..base_corrections import TimeSampledCorrection
10
10
 
11
11
 
12
12
  class cS2BottomTopRatioCorrection(TimeSampledCorrection):
@@ -7,7 +7,7 @@
7
7
 
8
8
  import rframe
9
9
 
10
- from .base_corrections import TimeSampledCorrection
10
+ from ..base_corrections import TimeSampledCorrection
11
11
 
12
12
 
13
13
  class ElectronDiffusionCte(TimeSampledCorrection):
@@ -13,7 +13,7 @@ See note on drift velocity, diffusion constant, and drift time at the gate
13
13
 
14
14
  import rframe
15
15
 
16
- from .base_corrections import TimeSampledCorrection
16
+ from ..base_corrections import TimeSampledCorrection
17
17
 
18
18
 
19
19
  class ElectronDriftVelocity(TimeSampledCorrection):
@@ -8,7 +8,7 @@ See [description in the Team C overview page](https://xe1t-wiki.lngs.infn.it/dok
8
8
 
9
9
  """
10
10
 
11
- from .base_corrections import TimeSampledCorrection
11
+ from ..base_corrections import TimeSampledCorrection
12
12
 
13
13
 
14
14
  class ElectronLifetime(TimeSampledCorrection):
@@ -13,8 +13,8 @@ Time dependence of Extraction Efficiency generated from Kr83m calibration data a
13
13
  """
14
14
  import rframe
15
15
 
16
- from .base_corrections import TimeSampledCorrection
17
- from ..constants import PARTITION
16
+ from ..base_corrections import TimeSampledCorrection
17
+ from ...constants import PARTITION
18
18
 
19
19
 
20
20
  class RelExtractionEff(TimeSampledCorrection):
@@ -9,7 +9,7 @@ See [description in the Team C overview page](https://xe1t-wiki.lngs.infn.it/dok
9
9
 
10
10
  """
11
11
 
12
- from .base_references import BaseMap
12
+ from ..base_references import BaseMap
13
13
 
14
14
 
15
15
  class FdcMap(BaseMap):
@@ -1,6 +1,6 @@
1
1
  import rframe
2
2
 
3
- from .base_corrections import TimeIntervalCorrection
3
+ from ..base_corrections import TimeIntervalCorrection
4
4
 
5
5
 
6
6
  class GlobalVersion(TimeIntervalCorrection):
@@ -6,8 +6,8 @@
6
6
 
7
7
  import rframe
8
8
 
9
- from .base_corrections import TimeSampledCorrection
10
- from ..constants import DETECTOR
9
+ from ..base_corrections import TimeSampledCorrection
10
+ from ...constants import DETECTOR
11
11
 
12
12
 
13
13
  class HitThreshold(TimeSampledCorrection):
@@ -4,7 +4,7 @@ which vetos the events with local single electron rate above the threshold in ea
4
4
  Reference: xenon:xenonnt:analysis:hot_spot_cut_summary
5
5
  """
6
6
 
7
- from .base_corrections import TimeIntervalCorrection
7
+ from ..base_corrections import TimeIntervalCorrection
8
8
 
9
9
  class HotspotVetoThreshold(TimeIntervalCorrection):
10
10
  _ALIAS = 'hotspot_veto_thresholds'
@@ -3,7 +3,7 @@
3
3
  https://xe1t-wiki.lngs.infn.it/doku.php?id=xenon:xenonnt_sr1:photoionization_origin
4
4
  """
5
5
 
6
- from .base_corrections import TimeSampledCorrection
6
+ from ..base_corrections import TimeSampledCorrection
7
7
 
8
8
 
9
9
  class PhotoionizationStrength(TimeSampledCorrection):
@@ -8,8 +8,8 @@
8
8
 
9
9
  import rframe
10
10
 
11
- from .base_corrections import TimeSampledCorrection
12
- from ..constants import DETECTOR
11
+ from ..base_corrections import TimeSampledCorrection
12
+ from ...constants import DETECTOR
13
13
 
14
14
 
15
15
  class PmtAreaToPE(TimeSampledCorrection):
@@ -16,7 +16,7 @@ from typing import Literal
16
16
 
17
17
  import rframe
18
18
 
19
- from .base_references import BaseResourceReference
19
+ from ..base_references import BaseResourceReference
20
20
 
21
21
 
22
22
  class PosRecModel(BaseResourceReference):
@@ -11,7 +11,7 @@
11
11
 
12
12
  import rframe
13
13
 
14
- from .base_corrections import TimeSampledCorrection
14
+ from ..base_corrections import TimeSampledCorrection
15
15
 
16
16
 
17
17
  class RelativeLightYield(TimeSampledCorrection):
@@ -6,7 +6,7 @@ Should be treated like a normal correction for dependencies and should be update
6
6
 
7
7
  """
8
8
 
9
- from .base_references import BaseResourceReference
9
+ from ..base_references import BaseResourceReference
10
10
 
11
11
 
12
12
  class S1AFTXYZMap(BaseResourceReference):
@@ -5,7 +5,7 @@ https://xe1t-wiki.lngs.infn.it/doku.php?id=min:s1opticalmap_comparison (Min + Gi
5
5
 
6
6
  """
7
7
 
8
- from .base_references import BaseMap
8
+ from ..base_references import BaseMap
9
9
 
10
10
 
11
11
  class S1PatternMap(BaseMap):
@@ -8,7 +8,7 @@ The jupyter notebook in this folder is replaced by [this](https://github.com/XEN
8
8
 
9
9
  """
10
10
 
11
- from .base_references import BaseMap
11
+ from ..base_references import BaseMap
12
12
 
13
13
 
14
14
 
@@ -15,7 +15,7 @@ https://xe1t-wiki.lngs.infn.it/doku.php?id=xenon:xenon1t:jacques:nt_sr1_s2pl (Ja
15
15
 
16
16
  """
17
17
 
18
- from .base_references import BaseMap
18
+ from ..base_references import BaseMap
19
19
 
20
20
 
21
21
  class S2PatternMap(BaseMap):
@@ -19,7 +19,7 @@ See [description in the Team C overview page](https://xe1t-wiki.lngs.infn.it/dok
19
19
 
20
20
  """
21
21
 
22
- from .base_references import BaseMap
22
+ from ..base_references import BaseMap
23
23
 
24
24
 
25
25
  class S2XYMap(BaseMap):
@@ -0,0 +1,21 @@
1
+ """
2
+ Correction: Region linear and circular for AB/CD partitions
3
+ Affects: Corrected areas
4
+
5
+ Two distinct patterns of evolution of single electron corrections between A+B and C+D. Distinguish thanks to linear and circular regions.
6
+ This TPC partitioning affects the single electron gains - both the average value and not - and the relative extraction efficiency.
7
+
8
+ SR0 wiki: https://xe1t-wiki.lngs.infn.it/doku.php?id=jlong:sr0_2_region_se_correction
9
+ SR1 wiki: https://xe1t-wiki.lngs.infn.it/doku.php?id=xenon:xenonnt:noahhood:corrections:se_gain_ee_final
10
+ """
11
+
12
+ import rframe
13
+
14
+ from ..base_corrections import TimeIntervalCorrection
15
+
16
+ class SingleElectronGainPartition(TimeIntervalCorrection):
17
+
18
+ _ALIAS = "single_electron_gain_partition"
19
+ region: str = rframe.Index(max_length=80)
20
+ value: float
21
+
@@ -13,8 +13,8 @@ Wiki:
13
13
 
14
14
  import rframe
15
15
 
16
- from .base_corrections import TimeSampledCorrection
17
- from ..constants import PARTITION
16
+ from ..base_corrections import TimeSampledCorrection
17
+ from ...constants import PARTITION
18
18
 
19
19
 
20
20
  class SingleElectronGain(TimeSampledCorrection):
@@ -4,7 +4,7 @@ Self-Organizing Map to classify peaklets as one of several SOM_types,
4
4
  as well as classifying those types into either an S1 or an S2
5
5
  """
6
6
 
7
- from .base_references import BaseResourceReference
7
+ from ..base_references import BaseResourceReference
8
8
 
9
9
 
10
10
  class SOMClassifier(BaseResourceReference):
@@ -5,7 +5,7 @@ the observed r(r_obs) and z(z_obs).
5
5
  Reference: xenon:xenonnt:terliuk:drift_field_z_bias_correction
6
6
  """
7
7
 
8
- from .base_references import BaseResourceReference
8
+ from ..base_references import BaseResourceReference
9
9
 
10
10
  class ZBias(BaseResourceReference):
11
11
  _ALIAS = 'z_bias_maps'
@@ -10,6 +10,7 @@ from tqdm.auto import tqdm
10
10
 
11
11
  from ._settings import settings
12
12
  from .schemas import XeDoc
13
+ from .data_locations.mongodb import MongoDB
13
14
 
14
15
 
15
16
  def find_docs(schema, datasource=None, **labels):
@@ -77,6 +78,40 @@ def find_one(schema, datasource=None, **labels):
77
78
 
78
79
 
79
80
  def insert_docs(schema: str, docs: Union[list, dict, pd.DataFrame], datasource=None, dry=False):
81
+ # Currently stuck on how to deal with instances of schemas
82
+ if datasource == 'straxen_db': # switch to straxen_db
83
+ mongo_username = MongoDB().username
84
+ if mongo_username == 'corrections_expert':
85
+ # If statements only trigger
86
+ target_version = "ONLINE"
87
+ # Note to self: This is done in a very dumb way, fix later
88
+ ONLINE_check = True
89
+ if isinstance(docs, pd.DataFrame):
90
+ ONLINE_check = (docs['version'] == target_version).all()
91
+
92
+ elif isinstance(docs, dict):
93
+ ONLINE_check = all(item['version'] == target_version for item in docs)
94
+
95
+ else:
96
+ if isinstance(docs, list):
97
+ if isinstance(docs[0], list) or isinstance(docs[0], dict):
98
+ # It could be a list of dicts, or list or schemas...
99
+ # This can be an actual list or a list of docs
100
+ # these cannot be treated the same
101
+ ONLINE_check = all(item['version'] == target_version for item in docs)
102
+ else:
103
+ # This assumes the last choice is a schema, if not other things will yield errors?
104
+ # This is kinda sloppy...
105
+ ONLINE_check = all(item.version == target_version for item in docs)
106
+ elif hasattr(docs, 'version'):
107
+ if docs.version != target_version: # if version isnt ONLINE
108
+ ONLINE_check = False
109
+ else:
110
+ ONLINE_check = all(item.version == target_version for item in docs)
111
+
112
+ if not ONLINE_check:
113
+ raise ValueError("You are attempting to modify the a straxen_db correction whose version is not ONLINE")
114
+
80
115
  if isinstance(docs, pd.DataFrame):
81
116
  docs = docs.reset_index().to_dict(orient="records")
82
117
  if not isinstance(docs, list):
@@ -125,13 +160,13 @@ def find_schema(name) -> Type[XeDoc]:
125
160
 
126
161
  def get_accessor(schema, db=None):
127
162
  import xedocs
128
-
163
+
129
164
  schema = find_schema(schema)
130
165
  if not issubclass(schema, XeDoc):
131
166
  raise TypeError(
132
167
  "Schema must be a subclass of XeDoc" "or the name of a known schema."
133
168
  )
134
-
169
+
135
170
  if db is None:
136
171
  db = settings.DEFAULT_DATABASE
137
172
  if isinstance(db, str):
@@ -169,7 +204,7 @@ def sync_dbs(from_db, to_db, schemas=None, dry=False):
169
204
 
170
205
  if isinstance(from_db, str):
171
206
  from_db = getattr(xedocs.databases, from_db)()
172
-
207
+
173
208
  if isinstance(to_db, str):
174
209
  to_db = getattr(xedocs.databases, to_db)()
175
210
 
@@ -53,6 +53,7 @@ class RunDBConfig(BaseModel):
53
53
  max_pool_size: int = 100
54
54
  socket_timeout: int = 60000
55
55
  connect_timeout: int = 60000
56
+ read_preference: str = "secondaryPreferred"
56
57
 
57
58
 
58
59
  class StraxenConfig(BaseModel):
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes