-
Notifications
You must be signed in to change notification settings - Fork 29
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
GL3 attenuation for C++ raytracer #521
base: develop
Are you sure you want to change the base?
Conversation
… because the python raytracer has been optimized
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.
thanks Christoph! Looks good. The feature to specify to use the python ray tracer is great. Did you change it att all occurrences? Maybe it would be better to only use self._use_python_raytracer
which is set in the init function as
self._use_python_raytracer = use_python_raytracer or not cpp_available
Could you also improve the log output so that it is logged that the python version is used?
In this block in the beginning, could you change it to use the logger
from NuRadioMC.SignalProp.CPPAnalyticRayTracing import wrapper
cpp_available = True
print("using CPP version of ray tracer")
except:
print("trying to compile the CPP extension on-the-fly")
try:
import subprocess
import os
subprocess.call(os.path.join(os.path.dirname(os.path.abspath(__file__)),
"install.sh"))
from NuRadioMC.SignalProp.CPPAnalyticRayTracing import wrapper
cpp_available = True
print("compilation was successful, using CPP version of ray tracer")
except:
print("compilation was not successful, using python version of ray tracer")
print("check NuRadioMC/NuRadioMC/SignalProp/CPPAnalyticRayTracing for manual compilation")
cpp_available = False
Here I would change the log output to "CPP ray tracer available. It will be used if not specified otherwise".
Okay, I changed the output to use the logger and give clearer feedback. |
@cg-laser Can you approve this? |
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 default logger setting is "warning" and we should use it to print all relevant output. Can you change the two logger statements to "warning" too?
Maybe the better fix would be to go add an additional "extended info" option, use it where we currently use "info", change the warning loggers to info (where appropriate) and change the default log level to info.
The GL3 attenuation model is not working correctly. After running some simulations using Changing only |
This fixes the GL3 attenuation model for the C++ raytracer. Instead of using the GSL integrator (which had problems dealing with the GL3 model), the raytracer uses
get_path
to get points on the ray path, and then uses those to calculate the attenuation factor.This is not 100% the same, but I tested the difference by generating a transmitter at random depths from 0.5m and 150m, and a transmitter at random depths between 30 and 3000m and distances between 50 and 3000m. This plot shows the difference between the attenuation factor of the C++ and the python raytracer, so the difference is under 1%.
To make it easier to compare, I also added the option to tell the raytracer to use python, even if the C++ implementation is available.
I also noticed another problem with the C++ raytracer: For frequencies above 1.4GHz or so, the interpolation can cause negative attenuation lenghts. Even though this is out of band, it can blow up the signal enough to overcome the filter. So I restricted the interpolation to 600MHz to prevent this.