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 snonis #93

Open
wants to merge 28 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 27 commits
Commits
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
192 changes: 192 additions & 0 deletions Example_Efield.ipynb
mjtueros marked this conversation as resolved.
Show resolved Hide resolved

Large diffs are not rendered by default.

182 changes: 182 additions & 0 deletions Untitled.ipynb
mjtueros marked this conversation as resolved.
Show resolved Hide resolved

Large diffs are not rendered by default.

72 changes: 72 additions & 0 deletions data/download_LFmap_grand.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#! /usr/bin/env python3

'''
Created on 19 juil. 2022

@author: Jean-Marc Colley, CNRS/IN2P3/LPNHE

'''
import tarfile
import os
import sys
import os.path as osp
from urllib import request
#TODO: add progressbar to grand lib
#import progressbar

from grand import GRAND_DATA_PATH, grand_add_path_data

#LINK_MODEL = "https://forge.in2p3.fr/attachments/download/133380/grand_model_2207.tar.gz"
#FILE_MODEL = "grand_model_2207.tar.gz"
#LINK_MODEL = "https://forge.in2p3.fr/attachments/download/201909/grand_model_2306.tar.gz"
#LINK_MODEL = "https://forge.in2p3.fr/attachments/download/251637/grand_model_190224.tar.gz"
LINK_MODEL = "https://forge.in2p3.fr/attachments/download/326497/LFmap.tar.gz"
FILE_MODEL = LINK_MODEL.split("/")[-1]
# class MyProgressBar():
# def __init__(self):
# self.pbar = None
#
# def __call__(self, block_num, block_size, total_size):
# if not self.pbar:
# self.pbar=progressbar.ProgressBar(maxval=total_size)
# self.pbar.start()
#
# downloaded = block_num * block_size
# if downloaded < total_size:
# self.pbar.update(downloaded)
# else:
# self.pbar.finish()


# 1- test if download is necessary
if os.path.exists(grand_add_path_data('noise/LFmap')):
print("==============================")
print('Skip download LFmap files for Galactic noise simulations')
sys.exit(0)

GRAND_DATA_PATH_1 = osp.join(grand_add_path_data('noise'))
tar_file = osp.join(GRAND_DATA_PATH_1, FILE_MODEL)

# 2- download
print("==============================")
print("Download LFmap model (~ 6.4 MB) for GRAND, please wait ...")
try:
request.urlretrieve(LINK_MODEL, tar_file)
print("Successfully downloaded")
except:
print(f"download failed {LINK_MODEL}")
sys.exit(1)

# 3- extract
print("==============================")
print('Extract tar file')
try:
my_tar = tarfile.open(tar_file)
my_tar.extractall(grand_add_path_data('noise'))
my_tar.close()
os.remove(tar_file) # delete zipped file are extraction.
except:
print(f"Extract failed '{tar_file}'")
sys.exit(1)
print("LFmap model available in grand/data/noise directory !")
sys.exit(0)
6 changes: 3 additions & 3 deletions data/download_data_grand.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#LINK_MODEL = "https://forge.in2p3.fr/attachments/download/133380/grand_model_2207.tar.gz"
#FILE_MODEL = "grand_model_2207.tar.gz"
#LINK_MODEL = "https://forge.in2p3.fr/attachments/download/201909/grand_model_2306.tar.gz"
LINK_MODEL = "https://forge.in2p3.fr/attachments/download/211902/grand_model_2306.tar.gz"
LINK_MODEL = "https://forge.in2p3.fr/attachments/download/251637/grand_model_190224.tar.gz"
FILE_MODEL = LINK_MODEL.split("/")[-1]


Expand Down Expand Up @@ -49,7 +49,7 @@

# 2- download
print("==============================")
print("Download data model (~ 452MB) for GRAND, please wait ...")
print("Download data model (~ 1GB) for GRAND, please wait ...")
try:
request.urlretrieve(LINK_MODEL, tar_file)
print("Successfully downloaded")
Expand All @@ -69,4 +69,4 @@
print(f"Extract failed '{tar_file}'")
sys.exit(1)
print("data model available in grand/data directory !")
sys.exit(0)
sys.exit(0)
72 changes: 72 additions & 0 deletions data/download_new_RFchain_grand.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#! /usr/bin/env python3

'''
Created on 19 juil. 2022

@author: Jean-Marc Colley, CNRS/IN2P3/LPNHE

'''
import tarfile
import os
import sys
import os.path as osp
from urllib import request
#TODO: add progressbar to grand lib
#import progressbar

from grand import GRAND_DATA_PATH, grand_add_path_data

#LINK_MODEL = "https://forge.in2p3.fr/attachments/download/133380/grand_model_2207.tar.gz"
#FILE_MODEL = "grand_model_2207.tar.gz"
#LINK_MODEL = "https://forge.in2p3.fr/attachments/download/201909/grand_model_2306.tar.gz"
#LINK_MODEL = "https://forge.in2p3.fr/attachments/download/251637/grand_model_190224.tar.gz"
LINK_MODEL = "https://forge.in2p3.fr/attachments/download/312643/RFchain_V3.tar.gz"
FILE_MODEL = LINK_MODEL.split("/")[-1]
# class MyProgressBar():
# def __init__(self):
# self.pbar = None
#
# def __call__(self, block_num, block_size, total_size):
# if not self.pbar:
# self.pbar=progressbar.ProgressBar(maxval=total_size)
# self.pbar.start()
#
# downloaded = block_num * block_size
# if downloaded < total_size:
# self.pbar.update(downloaded)
# else:
# self.pbar.finish()


# 1- test if download is necessary
if os.path.exists(grand_add_path_data('detector/RFchain_v2')):
print("==============================")
print('Skip download data model')
sys.exit(0)

GRAND_DATA_PATH_1 = osp.join(grand_add_path_data('detector'))
tar_file = osp.join(GRAND_DATA_PATH_1, FILE_MODEL)

# 2- download
print("==============================")
print("Download new RFchain model (~ 450 KB) for GRAND, please wait ...")
try:
request.urlretrieve(LINK_MODEL, tar_file)
print("Successfully downloaded")
except:
print(f"download failed {LINK_MODEL}")
sys.exit(1)

# 3- extract
print("==============================")
print('Extract tar file')
try:
my_tar = tarfile.open(tar_file)
my_tar.extractall(grand_add_path_data('detector'))
my_tar.close()
os.remove(tar_file) # delete zipped file are extraction.
except:
print(f"Extract failed '{tar_file}'")
sys.exit(1)
print("data model available in grand/data/detector directory !")
sys.exit(0)
2 changes: 1 addition & 1 deletion examples/grandlib_classes/dummy_reconstruction.ipynb

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For information, the notebook crashes at [1], with the error
sh: 1: ../io/DataStoringExample.py: not found

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right but this notebook is part of the master branch, i have no involvement with the creation of this script.

Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.2"
"version": "3.8.10"
}
},
"nbformat": 4,
Expand Down
Loading
Loading