SKA API#
Filters#
- class filter.Filter(id)[source]#
Bases:
object- compute_flux(spectrum)[source]#
Computes the flux of a spectrum in a given band.
- Parameters:
spectrum (ska.Spectrum) – The spectrum to compute the flux of
- Returns:
The computed mean flux density
- Return type:
float
- display_summary()[source]#
Displays a summary of the filter’s properties, including:
Filter ID
Facility (if available)
Instrument (if available)
Band (if available)
Central wavelength in microns
Full Width at Half Maximum (FWHM) in microns
Pivot wavelength in microns
- plot_transmission(figure=None, black=False)[source]#
Create a plot of the transmission.
- Parameters:
figure (str) – Path to save a figure
black (boolean) – Set True to plot the transmission on a black background (default=False)
- Returns:
Matplotlib figure and axe
- Return type:
figure, axe
- solar_color(filter, phot_sys='Vega', vega=None)[source]#
Compute the color of the Sun between current and provided filter
- Parameters:
filter (ska.Filter or str) – A SKA Filter object of a filter unique ID (see `SVO Filter Service <http://svo2.cab.inta-csic.es/theory/fps`__)
phot_sys (str) – Photometric system in which to report the color (default=AB)
vega (ska.Spectrum) – The spectrum of Vega (default=None)
- Returns:
The solar color
- Return type:
float
Spectrum#
- class spectrum.Spectrum(input=None)[source]#
Bases:
object- compute_color(id_filter_1, id_filter_2, phot_sys='Vega', vega=None)[source]#
Computes filter_1-filter_2 color of spectrum in the requested system.
- Parameters:
id_filter_1 (ska.Filter or str) – The first filter, a SKA Filter object of a filter unique ID (see SVO filter service)
id_filter_2 (ska.Filter) – The second filter, a SKA Filter object of a filter unique ID (see SVO filter service)
phot_sys (str) – Photometric system in which to report the color (default=Vega)
vega (ska.Spectrum) – The spectrum of Vega
- Returns:
The requested color
- Return type:
float
- from_blackbody(T)[source]#
Create a SKA spectrum of a blackbody at temperature T.
- Parameters:
T (float) – The temperature of the blackbody in Kelvin
- from_csv(file)[source]#
Create a SKA spectrum from a CSV file.
- Parameters:
file (str) – Path to a CSV file containing the spectrum
- from_dataframe(df)[source]#
Create a SKA spectrum from a pandas DataFrame.
- Parameters:
df (pd.DataFrame) – A DataFrame containing the spectrum. Columns must be Wavelength (in micron), and either Flux or Reflectance.
- from_numpy(arr, reflectance=False)[source]#
Create a SKA spectrum from a numpy array.
- Parameters:
arr (np.ndarray) – A numpy array containing the spectrum. Columns must be Wavelength (in micron), and either Flux or Reflectance.
reflectance (boolean) – Set True if the input is a reflectance spectrum (default=False)
- from_taxonomy(type)[source]#
Create a SKA reflectance spectrum from an asteroid template spectrum (Mahlke+2022 taxonomy).
- Parameters:
type (str) – The name of the spectral type (A, B, C, D, E, K, L… V, Z)
- plot(filters=None, figure=None, black=False)[source]#
Create a plot of the spectrum.
- Parameters:
figure (str) – Path to save a figure
black (boolean) – Set True to plot the transmission on a black background (default=False)
- Returns:
Matplotlib figure and axe
- Return type:
figure, axe
- reflectance_to_color(id_filter_1, id_filter_2, phot_sys='Vega', vega=None, sun=None)[source]#
Computes filter_1-filter_2 color for a reflectance spectrum.
- Parameters:
id_filter_1 (ska.Filter or str) – The first filter, a SKA Filter object of a filter unique ID (see SVO filter service)
id_filter_2 (ska.Filter) – The second filter, a SKA Filter object of a filter unique ID (see SVO filter service)
phot_sys (str) – Photometric system in which to report the color (default=Vega)
vega (ska.Spectrum) – Spectrum of Vega
sun (ska.Spectrum) – Spectrum of the Sun
- Returns:
The requested color
- Return type:
float
SVO Tools#
- svo.download_filter(id, force=False)[source]#
Download a filter VOTable from SVO Filter Service
- Parameters:
id (str) – The unique SVO filter identifier to be downloaded
force (bool) – If True, the filter VOTable will be downloaded even if it is already cached
- Returns:
The path to the filter VOTable file
- Return type:
str
- svo.download_filter_list()[source]#
Retrieve the list of filter IDs from `SVO Filter Service <http://svo2.cab.inta-csic.es/theory/fps`__
- Returns:
The list of filter IDS
- Return type:
list