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

Commit

Permalink
Fix epix to allow version bump (#77)
Browse files Browse the repository at this point in the history
Co-authored-by: dachengx <[email protected]>
  • Loading branch information
WenzDaniel and dachengx authored Jan 14, 2024
1 parent dd79726 commit 3e7ad86
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion epix/clustering.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def find_cluster(interactions, cluster_size_space, cluster_size_time):
# TODO is there a better way to get the df?
df = []
for key in ['x', 'y', 'z', 'ed', 't']:
df.append(ak.to_pandas(interactions[key], anonymous=key))
df.append(ak.to_dataframe(interactions[key], anonymous=key))
df = pd.concat(df, axis=1)

if df.empty:
Expand Down
7 changes: 4 additions & 3 deletions epix/detector_volumes.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,20 +183,21 @@ def in_sensitive_volume(events, sensitive_volumes):
vol.volume_id,
vol.xe_density,
vol.create_S2,
res)
res)
if ind:
new_results = res.snapshot() # Convert ArrayBuilder into true ak.Array
# Now we add the other results, but first test if
# volumes overlap. Only possible if we explicitly loop
# over everything. This reduces performance but adds layer of
# safety.
m = (result['vol_id'] > 0) & (res['vol_id'] == vol.volume_id)
m = (result['vol_id'] > 0) & (new_results['vol_id'] == vol.volume_id)
if ak.any(m):
overlapping_id = result[m][0]
# Get volume name:
name = [vol.name for vol in sensitive_volumes if vol.volume_id == overlapping_id][0]
raise ValueError(f'The volume {vol.name} is overlapping with'
f' volume {name}!')
new_results = res.snapshot()

for field in result.fields:
# Workaround since we cannot sum up records-arrays anymore
result[field] = result[field] + new_results[field]
Expand Down

0 comments on commit 3e7ad86

Please sign in to comment.