Utilities (utils
)#
Introduction#
ctapipe.utils
contains a variety of low-level functionality used by
other modules that are not part of the ctapipe.core
package.
Classes in this package may eventually move to ctapipe.core
if they
have a stable enough API and are more widely used.
It currently provides:
ND Histogramming (see
Histogram
)ND table interpolation (see
TableInterpolator
)access to service datasets
linear algebra helpers
dynamic class access
json conversion
Access To Service Data Files#
The get_dataset_path()
function provides a common way to load CTA “SVC”
data (e.g. required lookups, example data, etc). It returns the full
directory path to the requested file. It currently works as follows:
it checks all directories in the CTA_SVC_PATH environment variable (which should be a colon-separated list of directories, like PATH)
if it doesn’t find it there, it checks the ctapipe_resources module (which should be installed already in the package ctapipe-extra), which contains defaults.
Tabular data can be accessed automatically using
get_table_dataset(basename)
,
where the basename
is the filename without the extension.
Several tabular formats will be searched and when the file is found it will be
opened and read as an astropy.table.Table
object. For example:
from ctapipe.utils import get_table_dataset
optics = get_table_dataset('optics')
print(optics)
Reference/API#
ctapipe.utils Package#
Functions#
|
Returns a list of resource names (or substrings) matching the given pattern, searching first in searchpath (a colon-separated list of directories) and then in the ctapipe_resources module) |
|
get a tabular dataset as an |
|
Returns the full file path to an auxiliary dataset needed by ctapipe, given the dataset's full name (filename with no directory). |
|
Search in searchpath for filename, returning full path. |
|
Get the absolute path of ctapipe resource files. |
|
Get an astropy table of bright stars from the specified star catalog. |
Classes#
|
An N-D histogram class with FITS image I/O. |
|
This is a simple class for loading lookup tables from a fits file and interpolating between them |
|
This class performs linear interpolation between an unstructured set of data points. |
|
Helper class to find the index of the closest matching value in an array/list/..., used to locate the pointing of an event based on the trigger time. |
|
Check that an event has one of the allowed types |
ctapipe.utils.astro Module#
This module is intended to contain astronomy-related helper tools which are not provided by external packages and/or to satisfy particular needs of usage within ctapipe.
Functions#
|
Utility function to download a star catalog for the get_bright_stars function. |
|
Get an astropy table of bright stars from the specified star catalog. |
Classes#
|
Enumeration of star catalogs with their respective metadata. |
|
ctapipe.utils.datasets Module#
Functions#
|
Returns the full file path to an auxiliary dataset needed by ctapipe, given the dataset's full name (filename with no directory). |
|
Search in searchpath for filename, returning full path. |
|
Returns a list of resource names (or substrings) matching the given pattern, searching first in searchpath (a colon-separated list of directories) and then in the ctapipe_resources module) |
Get the default download url for datasets |
ctapipe.utils.download Module#
Functions#
|
Download a file. |
|
|
|
Downloads a file from a dataserver and caches the result locally in |
ctapipe.utils.linalg Module#
Functions#
|
construct a 2D rotation matrix as a numpy NDArray that rotates a vector clockwise. |
|
returns the length/norm of a numpy array as the square root of the inner product with itself |
|
Sets the length of the vector to 1 |
|
computes the angle between two vectors |