load_filter

speclite.filters.load_filter(name, load_from_cache=True, verbose=False)[source] [edit on github]

Load a single filter response by name.

See Filter Response Curves for details on the filter response file format and the available standard filters.

A filter response is normally only loaded from disk the first time this function is called, and subsequent calls immediately return the same cached object. Use the verbose option for details on how a filter is loaded:

>>> rband = load_filter('sdss2010-r')
>>> rband = load_filter('sdss2010-r', verbose=True)
Returning cached filter response "sdss2010-r"

Use load_filters() to load a sequence of filters from one or more filter groups.

Parameters:
namestr

Name of the filter response to load, which should normally have the format “<group_name>-<band_name>”, and refer to one of the reference filters described here. Otherwise, the name of any file in the ECSV format and containing the required fields can be provided. The existence of the “.ecsv” extension is used to distinguish between these cases and any other extension is considered an error.

load_from_cachebool

Return a previously cached response object if available. Otherwise, always load the file from disk.

verbosebool

Print verbose information about how this filter is loaded.

Returns:
FilterResponse

A FilterResponse object for the requested filter.

Raises:
ValueError

File does not exist or custom file has wrong extension.

RuntimeError

File is incorrectly formatted. This should never happen for the files included in the source code distribution.