PSF Analysis#

The PSF analysis module supports the Ray Tracing module provided algorithm for the analysis of the optical point-spread function. Its main class PSFImage receives the focal length and the list of photons positions to calculate the PSF characteristics and plot results.

psf_analysis#

Module to analyse psf images (e.g. results from ray tracing simulations). Main functionalities are: computing centroids, psf containers etc.

Author: Raul R Prado

class psf_analysis.PSFImage(focal_length=None, total_scattered_area=None)[source]#

Image composed of list of photon positions (2D).

Load photon list from sim_telarray file and compute centroids, psf containers, effective area, as well as plot the image as a 2D histogram. Internal units: photon positions in cm internally.

Parameters:
focal_length: float, optional

Focal length of the system in cm. If not given, PSF can only be computed in cm.

total_scattered_area: float, optional

Scatter area of all photons in cm^2. If not given, effective area cannot be computed.

get_cumulative_data(radius=None)[source]#

Provide cumulative data (intensity vs radius).

Parameters:
radius: array

Array with radius calculate the cumulative PSF in distance units.

Returns:
(radius, intensity)
get_effective_area()[source]#

Return effective area pre calculated

Returns:
float

Pre-calculated effective area. None if it could not be calculated (e.g because the total scattering area was not set).

get_image_data(centralized=True)[source]#

Provide image data (2D photon positions in cm) as lists.

Parameters:
centralized: bool

Centroid of the image is set to (0, 0) if True.

Returns:
(x, y), the photons positions in cm.
get_psf(fraction=0.8, unit='cm')[source]#

Return PSF

Parameters:
fraction: float

Fraction of photons within the containing radius.

unit: str

‘cm’ or ‘deg’. ‘deg’ will not work if focal length was not set.

Returns:
float:

Containing diameter for a certain intensity fraction (PSF).

plot_cumulative(**kwargs)[source]#

Plot cumulative data (intensity vs radius).

Parameters:
**kwargs:

image_* for the histogram plot and psf_* for the psf circle.

plot_image(centralized=True, **kwargs)[source]#

Plot 2D image as histogram (in cm).

Parameters:
centralized: bool

Centroid of the image is set to (0, 0) if True.

**kwargs:

image_* for the histogram plot and psf_* for the psf circle.

read_photon_list_from_simtel_file(photons_file)[source]#

Read photon list file generated by sim_telarray and store the photon positions (2D).

Parameters:
photons_file: str

Name of sim_telarray file with photon list.

Raises:
RuntimeError

If photon positions X and Y are not compatible or are empty.

set_effective_area(value)[source]#

Set effective area

Parameters:
value: float

Effective area

set_psf(value, fraction=0.8, unit='cm')[source]#

Set PSF calculated from other methods.

Parameters:
value: float

PSF value to be set

fraction: float

Fraction of photons within the containing radius.

unit: str

‘cm’ or ‘deg’. ‘deg’ will not work if focal length was not set.