rubix.telescope.filters package#

Submodules#

rubix.telescope.filters.filters module#

class rubix.telescope.filters.filters.Filter(wavelength, response, name: str)[source]#

Bases: Module

A class representing a single filter with wavelength, response data and name.

wavelength(Float[Array, "n_wavelengths"])#

The wavelengths at which the filter response is defined.

response(Float[Array, "n_wavelengths"])#

The filter response at the corresponding wavelengths.

name(str)#

The name of the filter.

name: str#
plot(ax: Axes | None = None) None[source]#

Plot the filter response.

Parameters:

ax (Optional[plt.Axes]) – The axes on which to plot. If None, the current axes are used.

response: Float[Array, 'n_wavelengths']#
save(filter_path: str | None = '/home/annalena/rubix/rubix/telescope/filters/data') str[source]#

Save the filter response to a csv file.

Parameters:

filter_path (Optional[str], optional) – Path to save the filter response. Defaults to FILTERS_PATH. The filter response will be saved in a directory named after the facility, which is assumed to be the first part of the filter name, demarcated by a ‘/’. The filter response will be saved in a csv file named after the filter name.

Returns:

Absolute path to the saved CSV file.

Return type:

str

wavelength: Float[Array, 'n_wavelengths']#
class rubix.telescope.filters.filters.FilterCurves(filters)[source]#

Bases: Module

A class representing a collection of filter curves.

filters(List[Filter])#

The list of filter objects.

apply_filter_curves(cube: Float[Array, 'n_x n_y n_wavelengths'], wavelengths: Float[Array, 'n_wavelengths']) dict[source]#

Get the images of a cube of spectra through all filters.

Parameters:
  • cube (Float[Array, " n_x n_y n_wavelengths"]) – The cube of spectra.

  • wavelengths (Float[Array, " n_wavelengths"]) – The wavelengths of the cube.

Returns:

The images per filter.

Return type:

dict

filters: List[Filter]#
plot() None[source]#

Plot all filter responses on the same figure.

rubix.telescope.filters.filters.convolve_filter_with_spectra(filter: Filter, spectra: Float[Array, 'n_wavelengths'] | Float[Array, 'n_x n_y n_wavelengths'], wavelengths: Float[Array, 'n_wavelengths']) Float[Array, '1'] | Float[Array, 'n_x n_y'][source]#

Convolves a single filter with a single spectrum or a cube of spectra.

Parameters:
  • filter (Filter) – The filter to convolve with the spectrum or cube.

  • spectra (Union[Float[Array, " n_wavelengths"], Float[Array, " n_x n_y n_wavelengths"]]) – The spectrum or cube of spectra.

  • wavelengths (Float[Array, " n_wavelengths"]) – The wavelengths of the spectrum or cube.

Raises:

ValueError – If input array is not 1D (spectrum) or 3D (cube of spectra).

Returns:

The convolved flux value for a single spectrum or the convolved image for a cube of spectra.

Return type:

(jax.numpy.ndarray)

rubix.telescope.filters.filters.load_filter(facility: str, instrument: str | List[str] | None = None, filter_name: str | List[str] | None = None, filters_path: str | None = '/home/annalena/rubix/rubix/telescope/filters/data')[source]#

Load a single filter or all filters of a given facility and instrument as Filter objects. If filters are locally present we load them from the specified path, otherwise we download them from the SVO Filter Profile Service (http://svo2.cab.inta-csic.es/theory/fps/index.php). Filters are implicitly stored in the format of SVO: ‘facilty/instrument.filter.csv’

Parameters:
  • facility (str) – Name of the facility. e.g ‘SLOAN’ for SDSS.

  • instrument (Optional[Union[str, List[str]]]) – Name of the instrument/s e.g ‘SDSS’ for ‘SLOAN’. If None, all instruments are loaded.

  • filter_name (Optional[Union[str, List[str]]]) – Name of the specific filter/s to load. e.g ‘r’ for ‘SDSS.r’ which loads only the SDSS r-band filter. If None, all filters of the facility and instrument are loaded.

  • filters_path (Optional[str]) – Path to load/save filters on disk.

Returns:

FilterCurves object containing the Filter objects.

Return type:

FilterCurves

Raises:

ValueError – If a filter_name is provided without specifying the instrument.

rubix.telescope.filters.filters.print_filter_list(facility: str, instrument: str | None = None) None[source]#

Print the list of filters available for a given facility and instrument. If you want to see the list of all facilities and instruments, follow the link below: http (//svo2.cab.inta-csic.es/theory/fps/index.php):

Parameters:
  • facility (str) – Name of the facility. e.g ‘SLOAN’ for SDSS.

  • instrument (Optional[str], optional) – Name of the instrument. e.g ‘MIRI’ for ‘JWST’.

Returns:

None

rubix.telescope.filters.filters.print_filter_list_info(facility: str, instrument: str | None = None) None[source]#

Print the information of a filter list available for a given facility and instrument. If you want to see the list of all facilities and instruments, follow the link below: http (//svo2.cab.inta-csic.es/theory/fps/index.php):

Parameters:
  • facility (str) – Name of the facility. e.g ‘SLOAN’ for SDSS.

  • instrument (Optional[str], optional) – Name of the instrument. e.g ‘MIRI’ for ‘JWST’. Defaults to None.

Returns:

None

rubix.telescope.filters.filters.print_filter_property(facility: str, filter_name: str, instrument: str | None = None)[source]#

Print the properties of a filter available for a given facility, instrument and filter name. If you want to see the list of all facilities and instruments, follow the link below: http (//svo2.cab.inta-csic.es/theory/fps/index.php):

Parameters:
  • facility (str) – Name of the facility. e.g ‘SLOAN’ for SDSS.

  • filter_name (str) – Name of the filter. e.g ‘r’ for ‘SDSS.r’.

  • instrument (Optional[str], optional) – Name of the instrument. e.g ‘MIRI’ for ‘JWST’. Defaults to None.

Returns:

Table containing the filter properties such as wavelength range, effective wavelength, zero point etc.

Return type:

filter_info (Table)

rubix.telescope.filters.filters.save_filters(facility: str, filters_path: str | None = '/home/annalena/rubix/rubix/telescope/filters/data')[source]#

Download all filters of a given facility from the Filter Profile Service of the Spanisch Virtual Observatory (http://svo2.cab.inta-csic.es/theory/fps/index.php) and save them as csv file to the specified path.

Parameters:
  • facility (str) – Name of the facility. e.g ‘SLOAN’ for SDSS.

  • filters_path (Optional[str]) – Path to save the filters as csv files. Defaults to FILTERS_PATH.

Returns:

Table containing the filter list.

Return type:

(Table)

Module contents#