Ray Tracing#

The Ray Tracing module (and its main class RayTracing) handles ray tracing simulations, analysis and I/O. It receives as input a Telescope Model (see telescope_model) and few more physical parameters (zenith angle, etc). At the moment, the RayTracing class includes the whole dish mode (default one) and a single mirror mode.

ray_tracing#

Ray tracing simulations and analysis.

class ray_tracing.RayTracing(telescope_model, simtel_source_path, label=None, config_data=None, config_file=None)[source]#

Ray tracing simulations and analysis.

Parameters:
telescope_model: TelescopeModel

Instance of the TelescopeModel class.

label: str

Instance label.

simtel_source_path: str (or Path)

Location of sim_telarray installation.

config_data: dict.

Dict containing the configurable parameters.

config_file: str or Path

Path of the yaml file containing the configurable parameters.

analyze(export=True, force=False, use_rx=False, no_tel_transmission=False, containment_fraction=0.8)[source]#

Raytracing analysis.

Involves the following: read simtel files, compute psfs and eff areas and store the results in _results.

Parameters:
export: bool

If True, results will be exported to a file automatically. Alternatively, export_results function can be used.

force: bool

If True, existing results files will be removed and analysis will be done again.

use_rx: bool

If True, calculations are done using the rx binary provided by sim_telarray. If False, calculations are done internally, by the module psf_analysis.

no_tel_transmission: bool

If True, the telescope transmission is not applied.

containment_fraction: float

Containment fraction for PSF containment calculation. Allowed values are in the interval [0,1]

export_results()[source]#

Export results to a csv file.

classmethod from_kwargs(**kwargs)[source]#

Build a RayTracing object from kwargs only.

The configurable parameters can be given as kwargs, instead of using the config_data or config_file arguments.

Parameters:
kwargs

Containing the arguments and the configurable parameters.

Returns:
Instance of this class.
get_mean(key)[source]#

Get mean value of key.

Parameters:
key: str

d80_cm, d80_deg, eff_area or eff_flen

Returns:
float

Mean value of key.

Raises:
KeyError

If key is not among the valid options.

get_std_dev(key)[source]#

Get std dev of key.

Parameters:
key: str

d80_cm, d80_deg, eff_area or eff_flen

Returns:
float

Std deviation of key.

Raises:
KeyError

If key is not among the valid options.

images()[source]#

Get list of PSFImages.

Returns:
List of PSFImage’s
plot(key, save=False, **kwargs)[source]#

Plot key vs off-axis angle and save the figure in pdf.

Parameters:
key: str

d80_cm, d80_deg, eff_area or eff_flen

save: bool

If True, figure will be saved.

**kwargs:

kwargs for plt.plot

Raises:
KeyError

If key is not among the valid options.

plot_histogram(key, **kwargs)[source]#

Plot histogram of key.

Parameters:
key: str

d80_cm, d80_deg, eff_area or eff_flen

**kwargs:

kwargs for plt.hist

Raises:
KeyError

If key is not among the valid options.

simulate(test=False, force=False)[source]#

Simulate RayTracing using SimulatorRayTracing.

Parameters:
test: bool

Test flag will make it faster by simulating much fewer photons.

force: bool

Force flag will remove existing files and simulate again.