Skip to content
This repository has been archived by the owner on Jun 5, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' into dependabot/github_actions/actions/setup-py…
Browse files Browse the repository at this point in the history
…thon-5
  • Loading branch information
dachengx authored Apr 22, 2024
2 parents 595c0a0 + ac77c4b commit dbce97b
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 16 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.1.0
current_version = 1.2.1
files = setup.py wfsim/__init__.py
commit = True
tag = True
Expand Down
9 changes: 9 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
v1.2.1 / 2024-02-09
===================
* Total e_dep in sensitive volume propagated to truth (#429)

v1.2.0 / 2024-01-16
===================
* Update readthedocs configuration (#426)
* Move all simulation contexts to WFSim (#430)

v1.1.0 / 2023-09-08
===================
* Change photoionization file format to avoid pkl (#411)
Expand Down
4 changes: 2 additions & 2 deletions extra_requirements/requirements-tests.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
strax>=1.6.0
straxen>=2.2.0
epix>=0.3.6
git+https://github.com/XENONnT/ax_env
epix>=0.3.8
git+https://github.com/XENONnT/base_environment
7 changes: 4 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
strax>=1.1.2
strax>=1.6.0
utilix>=0.5.3
straxen>=0.19.1
straxen>=2.2.0
uproot>=4.0.0
epix
epix>=0.3.7
nestpy

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

setuptools.setup(
name='wfsim',
version='1.1.0',
version='1.2.1',
description='XENONnT Waveform simulator',
author='Wfsim contributors, the XENON collaboration',
url='https://github.com/XENONnT/wfsim',
Expand Down
2 changes: 1 addition & 1 deletion wfsim/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "1.1.0"
__version__ = "1.2.1"

from .core.afterpulse import *
from .core.pulse import *
Expand Down
12 changes: 6 additions & 6 deletions wfsim/core/s2.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ def photon_timings(positions, n_photons_per_xy, _electron_timings, n_photons_per
if config['s2_luminescence_model']=='simple':
_photon_timings = S2.luminescence_timings_simple(positions, n_photons_per_xy,
config=config,
resource=resource)
resource=resource).astype(np.int64)
elif config['s2_luminescence_model']=='garfield':
confine_position=None
if 's2_garfield_confine_position' in config:
Expand All @@ -527,21 +527,21 @@ def photon_timings(positions, n_photons_per_xy, _electron_timings, n_photons_per
_photon_timings = S2.luminescence_timings_garfield(positions, n_photons_per_xy,
config=config,
resource=resource,
confine_position=confine_position)
confine_position=confine_position).astype(np.int64)

elif config['s2_luminescence_model']=='garfield_gas_gap':
_photon_timings = S2.luminescence_timings_garfield_gasgap(positions, n_photons_per_xy,
resource=resource)
resource=resource).astype(np.int64)
else:
raise KeyError(f"{config['s2_luminescence_model']} is not valid! Use 'simple' or 'garfield' or 'garfield_gas_gap'")

# Emission Delay
_photon_timings += Pulse.singlet_triplet_delays(len(_photon_timings), config['singlet_fraction_gas'], config, phase)
_photon_timings += Pulse.singlet_triplet_delays(len(_photon_timings), config['singlet_fraction_gas'], config, phase).astype(np.int64)

# Optical Propagation Delay
if "optical_propagation" in config['s2_time_model']:
# optical propagation splitting top and bottom
_photon_timings += S2.optical_propagation(_photon_channels, config, resource.s2_optical_propagation_spline)
_photon_timings += S2.optical_propagation(_photon_channels, config, resource.s2_optical_propagation_spline).astype(np.int64)
elif "zero_delay" in config['s2_time_model']:
# no optical propagation delay
_photon_timings += np.zeros_like(_photon_timings, dtype=np.int64)
Expand All @@ -554,7 +554,7 @@ def photon_timings(positions, n_photons_per_xy, _electron_timings, n_photons_per
# repeat for n photons per electron # Should this be before adding delays?
_photon_timings += np.repeat(_electron_timings, n_photons_per_ele)

return _photon_timings
return _photon_timings.astype(np.int64)

@staticmethod
def s2_pattern_map_diffuse(n_electron, z, xy, config, resource):
Expand Down
10 changes: 8 additions & 2 deletions wfsim/strax_interface.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from copy import deepcopy
from immutabledict import immutabledict
import sys
import logging
import numpy as np
import pandas as pd
Expand Down Expand Up @@ -30,6 +31,7 @@
(('Number of quanta', 'amp'), np.int32),
(('Recoil type of interaction.', 'recoil'), np.int8),
(('Energy deposit of interaction', 'e_dep'), np.float32),
(('Total energy deposit in the sensitive volume', 'tot_e'), np.float32),
(('Eventid like in geant4 output rootfile', 'g4id'), np.int32),
(('Volume id giving the detector subvolume', 'vol_id'), np.int32),
(('Local field [ V / cm ]', 'local_field'), np.float64),
Expand Down Expand Up @@ -799,8 +801,12 @@ def get_instructions(self):
epix.run_epix.setup(epix_config),
return_wfsim_instructions=True)

if len(self.instructions_epix)==0 and not 'nveto' in self.config['targets']:
print("The instructions are empty for TPC interactions")
sys.exit(0)

self.g4id.append(self.instructions_epix['g4id'])
log.debug("Epix produced %d instructions in tpc" % (len(self.instructions_epix)))
log.debug("Epix produced %d instructions in TPC" % (len(self.instructions_epix)))

if 'nveto' in self.config['targets']:
self.instructions_nveto, self.nveto_channels, self.nveto_timings =\
Expand All @@ -810,7 +816,7 @@ def get_instructions(self):

self.instructions_nveto = self.instructions_nveto[nv_inst_to_keep]
self.g4id.append(self.instructions_nveto['g4id'])
log.debug("%d instructions were produced in nv" % (len(self.instructions_nveto)))
log.debug("%d instructions were produced in nVeto" % (len(self.instructions_nveto)))

self.g4id = np.unique(np.concatenate(self.g4id))
self.set_timing()
Expand Down

0 comments on commit dbce97b

Please sign in to comment.