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

Refactoring coreas to include interpolation #688

Open
wants to merge 107 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 102 commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
20a910c
first commit, integrating the interpolation class in coreas.py. Delet…
lpyras May 31, 2024
bc6eec4
add docstrings
lpyras May 31, 2024
f7c9afb
refactor coreas interface
cg-laser Jun 1, 2024
d1f6567
add module to reconstruct efield from othorgonal antenna pairs
cg-laser Jun 1, 2024
cf1e900
finish refactor, bugfix (group_id was used as channel_id to get anten…
cg-laser Jun 1, 2024
9a40073
set efield position, fix efield reconstructor noise window definition
cg-laser Jun 5, 2024
c389b92
Merge branch 'develop' into refactor_coreas_v3
cg-laser Jun 5, 2024
88fc53f
change corsika to corsika_evt to avoid confusion with open hdf5 file,…
lpyras Jun 3, 2024
4931502
fix coreas.py
cg-laser Jun 5, 2024
1af1f0d
adapt logging, fix fluence calculation
cg-laser Jun 6, 2024
eefac87
allow to set declination
cg-laser Jun 6, 2024
627ac86
remove tests and examples which rely on readCoreas. New examples and …
lpyras Jun 11, 2024
1b041a8
fix docstrings
cg-laser Jun 14, 2024
33617b0
Merge branch 'develop' into refactor_coreas_v3
cg-laser Jun 14, 2024
58f7655
add automatic data download
cg-laser Jun 14, 2024
86f60de
update readme
cg-laser Jun 14, 2024
2768e16
example scripts for cr analysis with a detector array and a single st…
lpyras Jun 11, 2024
b1578b1
set correct start time for trace
lpyras Aug 5, 2024
524554c
write new functions which rely on readCorsika7()
lpyras Aug 5, 2024
42c3f59
refactor readCoREASShower to use readCOREAS7() function
lpyras Aug 6, 2024
acc8c43
rewrite readCoREASStation such that it uses readCorsika7()
lpyras Aug 6, 2024
63a8ddd
delete old examples which is no longer applicable. Add new example code
lpyras Aug 6, 2024
f239a80
remove old example since it is outdated with the refactoring
lpyras Aug 14, 2024
31648e4
add cr-pulse-interpolator as optional dependency
sjoerd-bouma Aug 27, 2024
1091d58
Refactoring, fixing typos
MijnheerD Aug 30, 2024
989a853
Refactoring and clean-up
MijnheerD Aug 30, 2024
ef860ba
add docstrings and clean code
lpyras Sep 2, 2024
98ef307
fix CoREASStation module
cg-laser Oct 29, 2024
17dadca
update doc
cg-laser Oct 29, 2024
58a34c2
Make get_geomagnetic_angle use internal units
MijnheerD Nov 25, 2024
97a0f06
Simplify convert_obs_to_nuradio_efield, remove prepend_zeros option
MijnheerD Nov 25, 2024
e579a5d
Allow to convert multiple positions at once
MijnheerD Nov 25, 2024
d4d7860
Allow to convert multiple positions at once
MijnheerD Nov 25, 2024
920bcbe
Refactor and add units
MijnheerD Nov 25, 2024
e8f2700
Refactor read_CORSIKA7
MijnheerD Nov 25, 2024
8083063
Get parameters from SimShower instead of SimStation
MijnheerD Nov 27, 2024
d81e24e
Clarify observer_pos and fix broken positions in ElectricFields
MijnheerD Nov 27, 2024
de22380
Use make_sim_shower() in read_CORSIKA7
MijnheerD Nov 27, 2024
9bef3f3
Change output shape to align with BaseTrace shape
MijnheerD Nov 27, 2024
a6bbc02
Use add_electric_field_to_sim_station() in read_CORSIKA7
MijnheerD Nov 27, 2024
1098a14
Restructure internal variables of coreasInterpolator - add properties…
MijnheerD Nov 27, 2024
df09ba7
Remove position_on_sky attribute from electric_field.py
MijnheerD Nov 27, 2024
841dee4
Refactor initialize_efield_interpolator()
MijnheerD Nov 27, 2024
d6d7c9a
Restructure interpolation calling functions
MijnheerD Nov 27, 2024
d406098
Fix import statements
MijnheerD Nov 27, 2024
3906efa
Remove unnecessary function - fix logging statement (for now)
MijnheerD Nov 27, 2024
c19e48e
Use core in transformation - remove unused parameters
MijnheerD Nov 29, 2024
7b87756
Fix magnetic field calculation in get_angles()
MijnheerD Dec 3, 2024
5eb10c1
Added important TODO
MijnheerD Dec 4, 2024
110b2e3
install cr-pulse-interpolator for ci tests
sjoerd-bouma Dec 4, 2024
73a1519
Use core from CoREAS settings
MijnheerD Dec 10, 2024
a07a397
Merge branch 'develop' into refactor_coreas_v3
cg-laser Dec 17, 2024
5ff8613
fix two things
cg-laser Dec 17, 2024
013d10b
Check sign of declination is consistent with radiotools
MijnheerD Jan 21, 2025
37486db
Improve docstring + allow to specify site to calculate declination in…
MijnheerD Jan 21, 2025
f5b728b
Move plotting functions together
MijnheerD Jan 21, 2025
d81f87b
Store simulation input values only in SimShower, not in SimStation
MijnheerD Jan 21, 2025
4402761
Deprecate make_sim_shower() and move to new name to avoid confusion
MijnheerD Jan 21, 2025
589f1f4
Improve hdf5_sim_shower() docstring
MijnheerD Jan 21, 2025
31fa6c4
Some file restructuring
MijnheerD Jan 21, 2025
e000028
Use core_shift in create_sim_shower()
MijnheerD Jan 21, 2025
455bef8
Improve documentation and warnings
MijnheerD Jan 22, 2025
ad83d53
Allow to choose cs system in which to retrieve interpolated field
MijnheerD Jan 22, 2025
698b664
Add option to select interpolation options as kwargs
MijnheerD Jan 22, 2025
3de97de
Use extrapolation options from cr-pulse-interpolator
MijnheerD Jan 22, 2025
5a751d4
Add function to calculate fluences for each electric field + debug st…
MijnheerD Jan 22, 2025
f153b1f
Allow 5cm deviation in ant z-coordinate
MijnheerD Jan 22, 2025
6f74479
Clean up readCoREASDetector.py
MijnheerD Jan 23, 2025
f26ee5e
Return start time when getting closest observer efield
MijnheerD Jan 23, 2025
9ebc0e4
Correct interpolator call + don't fit fluence at core
MijnheerD Jan 23, 2025
c4f65d3
Clean up readCoREASShower.py - add GPSSecs time to event at read in
MijnheerD Jan 23, 2025
7c2ff95
Select channels per station
MijnheerD Jan 23, 2025
b884ae2
Move coreasInterpolator to its own file for clarity
MijnheerD Jan 23, 2025
a1b609a
Interpolate trace start time when using closest observer
MijnheerD Jan 24, 2025
6d8cc69
Fix import and NoneType issue
MijnheerD Jan 24, 2025
7be9587
Rotate the on-sky polarisations if they align too closely with (vx)vxB
MijnheerD Jan 24, 2025
159e9c1
Merge branch 'develop' into refactor_coreas_v3
MijnheerD Jan 24, 2025
591706f
Update changelog.txt
MijnheerD Jan 24, 2025
dd307fc
Make a documentation page for the interpolator
MijnheerD Jan 24, 2025
8350d67
Fix broken unit tests
MijnheerD Jan 27, 2025
ee5539e
Use correct time format
MijnheerD Jan 27, 2025
7af00bc
Merge branch 'develop' into refactor_coreas_v3
MijnheerD Jan 27, 2025
0c06d09
Only draw x/y core positions
MijnheerD Jan 27, 2025
e821e7d
Copy shower to not modify original one
MijnheerD Jan 27, 2025
b530268
Adjust script to new modules
MijnheerD Jan 27, 2025
fd30e7d
Fix logger typo + make warning clearer
MijnheerD Jan 29, 2025
5e8bf81
Change function name for clarity
MijnheerD Jan 29, 2025
9ca6cf1
Use helper function
fschlueter Jan 28, 2025
0c27e10
Update
fschlueter Jan 29, 2025
2126ffe
Add deprecation warning
fschlueter Jan 29, 2025
d21e244
Readded the cr-pulse-interpolator dependency that went missing
MijnheerD Jan 29, 2025
6ea6e95
fixup! Use helper function
MijnheerD Jan 29, 2025
f9cf4da
use readCoREASStation instead of old module readCoREAS in CostumHybri…
lpyras Jan 29, 2025
894a7df
add docstrings to cr examples
lpyras Jan 29, 2025
8d5ea3f
minor docstring typos
lpyras Jan 29, 2025
a47d017
rm outdated README in examples
lpyras Jan 29, 2025
1626f9e
rm old air_shower examples since it doubles with cr_sim scripts
lpyras Jan 29, 2025
1f20050
fix typo
lpyras Jan 29, 2025
9e85ea0
Revert "rm old air_shower examples since it doubles with cr_sim scripts"
lpyras Jan 29, 2025
12eddb6
minor changes to make readCoREASStation and the example work
lpyras Jan 30, 2025
7ce6e87
improve det_array example
lpyras Jan 30, 2025
7859d84
catch hdf5 files with few observers and return closest observer inste…
lpyras Jan 30, 2025
1b4b7fc
Correct time units
MijnheerD Jan 30, 2025
c8721c8
squash! Correct time units
MijnheerD Jan 30, 2025
e2c9f9a
Revert "catch hdf5 files with few observers and return closest observ…
lpyras Jan 30, 2025
c8be714
remove limit on observern in weight function
lpyras Jan 30, 2025
fcddde0
fix typos
lpyras Jan 30, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/deploy_documentation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
python -m pip install --upgrade pip
pip install flake8 pytest
export GSLDIR=$(gsl-config --prefix)
python install_dev.py --install --dev documentation proposal --no-interactive
python install_dev.py --install --dev documentation proposal cr_interpolator --no-interactive
export PYTHONPATH=$PWD:$PYTHONPATH
echo $PYTHONPATH
NuRadioMC/SignalProp/install.sh
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/run_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,6 @@ jobs:
export GSLDIR=$(gsl-config --prefix)
export PYTHONPATH=$(pwd):$PYTHONPATH
NuRadioMC/test/atmospheric_Aeff/1e18eV/test_build.sh
- name: "Tiny reconstrucution"
if: always()
run: |
export GSLDIR=$(gsl-config --prefix)
export PYTHONPATH=$(pwd):$PYTHONPATH
NuRadioReco/test/tiny_reconstruction/testTinyReconstruction.sh
- name: "Trigger tests"
if: always()
run: |
Expand All @@ -201,4 +195,5 @@ jobs:
run: |
export GSLDIR=$(gsl-config --prefix)
export PYTHONPATH=$(pwd):$PYTHONPATH
python install_dev.py --dev cr_interpolator --no-interactive
NuRadioReco/test/test_examples.sh
101 changes: 101 additions & 0 deletions NuRadioReco/examples/AirShowerFluenceXmaxReco/A01createDetectorJson.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
"""
Helper script that generates the detector description for
dual-polarized antennas on a square grid. This is a generic
example for typical air-shower arrays such as AERA, Auger-Radio,
LOFAR, TUNKA-REX, GRAND, etc.
"""

import json
import copy
import numpy as np
from radiotools import helper as hp
from NuRadioReco.utilities import units

class NpEncoder(json.JSONEncoder):

def default(self, obj):
if isinstance(obj, np.integer):
return int(obj)
elif isinstance(obj, np.floating):
return float(obj)
elif isinstance(obj, np.ndarray):
return obj.tolist()
else:
return super(NpEncoder, self).default(obj)


antenna = "SKALA_InfFirn"
ori_EW = [0,0,90*units.deg, 90*units.deg]
ori_NW = [0,0,90*units.deg, 0]

# antenna = "LOFAR_LBA"
# ori_EW = [90 * units.deg, 135 * units.deg, 0, 0]
# ori_NW = [90 * units.deg, (135+180) * units.deg, 0, 0]

orientation_theta, orientation_phi, rotation_theta, rotation_phi = ori_NW
a1 = hp.spherical_to_cartesian(orientation_theta, orientation_phi)
a2 = hp.spherical_to_cartesian(rotation_theta, rotation_phi)
a3 = np.cross(a1, a2)
if np.linalg.norm(a3) < 0.9:
raise AssertionError("the two vectors that define the antenna orientation are not othorgonal to each other")

ctmp = {
"adc_n_samples": 512,
"adc_sampling_frequency": 1,
"channel_id": 0,
"commission_time": "{TinyDate}:2017-11-01T00:00:00",
"decommission_time": "{TinyDate}:2038-01-01T00:00:00",
}

stmp = {
"commission_time": "{TinyDate}:2017-11-04T00:00:00",
"decommission_time": "{TinyDate}:2038-01-01T00:00:00",
"pos_altitude": 0,
"pos_site": "LOFAR",
}

det = {}
det['channels'] = {}
det['stations'] = {}

xx = np.arange(-0.15,0.151,0.05) * units.km
yy = np.arange(-0.15,0.151,0.05) * units.km
# yy = [0]
z = 1 * units.cm
MijnheerD marked this conversation as resolved.
Show resolved Hide resolved

station_id = 1
channel_id_counter = 0
channel_group_counter = 0
for x in xx:
for y in yy:
channel_group_counter += 1
for ori in [ori_EW, ori_NW]:
channel_id_counter += 1
ori_theta, ori_phi, rot_theta, rot_phi = ori
cab_length = 0
cab_time_delay = 0
Tnoise = 300
channel = copy.copy(ctmp)
channel['ant_position_x'] = x
channel['ant_position_y'] = y
channel['ant_position_z'] = z
channel['ant_type'] = antenna
channel['channel_id'] = channel_id_counter
channel['channel_group_id'] = channel_group_counter
channel["ant_orientation_phi"] = ori_phi/units.deg
channel["ant_orientation_theta"] = ori_theta/units.deg
channel["ant_rotation_phi"] = rot_phi/units.deg
channel["ant_rotation_theta"] = rot_theta/units.deg
channel["cab_length"] = cab_length
channel["cab_time_delay"] = cab_time_delay
channel["noise_temperature"] = Tnoise
channel["station_id"] = station_id
det['channels']["{:d}".format(channel_id_counter)] = channel
det['stations'][f"{station_id:d}"] = copy.copy(stmp)
det['stations'][f"{station_id:d}"]['station_id'] = station_id
det['stations'][f"{station_id:d}"]['pos_easting'] = 0
det['stations'][f"{station_id:d}"]['pos_northing'] = 0

with open(f"grid_array_{antenna}.json", 'w') as fout:
json.dump(det, fout, indent=4, sort_keys=True, cls=NpEncoder)

Loading