From c74d1449e6269820e4531936fb009993d50dfa9b Mon Sep 17 00:00:00 2001 From: Lanqing Yuan Date: Tue, 23 Apr 2024 14:56:50 -0500 Subject: [PATCH 1/7] removed corrections_run_id --- saltax/contexts.py | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/saltax/contexts.py b/saltax/contexts.py index 94222f9..8d7057c 100644 --- a/saltax/contexts.py +++ b/saltax/contexts.py @@ -46,9 +46,6 @@ # ~Infinite raw_records file size to avoid downchunking MAX_RAW_RECORDS_FILE_SIZE_MB = 1e9 -# fuse placeholder parameters -CORRECTION_RUN_ID_DEFAULT = "046477" - # straxen XENONnT options/configuration XNT_COMMON_OPTS = straxen.contexts.xnt_common_opts.copy() XNT_COMMON_CONFIG = straxen.contexts.xnt_common_config.copy() @@ -166,11 +163,6 @@ def xenonnt_salted_fuse( :param kwargs: Extra options to pass to strax.Context or generator :return: strax context """ - # Manually assign a correction_run_id if runid is None - if runid is None: - corrections_run_id = CORRECTION_RUN_ID_DEFAULT - else: - corrections_run_id = runid if (corrections_version is None) & (not run_without_proper_corrections): raise ValueError( "Specify a corrections_version. If you want to run without proper " @@ -209,15 +201,6 @@ def xenonnt_salted_fuse( simulation_config_file = "fuse_config_nt_{:s}.json".format(simu_config_version) fuse.context.set_simulation_config_file(st, simulation_config_file) - local_versions = st.config - for config_name, url_config in local_versions.items(): - if isinstance(url_config, str): - if "run_id" in url_config: - local_versions[config_name] = straxen.URLConfig.format_url_kwargs( - url_config, run_id=corrections_run_id - ) - st.config = local_versions - # Update some run specific config for mc_config, processing_config in run_id_specific_config.items(): if processing_config in st.config: From f8e9a9d2541a94c2453010fdd61d67ca9e4cafef Mon Sep 17 00:00:00 2001 From: Lanqing Yuan Date: Tue, 23 Apr 2024 15:01:02 -0500 Subject: [PATCH 2/7] validate runid in context definition --- saltax/contexts.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/saltax/contexts.py b/saltax/contexts.py index 8d7057c..08ea1a3 100644 --- a/saltax/contexts.py +++ b/saltax/contexts.py @@ -5,9 +5,9 @@ from immutabledict import immutabledict import fuse import logging - -# import pema import pandas as pd +from utilix import xent_collection + logging.basicConfig(handlers=[logging.StreamHandler()]) log = logging.getLogger("fuse.context") @@ -109,6 +109,18 @@ SALTAX_MODES = ["data", "simu", "salt"] +def validate_runid(runid): + """ + Validate runid in RunDB to see if you can use it for computation. + """ + try: + doc = xent_collection().find_one({"number": runid}) + if doc is None: + raise ValueError(f"Run {runid} not found in RunDB") + except Exception as e: + raise ValueError(f"Run {runid} not found in RunDB: {e}") + + def get_generator(generator_name): """Return the generator function for the given instruction mode. @@ -458,6 +470,7 @@ def fxenonnt( ) log.warning("Welcome to data-loading only mode!") else: + validate_runid(runid) log.warning("Welcome to computation mode which only works for run %s!" % (runid)) return xenonnt_salted_fuse( @@ -527,6 +540,7 @@ def sxenonnt( ) log.warning("Welcome to data-loading only mode!") else: + validate_runid(runid) log.warning("Welcome to computation mode which only works for run %s!" % (runid)) return xenonnt_salted_wfsim( From 88f5c8b60119256e2035dc3de69d95e2a08259ae Mon Sep 17 00:00:00 2001 From: Lanqing Yuan Date: Tue, 23 Apr 2024 15:02:31 -0500 Subject: [PATCH 3/7] docstr --- saltax/contexts.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/saltax/contexts.py b/saltax/contexts.py index 08ea1a3..d871df7 100644 --- a/saltax/contexts.py +++ b/saltax/contexts.py @@ -112,6 +112,9 @@ def validate_runid(runid): """ Validate runid in RunDB to see if you can use it for computation. + + :param runid: run number in integer + :return: None """ try: doc = xent_collection().find_one({"number": runid}) From d98096cb83c30cdfb13f0eb0aa56427c8925da0c Mon Sep 17 00:00:00 2001 From: Lanqing Yuan Date: Tue, 23 Apr 2024 15:45:46 -0500 Subject: [PATCH 4/7] remove versions in __init__ --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index a2f0971..4d3e86f 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ author="Lanqing Yuan", description="Salting analysis framework for XENONnT.", long_description=readme, - version="0.1.1", + version="0.1.2", install_requires=requires, setup_requires=["pytest-runner"], tests_require=requires + ["pytest", "hypothesis", "boltons"], From be15a78e8290f3bfbec7363883cd53d8a39b1aae Mon Sep 17 00:00:00 2001 From: Lanqing Yuan Date: Tue, 23 Apr 2024 15:46:24 -0500 Subject: [PATCH 5/7] remove versions in __init__ --- saltax/__init__.py | 2 -- saltax/instructions/__init__.py | 1 - saltax/match/__init__.py | 1 - 3 files changed, 4 deletions(-) diff --git a/saltax/__init__.py b/saltax/__init__.py index d48dd5e..78312ee 100644 --- a/saltax/__init__.py +++ b/saltax/__init__.py @@ -1,5 +1,3 @@ -__version__ = "0.1.1" - from . import instructions from .instructions import * diff --git a/saltax/instructions/__init__.py b/saltax/instructions/__init__.py index d27796c..6669795 100644 --- a/saltax/instructions/__init__.py +++ b/saltax/instructions/__init__.py @@ -1,3 +1,2 @@ -__version__ = "0.1.1" from . import generator from .generator import * diff --git a/saltax/match/__init__.py b/saltax/match/__init__.py index ac27e56..7ec446c 100644 --- a/saltax/match/__init__.py +++ b/saltax/match/__init__.py @@ -1,4 +1,3 @@ -__version__ = "0.1.1" from . import match from .match import * from . import visual From 7010cc7e6ffddf2997bab278efc1cc086225a188 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 23 Apr 2024 20:50:32 +0000 Subject: [PATCH 6/7] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- saltax/contexts.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/saltax/contexts.py b/saltax/contexts.py index d871df7..c479178 100644 --- a/saltax/contexts.py +++ b/saltax/contexts.py @@ -110,8 +110,7 @@ def validate_runid(runid): - """ - Validate runid in RunDB to see if you can use it for computation. + """Validate runid in RunDB to see if you can use it for computation. :param runid: run number in integer :return: None From bdafaf1a32c4d4b628dc5b03f3e7d48b2796ed6f Mon Sep 17 00:00:00 2001 From: Lanqing Yuan Date: Tue, 23 Apr 2024 16:05:41 -0500 Subject: [PATCH 7/7] benchmark --- README.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0b7a956..ef2d877 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,16 @@ cd saltax pip install ./ --user ``` ## Tutorial -Please check notebooks in `notebooks/` +Please check notebooks in `notebooks/`. ## Computing -Please see folder `jobs/` for slurm job submission +Please see folder `jobs/` for slurm job submission. Below you can see a benchmark from a 26seconds Ar37 run, sprinkled 50Hz flat beta band. You can roughly estimate the overhead by scaling it, neglecting the rate dependence in overhead. + +| Step | Overhead [sec] (salt) | Overhead [sec] (simu) | +| :-------------------: | :-------------------: | :-------------------: | +| `microphysics_summary`| 19 | | +| `raw_records_simu` | 210 | | +| `records` | 15 | | +| `peaklets` | 68 | 9 | +| `peak_basics` | 3 | 1 | +| `event_info` | 63 | 11 |