Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev_io_root' into dev_database
Browse files Browse the repository at this point in the history
# Conflicts:
#	granddb/notestssh.py
  • Loading branch information
fleg committed Jun 6, 2024
2 parents 53d509e + 7c77b69 commit 883a5a6
Show file tree
Hide file tree
Showing 1,045 changed files with 276,566 additions and 328,008 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,5 @@ docs/apidoc-only/sphinx/source/grand.*
# mac
.DS_Store

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


4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ Don't forget to initialize grand library before use it with script **env/setup.s

.. code:: bash
$ pwd
.../grand
$ git clone https://github.com/grand-mother/grand.git
$ cd grand
$ source env/setup.sh
Expand Down
8 changes: 7 additions & 1 deletion env/_setup_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,15 @@ 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
echo "add grand to PYTHONPATH"
echo "=============================="


export AIRESBINDIR=${HOME}/aires/bin
echo "add AIRESBINDIR"
echo "============================="
25 changes: 20 additions & 5 deletions env/conda/grandlib_amd64.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: test_gr1
name: /sps/grand/software/conda/grandlib_2304
channels:
- conda-forge
- defaults
Expand Down Expand Up @@ -26,12 +26,13 @@ dependencies:
- bzip2=1.0.8=h7f98852_4
- c-ares=1.18.1=h7f98852_0
- c-compiler=1.5.1=h166bdaf_0
- ca-certificates=2022.12.7=ha878542_0
- ca-certificates=2023.08.22=h06a4308_0
- cairo=1.16.0=ha61ee94_1014
- certifi=2022.12.7=pyhd8ed1ab_0
- certifi=2023.7.22=py39h06a4308_0
- cffi=1.15.1=py39he91dace_3
- cfitsio=4.1.0=hd9d235c_0
- charset-normalizer=2.1.1=pyhd8ed1ab_0
- cmake=3.22.1=h1fce559_0
- colorama=0.4.6=pyhd8ed1ab_0
- comm=0.1.2=pyhd8ed1ab_0
- compilers=1.5.1=ha770c72_0
Expand Down Expand Up @@ -138,6 +139,7 @@ dependencies:
- libtiff=4.4.0=h82bc61c_5
- libtool=2.4.7=h27087fc_0
- libuuid=2.32.1=h7f98852_1000
- libuv=1.44.2=h5eee18b_0
- libwebp=1.2.4=h522a892_0
- libwebp-base=1.2.4=h166bdaf_0
- libxcb=1.13=h7f98852_1004
Expand All @@ -162,7 +164,7 @@ dependencies:
- notebook-shim=0.2.2=pyhd8ed1ab_0
- numba=0.56.4=py39h61ddf18_0
- numpy=1.23.5=py39h3d75532_0
- openssl=3.0.7=h0b41bf4_2
- openssl=3.0.11=h7f8727e_2
- packaging=23.0=pyhd8ed1ab_0
- pandoc=2.19.2=h32600fe_1
- pandocfilters=1.5.0=pyhd8ed1ab_0
Expand Down Expand Up @@ -201,6 +203,7 @@ dependencies:
- requests=2.28.2=pyhd8ed1ab_0
- rfc3339-validator=0.1.4=pyhd8ed1ab_0
- rfc3986-validator=0.1.1=pyh9f0ad1d_0
- rhash=1.4.3=hdbd6064_0
- root=6.26.10=py39h4661b88_1
- root_base=6.26.10=py39h7695a35_1
- scipy=1.10.0=py39h7360e5f_2
Expand Down Expand Up @@ -256,6 +259,11 @@ dependencies:
- zlib=1.2.13=h166bdaf_4
- zstd=1.5.2=h3eb15da_6
- pip:
- appjar==0.94.0
- asdf==2.15.0
- asdf-standard==1.0.3
- asdf-transform-schemas==0.3.0
- asdf-unit-schemas==0.1.0
- asteval==0.9.28
- astroid==2.14.1
- astropy==5.2.1
Expand All @@ -271,9 +279,11 @@ dependencies:
- exceptiongroup==1.1.0
- fonttools==4.38.0
- future==0.18.3
- greenlet==2.0.2
- h5py==3.8.0
- iniconfig==2.0.0
- isort==5.12.0
- jmespath==1.0.1
- kiwisolver==1.4.4
- lazy-object-proxy==1.9.0
- lmfit==1.1.0
Expand All @@ -286,18 +296,23 @@ dependencies:
- pathspec==0.11.0
- pillow==9.4.0
- pluggy==1.0.0
- psycopg2==2.9.6
- py==1.11.0
- pyerfa==2.0.0.1
- pylint==2.16.1
- pynacl==1.5.0
- pyparsing==3.0.9
- pytest==7.2.1
- scp==0.14.5
- semantic-version==2.10.0
- showerradio==1.0.0
- sqlalchemy==2.0.9
- sshtunnel==0.4.0
- tokenize-rt==5.0.0
- toml==0.10.2
- tomli==2.0.1
- tomlkit==0.11.6
- uncertainties==3.1.7
- uproot==5.0.2
- wrapt==1.14.1
prefix: /home/jcolley/miniconda3/envs/test_gr1
prefix: /sps/grand/software/conda/grandlib_2304
12 changes: 9 additions & 3 deletions env/conda/readme.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# GRANDLIB env with conda

## Frequent confusion

The conda environment **does not contain GRANDLIB code**. The conda environment installs the necessary libraries, executables, initializes environment variables to correctly compile the C part of GRANLIB (gull and turtle), please [constraints to use grandlib](https://github.com/grand-mother/grand/wiki#constraints-to-use-grandlib) in GRANDLIB wiki.

## WARNING

* A wifi connection is not recommended for this installation
Expand All @@ -13,7 +17,7 @@ You need to have conda command installed, the minimal package to have it is mini

[CLI conda environnement](https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html)

conda cheatsheet PDF: file:///home/jcolley/T%C3%A9l%C3%A9chargements/conda-cheatsheet-1.pdf
[Conda cheat sheet PDF](https://docs.conda.io/projects/conda/en/4.6.0/_downloads/52a95608c49671267e40c689e0bc00ca/conda-cheatsheet.pdf)

## Some conda commands

Expand Down Expand Up @@ -53,9 +57,11 @@ conda activate grandlib


Initialize GRANDLIB package and GULL/TURTLE compilation, in
the root package, do
the root package, first clone the package grand

```
git clone https://github.com/grand-mother/grand.git
cd grand
source env/setup.sh
```

Expand All @@ -67,4 +73,4 @@ grand_quality_test_cov.bash
```


If you encounter a problem write a ticket [here](https://github.com/grand-mother/collaboration-issues/issues)
If you encounter a problem write a ticket [here](https://github.com/grand-mother/collaboration-issues/issues)
2 changes: 0 additions & 2 deletions env/docker_fedo/.gitignore

This file was deleted.

2 changes: 0 additions & 2 deletions env/docker_root/.gitignore

This file was deleted.

15 changes: 11 additions & 4 deletions env/readme.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
# GRAND environnement configuration
# GRAND environment configuration


## With docker
## With Docker

See github [wiki](https://github.com/grand-mother/grand/wiki) of grand project

Docker is the best choice for Mac OS. Note image version depends on [processor architecture](https://hub.docker.com/r/grandlib/dev):

* ARM64: for M1, M2 version 2.0
* AMD64 : version 1.2

## With conda
See github [wiki](https://github.com/grand-mother/grand/wiki#development-environment) of grand project


## With Conda

Conda envionment is the best choice for linux.

See conda [readme](conda/readme.md)
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
Loading

0 comments on commit 883a5a6

Please sign in to comment.