Skip to content

Commit

Permalink
Merge branch 'develop' into fs-interferometry-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
fschlueter committed Jan 29, 2025
2 parents 27b73e6 + 5e3306a commit 152e1b4
Show file tree
Hide file tree
Showing 122 changed files with 107,240 additions and 2,610 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build_and_publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:
ref: 'refs/heads/master'
- uses: actions/checkout@v4

- name: Set up Python 3.7
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: 3.7
python-version: "3.10"
- name: Cache pip
uses: actions/cache@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy_documentation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
with:
ref: 'refs/heads/develop'
- uses: actions/checkout@v4
- name: Set up Python 3.7
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: 3.7
python-version: "3.10"

- name: Cache pip
uses: actions/cache@v4
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/python_version_compatibility.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@ jobs:
strategy:
fail-fast: false # continue even if one of the versions fails
matrix:
python_version: ["3.8", "3.9", "3.10", "3.11", "3.x"] # 3.x = latest available
python_version: ["3.9", "3.11", "3.x"] # 3.x = latest available
os: [ubuntu-latest]
include:
- python_version: "3.6"
os: ubuntu-20.04 # python 3.6 is not available with 22.04 on github actions
- python_version: "3.7"
os: ubuntu-22.04
- python_version: "3.8" # technically available on 24.04 but not pre-installed
os: ubuntu-22.04
uses: ./.github/workflows/run_tests.yaml
with:
python_version: ${{ matrix.python_version }}
Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/run_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
description: Specify Python version to run tests on
type: string
required: true
default: '3.7'
default: '3.10'
os:
description: OS to run tests on
type: string
Expand All @@ -20,14 +20,14 @@ on:
description: Specify Python version to run tests on
type: string
required: true
default: '3.7'
default: '3.10'
os:
description: OS to run tests on
type: string
default: ubuntu-latest

env: # set the python_version to 3.7 if the workflow is not triggered by workflow_call or workflow_dispatch
PYTHON_VERSION: ${{ inputs.python_version || '3.7' }}
env: # set the python_version to 3.10 if the workflow is not triggered by workflow_call or workflow_dispatch
PYTHON_VERSION: ${{ inputs.python_version || '3.10' }}

jobs:
build:
Expand Down Expand Up @@ -190,6 +190,12 @@ jobs:
export GSLDIR=$(gsl-config --prefix)
export PYTHONPATH=$(pwd):$PYTHONPATH
NuRadioReco/test/trigger_tests/run_trigger_test.sh
- name: "Test channelGalacticNoiseAdder"
if: always()
run: |
export PYTHONPATH=$(pwd):$PYTHONPATH
python install_dev.py --dev galacticnoise --no-interactive
python NuRadioReco/examples/StandAloneScripts/B01galacticnoiseadder.py
- name: "Test all examples"
if: always()
run: |
Expand Down
17 changes: 17 additions & 0 deletions NuRadioMC/SignalProp/analyticraytracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -2681,6 +2681,23 @@ def get_output_parameters(self):
]

def get_raytracing_output(self, i_solution):
"""
Get the output of the ray tracing for a specific solution
Parameters
----------
i_solution: int
Index of the raytracing solution
Returns
-------
output_dict: dict
Dictionary containing the output of the ray tracing.
The C_0 and C_1 parameters are the parameters of the analytic function that describes the ray path.
The solution type is the type of the solution (1: direct, 2:refracted, 3: reflected off the surface).
The reflection parameter specifies the number of bottom reflections (in case of reflective layers in the ice).
The reflection case specifies if the ray starts upward or downward (1: upward, 2: downward) (only relevant if bottom reflection > 0).
"""
if self._config['propagation']['focusing']:
focusing = self.get_focusing(i_solution, limit=float(self._config['propagation']['focusing_limit']))
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# import detector simulation modules
import NuRadioReco.modules.trigger.simpleThreshold
import NuRadioReco.modules.channelBandPassFilter

from NuRadioReco.utilities import units
from NuRadioMC.simulation import simulation

Expand All @@ -14,7 +15,7 @@
logger = logging.getLogger("NuRadioMC.SignalProp.runstrawman")

###-----------------------------------------
# EXAMPLE: Script to calculate the effects of birefringence on the effective volume.
# EXAMPLE: Script to calculate the effects of birefringence on the effective volume.
# A full study of this calculation was published here: DOI: https://doi.org/10.22323/1.444.1101
###-----------------------------------------

Expand All @@ -38,7 +39,7 @@ def _detector_simulation_trigger(self, evt, station, det):
triggered_channels=None, # run trigger on all channels
number_concidences=1,
trigger_name='simple_threshold1') # the name of the trigger

energies = np.array([19])

Veff_birefringence = []
Expand Down Expand Up @@ -81,4 +82,3 @@ def _detector_simulation_trigger(self, evt, station, det):
plt.xlabel(r'$\log (E)$')
plt.tight_layout()
plt.savefig('06_Veff_comp_plot.png', dpi=400)

26 changes: 24 additions & 2 deletions NuRadioMC/SignalProp/propagation_base_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ class initilization
medium: medium class
class describing the index-of-refraction profile
attenuation_model: string
signal attenuation model (so far only "SP1" is implemented)
if this parameter is also defined in the config file, the value from the config file
will be used. If not, the value from this parameter will be used.
signal attenuation model
log_level: logging object
specify the log level of the ray tracing class
Expand All @@ -36,10 +39,16 @@ class describing the index-of-refraction profile
default is NOTSET (ie global control)
n_frequencies_integration: int
the number of frequencies for which the frequency dependent attenuation
if this parameter is also defined in the config file, the value from the config file
will be used. If not, the value from this parameter will be used.
This parameter specifies the number of frequencies for which the frequency dependent attenuation
length is being calculated. The attenuation length for all other frequencies
is obtained via linear interpolation.
n_reflections: int (default 0)
if this parameter is also defined in the config file, the value from the config file
will be used. If not, the value from this parameter will be used.
in case of a medium with a reflective layer at the bottom, how many reflections should be considered
config: nested dictionary
loaded yaml config file
Expand All @@ -60,6 +69,19 @@ class describing the index-of-refraction profile
self._n_reflections = n_reflections

self._config = config
if self._config is not None:
if 'n_freq' in self._config['propagation']:
if n_frequencies_integration is not None:
self.__logger.warning(f"overriding n_frequencies_integration from config file from {n_frequencies_integration} to {self._config['propagation']['n_freq']}")
self._n_frequencies_integration = self._config['propagation']['n_freq']
if 'n_reflections' in self._config['propagation']:
if n_reflections is not None:
self.__logger.warning(f"overriding n_reflections from config file from {n_reflections} to {self._config['propagation']['n_reflections']}")
self._n_reflections = self._config['propagation']['n_reflections']
if 'attenuation_model' in self._config['propagation']:
if attenuation_model is not None:
self.__logger.warning(f"overriding attenuation_model from config file from {attenuation_model} to {self._config['propagation']['attenuation_model']}")
self._attenuation_model = self._config['propagation']['attenuation_model']
self._detector = detector
self._max_detector_frequency = None
if self._detector is not None:
Expand Down
2 changes: 0 additions & 2 deletions NuRadioMC/examples/01_Veff_simulation/T02RunSimulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
highLowThreshold = NuRadioReco.modules.trigger.highLowThreshold.triggerSimulator()
channelBandPassFilter = NuRadioReco.modules.channelBandPassFilter.channelBandPassFilter()


class mySimulation(simulation.simulation):

def _detector_simulation_filter_amp(self, evt, station, det):
Expand Down Expand Up @@ -70,4 +69,3 @@ def _detector_simulation_trigger(self, evt, station, det):
config_file=args.config,
file_overwrite=True)
sim.run()

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import NuRadioReco.modules.trigger.highLowThreshold
import NuRadioReco.modules.trigger.simpleThreshold
import NuRadioReco.modules.channelBandPassFilter

from NuRadioReco.utilities import units
from NuRadioMC.simulation import simulation

Expand Down Expand Up @@ -68,4 +69,3 @@ def _detector_simulation_trigger(self, evt, station, det):
config_file=args.config,
file_overwrite=True)
sim.run()

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import NuRadioReco.modules.trigger.highLowThreshold
import NuRadioReco.modules.trigger.simpleThreshold
import NuRadioReco.modules.channelBandPassFilter

from NuRadioReco.utilities import units
from NuRadioMC.simulation import simulation
import logging
Expand Down Expand Up @@ -69,4 +70,3 @@ def _detector_simulation_trigger(self, evt, station, det):
file_overwrite=True,
trigger_channels=[8,9,2,3])
sim.run()

5 changes: 3 additions & 2 deletions NuRadioMC/examples/06_webinar/W02RunSimulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import NuRadioReco.modules.channelResampler
import NuRadioReco.modules.channelBandPassFilter
import NuRadioReco.modules.channelGenericNoiseAdder

from NuRadioReco.utilities import units
import numpy as np
from NuRadioMC.simulation import simulation
Expand Down Expand Up @@ -68,14 +69,14 @@
functions that controls what the detector does after the electric field arrives
at the antenna. That allows us to create our own class that inherits from
the simulation class that we will call mySimulation, and define in it a
_detector_simulation_filter_amp and _detector_simulation_trigger
_detector_simulation_filter_amp and _detector_simulation_trigger
function with all the characteristics of our detector setup.
"""


class mySimulation(simulation.simulation):
"""
"""

def _detector_simulation_filter_amp(self, evt, station, det):
Expand Down
Loading

0 comments on commit 152e1b4

Please sign in to comment.