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

Fix classification of alpha events #70

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
0d9a721
quick fix
cfuselli Feb 9, 2023
5f10d34
Fix calculation for cluster weighted average time (#65)
PavelKavrigin Mar 27, 2023
7479c8f
Update HISTORY for the release
ramirezdiego Mar 28, 2023
73b11f0
Bump version: 0.3.3 → 0.3.4
ramirezdiego Mar 28, 2023
bfdcdb2
Revert "Bump version: 0.3.3 → 0.3.4"
ramirezdiego Mar 28, 2023
251254c
Bump version: 0.3.3 → 0.3.4
ramirezdiego Mar 28, 2023
9541861
Custom microclustering and beta-yields generator (#73)
PavelKavrigin Sep 13, 2023
81077be
Change HISTORY for the release
ramirezdiego Sep 13, 2023
849a496
Bump version: 0.3.4 → 0.3.5
ramirezdiego Sep 13, 2023
10961ef
Fix G4 event number selection (#75)
PavelKavrigin Dec 22, 2023
dd79726
`np.int` is deprecated (#78)
dachengx Jan 14, 2024
3e7ad86
Fix epix to allow version bump (#77)
WenzDaniel Jan 14, 2024
d045288
Bump to v0.3.6 (#79)
dachengx Jan 15, 2024
9f50916
Fix cut_by_eventid again (#80)
PavelKavrigin Jan 25, 2024
d4b73a7
Selection based on total energy deposit in sensitive volume (#76)
MasatoshiKobayashi Feb 7, 2024
459be8c
Minor style changes
ramirezdiego Feb 8, 2024
6c02e2f
Update HISTORY for the realease
ramirezdiego Feb 8, 2024
3a71f67
Bump version: 0.3.6 → 0.3.7
ramirezdiego Feb 8, 2024
5cb12f2
Propagate defaults for energy range arguments (#82)
PavelKavrigin Feb 22, 2024
367af61
Update HISTORY for release
ramirezdiego Feb 23, 2024
883f892
Bump version: 0.3.7 → 0.3.8
ramirezdiego Feb 23, 2024
f96192e
quick fix
cfuselli Feb 9, 2023
99c4f09
Merge branch 'fix_alpha_classification' of github.com:XENONnT/epix in…
cfuselli Feb 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[bumpversion]
current_version = 0.3.3
current_version = 0.3.8
files = setup.py epix/__init__.py
commit = True
tag = True

46 changes: 23 additions & 23 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
# This workflow will upload epix to PyPi using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Upload Python Package
name: PyPI

on:
release:
types: [created]
# Allow manual build if tests are failing first time
workflow_dispatch:
release:
types: [ created ]

jobs:
deploy:

build:
runs-on: ubuntu-latest

permissions:
id-token: write
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
# Setup steps
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: '3.9'

- name: Checkout repo
uses: actions/checkout@v3

- name: Install dependencies
run: pip install wheel

- name: Build package
run: python setup.py sdist bdist_wheel

- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
28 changes: 26 additions & 2 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,31 @@
0.3.8 (2024-02-23)
==================
* Propagate defaults for energy range arguments (#82)

0.3.7 (2024-02-08)
==================
* Selection based on total energy deposit in sensitive volume (#76)
* Fix cut_by_eventid again (#80)

0.3.6 (2024-01-15)
==================
* Fix G4 event number selection with cut_by_eventid (#75)
* `np.int` is deprecated (#78)
* Fix epix to allow version bump (#77)

0.3.5 (2023-09-13)
==================
* Custom microclustering and beta-yields generator (#73)

0.3.4 (2023-03-28)
==================
* Fix calculation for cluster weighted average time (#65)
* Add zenodo badge

0.3.3 (2023-01-09)
==================
* Specify not working numba in req. file by @JoranAngevaare in https://github.com/XENONnT/epix/pull/62
* Install scikit-learn by @JoranAngevaare in https://github.com/XENONnT/epix/pull/63
* Specify not working numba in req. file (#62)
* Install scikit-learn (#63)

0.3.2 (2022-08-15)
==================
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ The other keyword arguments are:
| `--MicroSeparationTime` | Clustering time (ns) | `10` |
| `--TagClusterBy` | decide if you tag the cluster (particle type, energy depositing process) according to first interaction in it (`time`) or most energetic (`energy`) | `energy` |
| `--MaxDelay` | Time after which we cut the rest of the event (ns) | `1e7` |
| `--YieldModel` | Model for yield/quanta generationg (nest or bbf) | `nest` |
| `--MaxEnergy` | Upper range for energy selection _in sensitive volume_ (keV) | `inf` |
| `--MinEnergy` | Lower range for energy selection _in sensitive volume_ (keV) | `-1` |
| `--YieldModel` | Model for yield/quanta generation (nest / bbf / beta) | `nest` |
| `--ClusterMethod` | Microclustering method (dbscan / betadecay / brem) | `dbscan` |
| `--SourceRate` | Event rate for event separation<br /> - `0` for no time shift (G4 time remains)<br /> - `-1` for clean time shift between events<br /> - `>0` (Hz) for random spacing | `0` |
| `--CutNeutron` | Add if you want to filter only nuclear recoil events (maximum ER energy deposit 10 keV) | `false` |
| `--JobNumber` | Job number in full chain simulation. Offset is computed as `JobNumber * n_simulated_events/SourceRate`, where `n_simulated_events` is read from file. | `0` |
Expand Down
12 changes: 11 additions & 1 deletion bin/run_epix
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,17 @@ def pars_args():
help='Event rate for event separation. 0 (default) means no time shift is applied for the '
'different events. Use -1 for clean spacing or give a rate >0 to space events randomly.')
parser.add_argument('--YieldModel', dest='yield', type=str,
default='nest', help = 'Switch between BBF and NEST yield model')
default='nest', help = 'Switch between NEST, BBF, and BETA yield model, '
'[ nest | bbf | beta ]')
parser.add_argument('--ClusterMethod', dest='cluster_method', type=str,
default='dbscan', help = 'Switch between DBSCAN, BETA-DECAY, '
'and BREMSSTRAHLUNG microclustering, [ dbscan | betadecay | brem ]')
parser.add_argument('--MaxEnergy', dest='max_energy', type=float,
action='store', default=float('inf'), #keV
help='Maximum energy in sensitive volume to be stored [keV].')
parser.add_argument('--MinEnergy', dest='min_energy', type=float,
action='store', default=-1, #keV
help='Minimum energy in sensitive volume to be stored [keV].')
parser.add_argument('--JobNumber', dest='job_number', type=int,
action='store', default=0,
help='Job number in full chain simulation. Offset is computed as '
Expand Down
4 changes: 3 additions & 1 deletion epix/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '0.3.3'
__version__ = '0.3.8'

from .common import *
from .io import *
Expand All @@ -10,3 +10,5 @@
from .detectors import *
from .run_epix import *
from .quantgen_wrapper import BBF_quanta_generator
from .quantgen_wrapper import BETA_quanta_generator
from .quantgen_wrapper import NEST_quanta_generator
40 changes: 40 additions & 0 deletions epix/betadecay_cluster.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import numpy as np
import pandas as pd
import uproot
import time
import os
import re
import awkward as ak
import collections


class BetaDecayClustering():

def __init__(self):
pass

def cluster(self, event_tracks_df):
betagamma_df = event_tracks_df[
((event_tracks_df.type == 'e-') & (event_tracks_df.creaproc == 'RadioactiveDecayBase'))
| ((event_tracks_df.type == 'gamma') & (event_tracks_df.creaproc == 'RadioactiveDecayBase'))]
betagamma_df = betagamma_df[
~((betagamma_df.edproc == "Rayl") | (betagamma_df.edproc == "Transportation"))]

betagamma_df['ed'] = betagamma_df.PreStepEnergy - betagamma_df.PostStepEnergy
betagamma_df.loc[betagamma_df.type == 'e-', 'ed'] = betagamma_df.loc[
betagamma_df.type == 'e-', 'PreStepEnergy']
betagamma_df = betagamma_df[betagamma_df.ed > 1e-6]

beta_trackid = []
for ind, row in betagamma_df.iterrows():
if row['type'] == 'gamma':
pass
elif row['type'] == 'e-':
if row['trackid'] in beta_trackid:
betagamma_df.drop(ind, inplace=True)
else:
beta_trackid.append(row['trackid'])
else:
betagamma_df.drop(ind, inplace=True)

return betagamma_df
Loading