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

Dev update trace ci32 #79

Merged
merged 35 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
9e611a9
first update grand-mother/collab-issues#32
luckyjim Jan 23, 2024
fb4382f
Merge remote-tracking branch 'origin/73_dev_efield2voltage' into dev_…
luckyjim Jan 29, 2024
d9637bd
simplify class name Handling3dTraces
luckyjim Feb 1, 2024
6f41cb8
code review, rename, add doc
luckyjim Feb 1, 2024
c7d928c
rename update
luckyjim Feb 1, 2024
068053e
fix bug
luckyjim Feb 1, 2024
c8a9a4e
refactoring test with pytest, in progress ...
luckyjim Feb 1, 2024
e929a76
update test
luckyjim Feb 2, 2024
f4054f6
format
luckyjim Feb 2, 2024
25e7103
remove
luckyjim Feb 5, 2024
945d80a
update test hilbert t_max, v_max
luckyjim Feb 5, 2024
4153beb
read only one time files of directory with memory cache
luckyjim Feb 6, 2024
59daee5
update minor, test files missing for new version of GRANDROOT
luckyjim Feb 6, 2024
c6ec3e7
just add flaf for plot
luckyjim Feb 6, 2024
6e6d49e
add causal passband filter
luckyjim Feb 6, 2024
a5e0ebb
rename function, clean user interface
luckyjim Feb 6, 2024
15962b5
add snr estimation in interface
luckyjim Feb 6, 2024
5a94c10
update doc
luckyjim Feb 6, 2024
1abf7fb
update intro notebook and Handle3dTraces notebook, debuging
luckyjim Feb 8, 2024
d0d6f1a
remove obsolet comment and add subtitle
luckyjim Feb 8, 2024
0e57bcf
name correction typo
luckyjim Feb 9, 2024
55e9826
fix problem with ident pos_xyz and temporary fix with sampling freq
luckyjim Feb 13, 2024
af0b3f1
Merge branch '73_dev_for_merge' into dev_update_trace_ci32
luckyjim Feb 20, 2024
36abef9
use DataDirectory from root_tree to define trun and tshower, issue
luckyjim Feb 20, 2024
078aa90
improve multi-event infos, grand-mother/collab-issues#32
luckyjim Feb 20, 2024
36f8db2
fix small problem, update notebook, grand-mother/collab-issues#32
luckyjim Feb 20, 2024
ab4f131
Merge remote-tracking branch 'origin/dev_sim2root' into dev_update_tr…
luckyjim Feb 20, 2024
c77c32a
quality code with sonarqub, update notebook
luckyjim Feb 21, 2024
0704422
Merge remote-tracking branch 'origin/dev_sim2root' into dev_update_tr…
luckyjim Feb 21, 2024
a1a5acd
check idx with nb sample
luckyjim Feb 23, 2024
f30082c
add plot tmax x vmax
luckyjim Feb 28, 2024
eecd083
remove obsolet directory and remove broot from installation
luckyjim Mar 1, 2024
3f49a78
fix unit issue
luckyjim Mar 1, 2024
8b62454
Merge remote-tracking branch 'origin/dev_sim2root' into dev_update_tr…
luckyjim Mar 1, 2024
7b4a866
Merge remote-tracking branch 'origin/dev_sim2root' into dev_update_tr…
luckyjim Mar 7, 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
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,5 @@ docs/apidoc-only/sphinx/source/grand.*
# mac
.DS_Store

*.pyc
sim2root/CoREASRawRoot/__pycache__/CorsikaInfoFuncs.cpython-310.pyc
*.pyc


3 changes: 2 additions & 1 deletion env/_setup_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ echo "add grand/quality to PATH"
echo "=============================="

export PATH=$GRAND_ROOT/scripts:$PATH
echo "add grand/scripts to PATH "
export PATH=$GRAND_ROOT/examples/dataio:$PATH
echo "add scripts to PATH "
echo "=============================="

export PYTHONPATH=$GRAND_ROOT:$PYTHONPATH
Expand Down
1,206 changes: 1,206 additions & 0 deletions examples/basis/class_Handling3dTraces.ipynb

Large diffs are not rendered by default.

48 changes: 34 additions & 14 deletions examples/dataio/ioroot_3dtraces.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#! /usr/bin/env python3

import argparse
from grand.dataio.root_files import get_file_event, get_ttree_in_file
from grand.basis.traces_event import Handling3dTracesOfEvent
from grand.dataio.root_files import get_file_event, _get_ttree_in_file
from grand.basis.traces_event import Handling3dTraces
import grand.manage_log as mlg
import matplotlib.pylab as plt

Expand Down Expand Up @@ -41,6 +41,12 @@ def manage_args():
help="plot trace x,y,z and power spectrum of detector unit (DU)",
default=-100,
)
parser.add_argument(
"--idx_evt",
type=int,
help="Select event with index <idx_evt>, given by -i option, idx_evt is always > 0 or = 0",
default=-100,
)
parser.add_argument(
"--trace_image",
action="store_true",
Expand All @@ -64,14 +70,14 @@ def manage_args():
type=int,
default=-100,
help="dump trace of DU",
) # retrieve argument
) # retrieve argument
parser.add_argument(
"-i",
"--info",
action="store_true",
required=False,
help="some information about the contents of the file",
) # retrieve argument
) # retrieve argument
return parser.parse_args()


Expand All @@ -81,39 +87,53 @@ def main():

args = manage_args()
d_event = get_file_event(args.file.name)
if args.idx_evt != -100:
if args.idx_evt < 0:
logger.error("index events must >= 0")
return
if args.idx_evt >= d_event.get_nb_events():
logger.error(f"index events must < {d_event.get_nb_events()}")
return
d_event.load_event_idx(args.idx_evt)
o_tevent = d_event.get_obj_handling3dtraces()
if args.info:
print(f"Nb events : {d_event.get_nb_events()}")
print("Idx\trun_nb\tevent_nb")
for idx, evt in enumerate(d_event.l_events):
print(f"{idx}\t{evt[1]}\t{evt[0]}")
print(f"Select event index: {d_event.idx_event}")
print("===================")
print(f"Nb DU : {d_event.get_du_count()}")
print(f"Size trace : {d_event.get_size_trace()}")
print(f"TTree : {get_ttree_in_file(args.file.name)}")
assert isinstance(o_tevent, Handling3dTracesOfEvent)

assert isinstance(o_tevent, Handling3dTraces)
if args.list_du:
print(f"Identifier DU : {o_tevent.d_idxdu.keys()}")
print(f"Identifier DU : {o_tevent.idx2idt}")
if args.trace_image:
o_tevent.plot_all_traces_as_image()
if args.footprint:
o_tevent.plot_footprint_4d_max()
o_tevent.plot_footprint_val_max()
if args.time_val:
o_tevent.plot_footprint_val_max_inter()
o_tevent.plot_footprint_time_slider()
if args.trace != -100:
if not args.trace in o_tevent.d_idxdu.keys():
if not args.trace in o_tevent.idt2idx.keys():
logger.error(f"ERROR: unknown DU identifer")
return
o_tevent.plot_trace_du(args.trace)
o_tevent.plot_ps_trace_du(args.trace)
o_tevent.plot_psd_trace_du(args.trace)
if args.list_ttree:
print(get_ttree_in_file(args.file.name))
print(_get_ttree_in_file(args.file.name))
if args.dump != -100:
if not args.dump in o_tevent.d_idxdu.keys():
if not args.dump in o_tevent.idt2idx.keys():
logger.error(f"ERROR: unknown DU identifer")
return
idx_du = o_tevent.d_idxdu[args.dump]
idx_du = o_tevent.idt2idx[args.dump]
tr_du = o_tevent.traces[idx_du]
t_tr = o_tevent.t_samples[idx_du]
for idx in range(o_tevent.get_size_trace()):
print(f"{t_tr[idx]} {tr_du[0,idx]} {tr_du[1,idx]} {tr_du[2,idx]}")


if __name__ == "__main__":
logger.info(mlg.string_begin_script())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@
" ├── basis\n",
" │ ├── __init__.py \n",
" │ ├── test_DetectorUnitNetwork.py\n",
" │ └── test_Handling3dTracesOfEvent.py\n",
" │ └── test_Handling3dTraces.py\n",
" ├── core\n",
" │ ├── __init__.py\n",
" │ ├── __main__.py\n",
Expand Down Expand Up @@ -744,7 +744,7 @@
"id": "e3a1225f",
"metadata": {},
"source": [
"`FileEfield` is a data class without feature to handle traces. You can use `Handling3dTracesOfEvent()` in grand.basis.traces_event.py to handle traces."
"`FileEfield` is a data class without feature to handle traces. You can use `Handling3dTraces()` in grand.basis.traces_event.py to handle traces."
]
},
{
Expand Down
267 changes: 267 additions & 0 deletions examples/grandlib_introduction_v2.ipynb

Large diffs are not rendered by default.

Loading
Loading