scopesim_templates.misc.misc.source_from_imagehdu#
- scopesim_templates.misc.misc.source_from_imagehdu(image_hdu, filter_name, pixel_unit_amplitude=None, waverange=None, inst_pkg_path=None) Source#
Create a
scopesim.Sourceobject directly from afits.ImageHDU.- Parameters:
image_hdu (fits.ImageHDU)
filter_name (Path | str) – 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 – A Quantity that corresponds to a pixel value of 1 in the image If not given, header keyword BUNIT is used
optional – A Quantity that corresponds to a pixel value of 1 in the image If not given, header keyword BUNIT is used
inst_pkg_path (str, optional) – Not yet implemented
- Returns:
src
- Return type:
scopesim.Source
Examples
Using a generic filter curve from the Spanish VO:
>>> from scopesim_templates.misc import misc >>> image_hdu = fits.ImageHDU(
… data=np.ones((11, 11)), … header=fits.Header({ … “CUNIT1”: “deg”, … “CUNIT2”: “deg”, … “CDELT1”: 0.001, … “CDELT2”: 0.001, … })) >>> # add WCS info to the header here >>> filter_name = “Generic/Johnson_UBVRIJHKL.N” >>> src = misc.source_from_imagehdu(image_hdu=image_hdu, … filter_name=filter_name, … pixel_unit_amplitude=20*u.Jy)
Using the METIS H2O-ice filter from the METIS ScopeSim package:
>>> import scopesim >>> _ = scopesim.download_packages(["METIS"]) >>> filter_name = scopesim.rc.__search_path__[0] / \
… “METIS/filters/TC_filter_H2O-ice.dat” >>> src = misc.source_from_imagehdu(image_hdu=image_hdu, … filter_name=filter_name, … pixel_unit_amplitude=20*u.Jy)
Todo
Check if the image_hdu has WCS