Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fused CSV input plugins #114

Merged
merged 37 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
af1172d
renamed energy deposit
FaroutYLq Apr 18, 2024
e674b74
revert; it's wrong
FaroutYLq Apr 18, 2024
6800f92
renamed records and peaklets
FaroutYLq Apr 18, 2024
1b2dd2b
scratch
FaroutYLq Apr 21, 2024
b2b2ff0
translator from scratch
FaroutYLq Apr 21, 2024
086fa3f
removed redundant translator
FaroutYLq Apr 21, 2024
1308601
debug indent
FaroutYLq Apr 21, 2024
75df43f
draft for translator
FaroutYLq Apr 21, 2024
a2f7563
faster
FaroutYLq Apr 21, 2024
34bda2e
debug
FaroutYLq Apr 21, 2024
46cba94
debug
FaroutYLq Apr 21, 2024
6393aca
fix types
FaroutYLq Apr 21, 2024
7ab2890
first row
FaroutYLq Apr 21, 2024
fb1bf3e
debug and acceleration
FaroutYLq Apr 21, 2024
964512a
debug dtype
FaroutYLq Apr 21, 2024
ecdfeae
avoid splitting
FaroutYLq Apr 21, 2024
aa1e4cd
init
FaroutYLq Apr 21, 2024
e336df3
docstr
FaroutYLq Apr 21, 2024
78a936f
docstr
FaroutYLq Apr 21, 2024
17241d2
debug
FaroutYLq Apr 21, 2024
97a3f65
naming bug
FaroutYLq Apr 21, 2024
d05b07d
raw_records_simu
FaroutYLq Apr 21, 2024
dd9a8e3
raw_records_simu
FaroutYLq Apr 21, 2024
a4c1e14
sanity
FaroutYLq Apr 21, 2024
c0064d2
don't register
FaroutYLq Apr 21, 2024
ebd2d18
debug
FaroutYLq Apr 21, 2024
6407481
fixed options
FaroutYLq Apr 21, 2024
ea27a14
fixed options
FaroutYLq Apr 21, 2024
eaed028
debug
FaroutYLq Apr 21, 2024
4142414
debug
FaroutYLq Apr 21, 2024
5dfafdb
debug
FaroutYLq Apr 21, 2024
2c369e0
debug
FaroutYLq Apr 21, 2024
a56d477
debug
FaroutYLq Apr 21, 2024
2eee395
debug
FaroutYLq Apr 22, 2024
c2004c3
debug
FaroutYLq Apr 22, 2024
18e8501
debug
FaroutYLq Apr 22, 2024
c66a063
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 22, 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
57 changes: 41 additions & 16 deletions saltax/contexts.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
# Plugins to merge delayed and regular electrons
DELAYED_ELECTRON_MERGER_PLUGINS = fuse.context.delayed_electron_merger_plugins
# Plugins to simulate PMTs and DAQ
# TODO: this plugin fuse.pmt_and_daq.PMTResponseAndDAQ will be replaced
PMT_AND_DAQ_PLUGINS = fuse.context.pmt_and_daq_plugins
# Plugins to get truth information
TRUTH_INFORMATION_PLUGINS = fuse.context.truth_information_plugins
Expand All @@ -39,6 +38,13 @@
PMT_AND_DAQ_PLUGINS,
TRUTH_INFORMATION_PLUGINS,
]
FUSE_DONT_REGISTER = [
fuse.plugins.micro_physics.microphysics_summary.MicroPhysicsSummary,
fuse.plugins.pmt_and_daq.pmt_response_and_daq.PMTResponseAndDAQ,
]

# ~Infinite raw_records file size to avoid downchunking
MAX_RAW_RECORDS_FILE_SIZE_MB = 1e9

# fuse placeholder parameters
CORRECTION_RUN_ID_DEFAULT = "046477"
Expand All @@ -48,19 +54,35 @@
XNT_COMMON_CONFIG = straxen.contexts.xnt_common_config.copy()
XNT_SIMULATION_CONFIG = straxen.contexts.xnt_simulation_config.copy()

# saltax options overrides
# wfsim based saltax options overrides
SXNT_COMMON_OPTS_REGISTER = XNT_COMMON_OPTS["register"].copy()
SXNT_COMMON_OPTS_REGISTER.remove(straxen.Peaklets)
SXNT_COMMON_OPTS_REGISTER.remove(straxen.PulseProcessing)
SXNT_COMMON_OPTS_REGISTER = [
saltax.SPulseProcessing,
saltax.SRawRecordsFromFaxNT,
] + SXNT_COMMON_OPTS_REGISTER
XNT_COMMON_OPTS_OVERRIDE = dict(
SXNT_COMMON_OPTS_OVERRIDE = dict(
register=SXNT_COMMON_OPTS_REGISTER,
)
SXNT_COMMON_OPTS = XNT_COMMON_OPTS.copy()
SXNT_COMMON_OPTS["register"] = XNT_COMMON_OPTS_OVERRIDE["register"]

SXNT_COMMON_OPTS["register"] = SXNT_COMMON_OPTS_OVERRIDE["register"]

# fuse based saltax options overrides
FXNT_COMMON_OPTS_REGISTER = XNT_COMMON_OPTS["register"].copy()
FXNT_COMMON_OPTS_REGISTER.remove(straxen.Peaklets)
FXNT_COMMON_OPTS_REGISTER.remove(straxen.PulseProcessing)
FXNT_COMMON_OPTS_REGISTER = [
saltax.SChunkCsvInput,
saltax.SPeaklets,
saltax.SPulseProcessing,
saltax.SPMTResponseAndDAQ,
] + FXNT_COMMON_OPTS_REGISTER
FXNT_COMMON_OPTS_OVERRIDE = dict(
register=FXNT_COMMON_OPTS_REGISTER,
)
FXNT_COMMON_OPTS = XNT_COMMON_OPTS.copy()
FXNT_COMMON_OPTS["register"] = FXNT_COMMON_OPTS_OVERRIDE["register"]

# saltax configuration overrides
SCHANNEL_STARTS_AT = 3000
Expand Down Expand Up @@ -161,20 +183,23 @@ def xenonnt_salted_fuse(
"Take the context defined in cutax if you want to run XENONnT simulations."
)

st = strax.Context(storage=strax.DataDirectory(output_folder), **XNT_COMMON_OPTS)

st.config.update(
dict(
# detector='XENONnT',
check_raw_record_overlaps=True,
**XNT_COMMON_OPTS,
**FXNT_COMMON_CONFIG,
)
if kwargs is not None:
context_options = dict(**FXNT_COMMON_OPTS, **kwargs)
else:
context_options = FXNT_COMMON_OPTS.copy()
context_config = dict(
detector="XENONnT",
check_raw_record_overlaps=True,
**FXNT_COMMON_CONFIG,
)
st = strax.Context(
storage=strax.DataDirectory(output_folder), config=context_config, **context_options
)

for plugin_list in FUSED_PLUGINS:
for plugin in plugin_list:
st.register(plugin)
if plugin not in FUSE_DONT_REGISTER:
st.register(plugin)

if corrections_version is not None:
st.apply_xedocs_configs(version=corrections_version)
Expand Down Expand Up @@ -233,7 +258,7 @@ def xenonnt_salted_fuse(
st.set_config(
{
"input_file": instr_file_name,
# "n_interactions_per_chunk": 50, #TODO: Surgery needed here
"raw_records_file_size_target": MAX_RAW_RECORDS_FILE_SIZE_MB,
}
)

Expand Down
4 changes: 2 additions & 2 deletions saltax/plugins/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
Modified `straxen` [data structure](https://straxen.readthedocs.io/en/latest/reference/datastructure_nT.html) up to `peaklets`. Everything above is designed to be exactly the same as `straxen`.
## Structure
- `s_raw_records.py`: Modified `raw_records` specifically for simulated `raw_records`, which determine chunking time range based on the ones' from `raw_reocrds`
- `s_records.py`: Modified `records`, which combines `raw_reords` and `raw_records_simu` together. The latter one's channel starts at constant variable `SCHANNEL_STARTS_AT`.
- `s_peaklets.py`: Modified `peaklets`, which build peaks as there are `2*n_tpc_pmts` channels, but sum up per-channel information (`area_per_channel` and top-bottom specific fields) as if there are only `n_tpc_pmts`.
- `records.py`: Modified `records`, which combines `raw_reords` and `raw_records_simu` together. The latter one's channel starts at constant variable `SCHANNEL_STARTS_AT`.
- `peaklets.py`: Modified `peaklets`, which build peaks as there are `2*n_tpc_pmts` channels, but sum up per-channel information (`area_per_channel` and top-bottom specific fields) as if there are only `n_tpc_pmts`.
## Data Structure
<img width="521" alt="image" src="https://github.com/FaroutYLq/saltax/assets/47046530/9c3ef86c-a171-4082-914a-98f6eee14a58">

Expand Down
11 changes: 7 additions & 4 deletions saltax/plugins/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
from . import f_raw_records
from .f_raw_records import *

from . import s_raw_records
from .s_raw_records import *

from . import s_records
from .s_records import *
from . import records
from .records import *

from . import s_peaklets
from .s_peaklets import *
from . import peaklets
from .peaklets import *
Loading
Loading