-
Notifications
You must be signed in to change notification settings - Fork 5
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
Starshapes clarity kit #65
Merged
Merged
Changes from 45 commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
738dcbe
typo and China atmosphere models
lguelzow ab739f0
added some prints and reverted default obslevel
lguelzow 4900905
removed prints from testphase
lguelzow 31cb4de
update input variables and add descriptions (input stays the same)
lguelzow 7f35e95
add optional rotation of stations and magnetic field to accomodate Co…
lguelzow 623e0f0
update variable names and add documentation
lguelzow 9cece20
more variable updates and documentation
lguelzow 67609de
apply optional rotation and convert to cm for Corsika. Then write int…
lguelzow 8688962
more documentation
lguelzow 62279a8
add print to show saved file with antenna positions
lguelzow f432e1d
more variable name updates
lguelzow c795161
option for additional file in shower plane for visual checks
lguelzow f5b7c94
add sys import and correct parameter name error
lguelzow 813bf68
remove deprecated module
lguelzow a390365
correct variable name
lguelzow b19845f
Merge branch 'starshapes_clarity_KIT' of https://github.com/nu-radio/…
lguelzow 261aeb5
renamed position variable to unified name to make compatible with old…
lguelzow 2c21f8a
updated slicing and gammacut sections with new variable name and adde…
lguelzow 53319e0
Merge branch 'starshapes_clarity_KIT' of https://github.com/nu-radio/…
lguelzow f900998
remove deprecated package and change default obslevel to Auger value
lguelzow 38ed414
add command to open the file
lguelzow 56a9d51
fix variable typos
lguelzow 8b90d73
add missing doc
lguelzow 91d439a
error messages for wrong units
lguelzow d532236
new functions for generating antenna rings for the star shapes
lguelzow 68758dc
reverted back to default number of antenna rings
lguelzow f63d37f
widen a range to make it for 50-200MHz frequency band
lguelzow 72e8065
derpecated function
lguelzow 6672758
more deprecations
lguelzow f5d59c1
Merge branch 'starshapes_clarity_KIT' of https://github.com/nu-radio/…
lguelzow 90e96d9
modernise if clauses
lguelzow 725acea
Merge branch 'starshapes_clarity_KIT' of https://github.com/nu-radio/…
lguelzow 8197b0f
deprecated functions
lguelzow 4f102ef
correction to errors
lguelzow a6c70f0
Merge branch 'starshapes_clarity_KIT' of https://github.com/nu-radio/…
lguelzow de9137c
add file with functions from Felix to estimate cherenkov radius
lguelzow 6fafb8a
address documentation comments
lguelzow 175eefb
change dependency to internal
lguelzow ab38e24
make warning and if conditions cleaner
lguelzow 9533ba8
add clarity and documentation to new functions to generate starshape …
lguelzow 3fa46ee
Merge branch 'master' into starshapes_clarity_KIT
lguelzow 2ca721c
change ifs back bc it gave an error
lguelzow 6d7cacb
revert to less elegant form bc it gave an error
lguelzow d9c15fc
Merge branch 'starshapes_clarity_KIT' of https://github.com/nu-radio/…
lguelzow 1a2f81e
fix deprecated import
lguelzow 74d97c6
remove unused, old function and removed "model" from function names
lguelzow 48e384f
more model removal
lguelzow d2cfb74
made input parameters all lowercase
lguelzow 0d8910e
removed rough rmax parametrisation and replaced it with multiples of …
lguelzow File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,182 @@ | ||
# functions to estimate calculate the cherenkov radius of the radio emission of an air shower | ||
# code written by Felix Schlueter for the RadioAnalysis framework | ||
# added to radiotools by Lukas Guelzow | ||
|
||
import numpy as np | ||
import warnings | ||
|
||
from radiotools.atmosphere import models as atm | ||
|
||
|
||
def get_cherenkov_radius_model_from_depth(zenith, depth, obs_level, n0, model=None, at=None): | ||
""" Calculates the radius of the (Cherenkov) cone with an apex at a given depth along a | ||
shower axis with a given zenith angle. The open angle of the cone equals the | ||
Cherenkov angle for a value of the refractive index at this position. | ||
|
||
Paramter: | ||
|
||
zenith : double | ||
Zenith angle (in radian) under which a shower is observed | ||
|
||
depth : double | ||
Slant depth (in g/cm^2), i.e., shower maximum of the observed shower | ||
|
||
obs_level : double | ||
Altitude (in meter) of the plane at which the shower is observed | ||
|
||
n0 : double | ||
Refractive index at sea level (!= obs_level) | ||
|
||
model : int | ||
Model index for the atmospheric (density) profile model. Needed when no "at" is given | ||
|
||
at : radiotools.atmosphere.models.Atmosphere | ||
Atmospheric (density) profile model. Provides the density profile of the atmosphere in the typical 5-layer param. | ||
|
||
Return : cherenkov Radius | ||
|
||
""" | ||
if at is None: | ||
at = atm.Atmosphere(model=model) | ||
|
||
d = at.get_distance_xmax_geometric(zenith, depth, obs_level) | ||
return get_cherenkov_radius_model_from_distance(zenith, d, obs_level, n0, at.model) | ||
|
||
|
||
def get_cherenkov_radius_model_from_height(zenith, height, obs_level, n0, model): | ||
""" Calculates the radius of the (Cherenkov) cone with an apex at a given height above sea level on a | ||
shower axis with a given zenith angle. The open angle of the cone equals the | ||
Cherenkov angle for a value of the refractive index at this position. | ||
|
||
Paramter: | ||
|
||
zenith : double | ||
Zenith angle (in radian) under which a shower is observed | ||
|
||
height : double | ||
Height above sea level (in m) of the apex, i.e., shower maximum of the observed shower | ||
|
||
obs_level : double | ||
Altitude (in meter) of the plane at which the shower is observed | ||
|
||
n0 : double | ||
Refractive index at sea level (!= obs_level) | ||
|
||
model : int | ||
Model index for the atmospheric (density) profile model. | ||
|
||
Return : cherenkov Radius | ||
|
||
""" | ||
|
||
angle = get_cherenkov_angle_model(height, n0, model) | ||
dmax = atm.get_distance_for_height_above_ground( | ||
height - obs_level, zenith, observation_level=obs_level) | ||
return cherenkov_radius(angle, dmax) | ||
|
||
|
||
def get_cherenkov_radius_model_from_distance(zenith, d, obs_level, n0, model): | ||
""" Calculates the radius of the (Cherenkov) cone with an apex at a given distance from ground | ||
along the shower axis with a given zenith angle. The open angle of the cone equals the | ||
Cherenkov angle for a value of the refractive index at this position. | ||
|
||
Paramter: | ||
|
||
zenith : double | ||
Zenith angle (in radian) under which a shower is observed | ||
|
||
d : double | ||
Distance from ground to the apex, i.e., shower maximum of the observed shower along the shower axis (in m) | ||
|
||
obs_level : double | ||
Altitude (in meter) of the plane at which the shower is observed | ||
|
||
n0 : double | ||
Refractive index at sea level (!= obs_level) | ||
|
||
model : int | ||
Model index for the atmospheric (density) profile model. | ||
|
||
Return : cherenkov Radius | ||
|
||
""" | ||
height = atm.get_height_above_ground( | ||
d, zenith, observation_level=obs_level) + obs_level | ||
angle = get_cherenkov_angle_model(height, n0, model) | ||
return cherenkov_radius(angle, d) | ||
|
||
|
||
def get_cherenkov_angle_model(height, n0, model): | ||
""" Return cherenkov angle for given height above sea level, | ||
refractive index at sea level and atmospheric model. | ||
|
||
Paramter: | ||
|
||
height : double | ||
Height above sea level (in m) | ||
|
||
n0 : double | ||
Refractive index at sea level (!= obs_level) | ||
|
||
model : int | ||
Model index for the atmospheric (density) profile model. | ||
|
||
Return : cherenkov angle | ||
|
||
""" | ||
n = atm.get_n(height, n0=n0, model=model) | ||
return cherenkov_angle_model(n) | ||
|
||
|
||
def cherenkov_angle_model(n): | ||
""" Return cherenkov angle for given refractive index. | ||
|
||
Paramter: | ||
|
||
n : double | ||
Refractive index | ||
|
||
Return : cherenkov angle | ||
|
||
""" | ||
return np.arccos(1 / n) | ||
|
||
|
||
def cherenkov_radius(angle, d): | ||
""" Return (cherenkov) radius | ||
|
||
Paramters | ||
--------- | ||
|
||
angle : double | ||
(Opening) angle of the cone (in rad) | ||
|
||
d : double | ||
Heigth of the cone (typically called distance, in meter) | ||
|
||
Returns | ||
------- | ||
|
||
radius : double | ||
(Cherenkov) radius | ||
|
||
""" | ||
return np.tan(angle) * d | ||
|
||
|
||
# old: cherenkov_angle_from_density_refractivity(rho, dxmax, n_asl, rho_0, ...) | ||
# param of the cherenkov angle from star-shape simulations | ||
# here cherenkov radius refers to radius of strongest emission | ||
# is used to determine rmax in the RdIdealGrid simulations! | ||
def cherenkov_angle_param( | ||
height, dist, n0, model, | ||
a=9.48990456e-01, b=4.48698860e+03, | ||
c=1.43097665e+00, d=2.46630811e+06): | ||
|
||
n = atm.get_n(height, n0=n0, model=model) | ||
A = a - (b / dist) ** (c) - dist / d | ||
|
||
return A * cherenkov_angle_model(n) | ||
# # old param | ||
# def cherenkov_angle_from_density(x, A=0.24905864, B=0.92165234): | ||
# return np.deg2rad(A * np.log(x) + B) | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that relevant to keep? I am not sure if that is worth keeping in here. You could also remove the "model" from all the function names?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my code I added
model
to the function names because I implemented therevent
functions with the same name, I believe.Anyway, I think it is a good idea to add them here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the "old" section is irrelevant and shouldn't be included. I missed it when copying the other functions.
I'll remove the model parts of the function names too, they seem unneccessary here.