Skip to content

Commit

Permalink
Merge branch 'main' into public_config
Browse files Browse the repository at this point in the history
  • Loading branch information
HenningSE committed Jan 29, 2025
2 parents 6766439 + 50021ec commit 76b1b30
Show file tree
Hide file tree
Showing 17 changed files with 98 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.4.2
current_version = 1.4.4
commit = True
tag = True

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
fail-fast: false
matrix:
os: [ "ubuntu-latest" ]
python-version: [ "3.9", "3.10" ]
python-version: [ "3.10", "3.11" ]
test: [ 'coveralls' ]

steps:
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ sphinx:
build:
os: ubuntu-22.04
apt_packages:
- graphviz
- graphviz
tools:
python: "3.10"

Expand Down
14 changes: 14 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
1.4.4 / 2025-01-25
------------------
* Be compatible with straxen >= 3 (https://github.com/XENONnT/fuse/pull/282)
* Remove CMT URLs, drop python 3.9 (https://github.com/XENONnT/fuse/pull/285)


1.4.3 / 2025-01-13
------------------
* Little bugfix for CSV generators (https://github.com/XENONnT/fuse/pull/273)
* Constraint strax(en) to be less than 2.0.0(3.0.0) (https://github.com/XENONnT/fuse/pull/276)
* Use master for docformatter (https://github.com/XENONnT/fuse/pull/277)
* Fix chunk ends late issue (https://github.com/XENONnT/fuse/pull/275)
* [pre-commit.ci] pre-commit autoupdate (https://github.com/XENONnT/fuse/pull/274)

1.4.2 / 2024-10-16
------------------
* utilix>0.9 compatibility (https://github.com/XENONnT/fuse/pull/267)
Expand Down
2 changes: 1 addition & 1 deletion fuse/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "1.4.2"
__version__ = "1.4.4"

from . import dtypes
from .dtypes import *
Expand Down
16 changes: 6 additions & 10 deletions fuse/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,10 @@ def microphysics_context(
):
"""Function to create a fuse microphysics simulation context."""

st = strax.Context(
storage=strax.DataDirectory(output_folder), **straxen.contexts.xnt_common_opts
)
st = strax.Context(storage=strax.DataDirectory(output_folder), **straxen.contexts.common_opts)

st.config.update(
dict(
detector="XENONnT", check_raw_record_overlaps=True, **straxen.contexts.xnt_common_config
)
dict(detector="XENONnT", check_raw_record_overlaps=True, **straxen.contexts.common_config)
)

# Register microphysics plugins
Expand Down Expand Up @@ -156,13 +152,13 @@ def full_chain_context(
"Take the context defined in cutax if you want to run XENONnT simulations."
)

st = strax.Context(
storage=strax.DataDirectory(output_folder), **straxen.contexts.xnt_common_opts
)
st = strax.Context(storage=strax.DataDirectory(output_folder), **straxen.contexts.common_opts)
st.simulation_config_file = simulation_config_file
st.corrections_run_id = corrections_run_id

st.config.update(
dict( # detector='XENONnT',
check_raw_record_overlaps=True, **straxen.contexts.xnt_common_config
check_raw_record_overlaps=True, **straxen.contexts.common_config
)
)

Expand Down
14 changes: 14 additions & 0 deletions fuse/plugins/detector_physics/csv_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,18 @@ class ChunkCsvInput(FuseBasePlugin):
help="n_interactions_per_chunk",
)

first_chunk_left = straxen.URLConfig(
default=1e6,
type=(int, float),
help="Time left of the first chunk",
)

last_chunk_length = straxen.URLConfig(
default=1e8,
type=(int, float),
help="Time length of the last chunk",
)

def infer_dtype(self):
return microphysics_summary_fields + strax.time_fields

Expand All @@ -85,6 +97,8 @@ def setup(self):
event_rate=self.source_rate,
separation_scale=self.separation_scale,
n_interactions_per_chunk=self.n_interactions_per_chunk,
first_chunk_left=self.first_chunk_left,
last_chunk_length=self.last_chunk_length,
debug=self.debug,
log=self.log,
)
Expand Down
8 changes: 6 additions & 2 deletions fuse/plugins/detector_physics/s1_photon_hits.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ class S1PhotonHits(FuseBasePlugin):
)

gain_model_mc = straxen.URLConfig(
default="cmt://to_pe_model?version=ONLINE&run_id=plugin.run_id",
default=(
"list-to-array://xedocs://pmt_area_to_pes"
"?as_list=True&sort=pmt&detector=tpc"
"&run_id=plugin.run_id&version=ONLINE&attr=value"
),
infer_type=False,
help="PMT gain model",
)
Expand Down Expand Up @@ -96,7 +100,7 @@ def setup(self):
pmt_circuit_load_resistor=self.pmt_circuit_load_resistor,
)

self.pmt_mask = np.array(self.gains) > 0 # Converted from to pe (from cmt by default)
self.pmt_mask = np.array(self.gains) > 0 # Converted from to pe (from xedocs by default)

def compute(self, interactions_in_roi):
# Just apply this to clusters with photons
Expand Down
8 changes: 6 additions & 2 deletions fuse/plugins/detector_physics/s1_photon_propagation.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ class S1PhotonPropagationBase(FuseBasePlugin):
)

gain_model_mc = straxen.URLConfig(
default="cmt://to_pe_model?version=ONLINE&run_id=plugin.run_id",
default=(
"list-to-array://xedocs://pmt_area_to_pes"
"?as_list=True&sort=pmt&detector=tpc"
"&run_id=plugin.run_id&version=ONLINE&attr=value"
),
infer_type=False,
help="PMT gain model",
)
Expand Down Expand Up @@ -143,7 +147,7 @@ def setup(self):
pmt_circuit_load_resistor=self.pmt_circuit_load_resistor,
)

self.pmt_mask = np.array(self.gains) > 0 # Converted from to pe (from cmt by default)
self.pmt_mask = np.array(self.gains) > 0 # Converted from to pe (from xedocs by default)
self.turned_off_pmts = np.nonzero(np.array(self.gains) == 0)[0]

self.spe_scaling_factor_distributions = init_spe_scaling_factor_distributions(
Expand Down
8 changes: 6 additions & 2 deletions fuse/plugins/detector_physics/s2_photon_propagation.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,11 @@ class S2PhotonPropagationBase(FuseBaseDownChunkingPlugin):
)

gain_model_mc = straxen.URLConfig(
default="cmt://to_pe_model?version=ONLINE&run_id=plugin.run_id",
default=(
"list-to-array://xedocs://pmt_area_to_pes"
"?as_list=True&sort=pmt&detector=tpc"
"&run_id=plugin.run_id&version=ONLINE&attr=value"
),
infer_type=False,
help="PMT gain model",
)
Expand Down Expand Up @@ -294,7 +298,7 @@ def setup(self):
pmt_circuit_load_resistor=self.pmt_circuit_load_resistor,
)

self.pmt_mask = np.array(self.gains) > 0 # Converted from to pe (from cmt by default)
self.pmt_mask = np.array(self.gains) > 0 # Converted from to pe (from xedocs by default)
self.turned_off_pmts = np.nonzero(np.array(self.gains) == 0)[0]

self.spe_scaling_factor_distributions = init_spe_scaling_factor_distributions(
Expand Down
6 changes: 5 additions & 1 deletion fuse/plugins/detector_physics/secondary_scintillation.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,11 @@ class SecondaryScintillation(FuseBasePlugin):
)

gain_model_mc = straxen.URLConfig(
default="cmt://to_pe_model?version=ONLINE&run_id=plugin.run_id",
default=(
"list-to-array://xedocs://pmt_area_to_pes"
"?as_list=True&sort=pmt&detector=tpc"
"&run_id=plugin.run_id&version=ONLINE&attr=value"
),
infer_type=False,
help="PMT gain model",
)
Expand Down
16 changes: 15 additions & 1 deletion fuse/plugins/micro_physics/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,18 @@ class ChunkInput(FuseBasePlugin):
help="Filter only nuclear recoil events (maximum ER energy deposit 10 keV)",
)

first_chunk_left = straxen.URLConfig(
default=1e6,
type=(int, float),
help="Time left of the first chunk",
)

last_chunk_length = straxen.URLConfig(
default=1e8,
type=(int, float),
help="Time length of the last chunk",
)

def setup(self):
super().setup()

Expand All @@ -112,6 +124,8 @@ def setup(self):
separation_scale=self.separation_scale,
event_rate=self.source_rate,
cut_delayed=self.cut_delayed,
first_chunk_left=self.first_chunk_left,
last_chunk_length=self.last_chunk_length,
n_interactions_per_chunk=self.n_interactions_per_chunk,
arg_debug=self.debug,
outer_cylinder=None, # This is not running
Expand Down Expand Up @@ -163,8 +177,8 @@ def __init__(
event_rate=1,
n_interactions_per_chunk=500,
cut_delayed=4e12,
last_chunk_length=1e8,
first_chunk_left=1e6,
last_chunk_length=1e8,
chunk_delay_fraction=0.75,
arg_debug=False,
outer_cylinder=None,
Expand Down
6 changes: 5 additions & 1 deletion fuse/plugins/pmt_and_daq/pmt_afterpulses.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ class PMTAfterPulses(FuseBasePlugin):
)

gain_model_mc = straxen.URLConfig(
default="cmt://to_pe_model?version=ONLINE&run_id=plugin.run_id",
default=(
"list-to-array://xedocs://pmt_area_to_pes"
"?as_list=True&sort=pmt&detector=tpc"
"&run_id=plugin.run_id&version=ONLINE&attr=value"
),
infer_type=False,
help="PMT gain model",
)
Expand Down
6 changes: 5 additions & 1 deletion fuse/plugins/truth_information/peak_truth.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ class PeakTruth(strax.OverlapWindowPlugin):
] + strax.time_fields

gain_model_mc = straxen.URLConfig(
default="cmt://to_pe_model?version=ONLINE&run_id=plugin.run_id",
default=(
"list-to-array://xedocs://pmt_area_to_pes"
"?as_list=True&sort=pmt&detector=tpc"
"&run_id=plugin.run_id&version=ONLINE&attr=value"
),
infer_type=False,
help="PMT gain model",
)
Expand Down
6 changes: 5 additions & 1 deletion fuse/plugins/truth_information/records_truth.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ class RecordsTruth(strax.Plugin):
dtype = strax.interval_dtype + dtype

gain_model_mc = straxen.URLConfig(
default="cmt://to_pe_model?version=ONLINE&run_id=plugin.run_id",
default=(
"list-to-array://xedocs://pmt_area_to_pes"
"?as_list=True&sort=pmt&detector=tpc"
"&run_id=plugin.run_id&version=ONLINE&attr=value"
),
infer_type=False,
help="PMT gain model",
)
Expand Down
12 changes: 6 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tool]
[tool.poetry]
name = "xenon-fuse"
version = "1.4.2"
version = "1.4.4"
description = "XENON Framework for Unified Simulations of Events"
authors = [
"Henning Schulze Eißing, <[email protected]>",
Expand All @@ -13,8 +13,8 @@ classifiers = [
"Development Status :: 3 - Alpha",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Intended Audience :: Science/Research",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Scientific/Engineering :: Physics",
Expand All @@ -25,8 +25,8 @@ packages = [
]

[tool.poetry.dependencies]
python = ">=3.9,<4.0"
numpy = "<=1.26.0"
python = ">=3.10,<4.0"
numpy = "*"
pandas = "*"
scipy = "*"
scikit-learn = "*"
Expand All @@ -37,8 +37,8 @@ nestpy = ">=2.0.2"
numba = ">=0.58.1"
awkward = ">=2.5.1"
uproot = ">=5.2.1"
strax = ">=1.6.0,<2.0.0"
straxen = ">=2.2.3,<3.0.0"
strax = ">=2.0.5"
straxen = ">=3.0.3"
utilix = ">=0.11.0"

[build-system]
Expand Down
2 changes: 1 addition & 1 deletion tests/test_plugin_random_seed.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def test_if_negative_seeds_are_intercepted(self):
raise AssertionError(f"Plugin {key} has no seed")

@timeout_decorator.timeout(
TIMEOUT, exception_message="test_if_run_number_changes_deterministic_seed timed out"
TIMEOUT * 2, exception_message="test_if_run_number_changes_deterministic_seed timed out"
)
def test_if_run_number_changes_deterministic_seed(self):

Expand Down

0 comments on commit 76b1b30

Please sign in to comment.