Skip to content

Commit

Permalink
Update BetaYields (#192)
Browse files Browse the repository at this point in the history
* Change detector physics config defaults

* Change microphysics config defaults

* Change PMT and DAQ config defaults

* Add new context functions

* cleanup

* Bump version: 0.1.1 → 0.2.0

* Update PMT Gain handling

* Update documentation

* Include some code from cutax

* Calculate S1 LCE map from patternmap

* Add _mc to s2_secondary_sc_gain config arg

* Set some default values

* Update context in tests

* Update example notebooks with new context

* bugfix in ElectronDrift

* Add S2 pattern map AFT scaling

* Update Documentation

* Cleanup

* Cleanup

* Bump version: 0.2.0 → 0.3.0

* Revert "Bump version: 0.2.0 → 0.3.0"

This reverts commit ea0df7c.

* Bump version: 0.2.0 → 0.2.1

* cache config args for better performance

* Use new strax.DownChunkingPlugin

* Always save results of fast S1 & S2 plugins

* Change default logging level to INFO

* Increase propagated_s2_photons_file_size_target

* Bump version: 0.2.1 → 0.2.2

* get n_electron from binomial process

* Update documentation

* Bump version: 0.2.2 → 0.2.3

* BugFix

* return correct shaped zero array if empty input

* BugFix

* Use np.around in waveform dtype conversion

* Bump version: 0.2.3 → 0.2.4

* Remove interact. time offset + increase delay cut

* Bump version: 0.2.4 → 0.2.5

* Sort PMT AP photons by time

* Change PMTAfterPulses version number

* Remove unused WFSim functions

* Rename __uniform_pe.. to spe_scaling_fact..

* Refactor pmt_transit_time_spread

* Update plugin versions

* Bugfixing

* Keep only photons with positive photon_gain

* update TPC volume plugins -> Remove primary positions

* Remove cuts when reading the root file

* Remove primary positions from merge clusters

* Add lineage clustering code draft

* Add periodictable to dependencies

* Add option to choose the clustering method when building the context

* Bugfix

* Disable energy cut when loading the root file

* Remove clusters with 0 energy deposit when merging the lineage

* Multiple updates to the lineage reconstruction

* Use base plugins for lineage clustering

* Restructure

* Restructure lineage algorithm

* Fix function after merge commit

* Dtype bugfixing

* Remove zero energy deposits for dbscan clustering

* input

* cluster id dtype problems fixed

* small changes

* rebase input.py

* working lineage

* add beta_brem

* remove main cluster from merged

* gammas were classified as ions

* forgot print

* make beta yields plugin work

* remove file with extra space

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix microphysics only context

* cleanup lineage cluster

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* cleanup

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* cleanup

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add periodictable to requirements

* Common place to define some dtypes and bugfixing

* Save primary positions again

* Bugfixing

* Add test for lineage clustering plugins

* set pri positions in MergeLineage

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Remove empty TPC events

* Remove empty events

* Fix some typo

* Add docstrings

* Bump some plugin versions

* Update plugin config arguments

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* rename g1 and g2

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Remove pickle import

* Add test for BetaYield plugin

* Update exception_message

* Use same defaults for g1g2 as straxen EnergyEstimates

* Remove clustered_interactions_dtype

* Update dtypes

* Bugfixing

* Debug

* Bugfix

* Bugfixing

* Even more bug fixing....

* efficient mem chunking in input plugin

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix time and t bug and dtype

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* forgot import function from common..

* fix bug

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* empty tpc events handling

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* whitespace

* allow empty chunk

* one last chance

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Bugfixing

* float to int in compare boundaries

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* better sorting on float times

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix preselection cut

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Typo

* from cs1/cs2 to n_ph/n_e and make dummy function for test

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix missing import and avoid lambda func

* function needs to be picklable

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* docstring

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* needs to be two functions to be picklable

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix bug on cut_delay

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* do cut delay directly on interactions

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update test_MicroPhysics_alt_Yields.py

fix test

---------

Co-authored-by: cfuselli <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Diego Ramírez García <[email protected]>
  • Loading branch information
4 people authored Jun 27, 2024
1 parent de0d8bf commit 376e025
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions fuse/plugins/micro_physics/yields.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,10 @@ def get_quanta(self, interactions_in_roi):
def quanta_from_spline(self, energy):

with open(self.beta_quanta_spline, "rb") as f:
quanta_function = pickle.load(f)
cs1_poly, cs2_poly = pickle.load(f)

beta_photons, beta_electrons = quanta_function(energy)
beta_photons = cs1_poly(energy)
beta_electrons = cs2_poly(energy)

if self.use_recombination_fluctuation:

Expand Down
4 changes: 2 additions & 2 deletions tests/test_MicroPhysics_alt_Yields.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def yields_dummy_func(x):
To be used as a dummy function for the BetaYields plugin. Needs to
be defined outside the test class to be picklable.
"""
return 40, 30
return 20000


class TestAlternativeYields(unittest.TestCase):
Expand Down Expand Up @@ -62,7 +62,7 @@ def test_BetaYields(self):
# as a function of energy
spline_func_name = os.path.join(self.temp_dir.name, "beta_quanta_spline.pkl")
with open(spline_func_name, "wb") as f:
pickle.dump(yields_dummy_func, f)
pickle.dump((yields_dummy_func, yields_dummy_func), f)

self.test_context.set_config({"beta_quanta_spline": spline_func_name})

Expand Down

0 comments on commit 376e025

Please sign in to comment.