scopesim_templates.misc.source_from_imagehdu

scopesim_templates.misc.source_from_imagehdu(image_hdu, filter_name, pixel_unit_amplitude=None, waverange=None, inst_pkg_path=None) Source

Create a scopesim.Source object directly from a fits.ImageHDU.

Parameters:
image_hdufits.ImageHDU
filter_namestr

Either a standard filter name or a filter from an instrument package

waverange: tuple

wave_min and wave_max of the spectral range

pixel_unit_amplitude, optional

A Quantity that corresponds to a pixel value of 1 in the image If not given, header keyword BUNIT is used

inst_pkg_pathstr, optional

Not yet implemented

Returns:
srcscopesim.Source

Examples

Using a generic filter curve from the Spanish VO:

>>> image_hdu = fits.ImageHDU(data=np.ones((11, 11)))
>>> # add WCS info to the header here
>>> filter_name = "Generic/Johnson_UBVRIJHKL.N"
>>> src = misc.source_from_imagehdu(image_hdu=hdu,
                                    filter_name=filter_name,
                                    pixel_unit_amplitude=20*u.Jy)

Using the METIS H2O-ice filter from the METIS ScopeSim package:

>>> import scopesim
>>> filter_name = scopesim.rc.__search_path__[0] + \
                  "/METIS/filters/TC_filter_H2O-ice.dat"
>>> src = misc.source_from_imagehdu(image_hdu=hdu,
                                    filter_name=filter_name,
                                    pixel_unit_amplitude=20*u.Jy)

TODO: Check if the image_hdu has WCS