scopesim.source.source.Source#
- class scopesim.source.source.Source(filename=None, cube=None, ext=0, lam=None, spectra=None, x=None, y=None, ref=None, weight=None, table=None, image_hdu=None, flux=None, field=None, **kwargs)#
Bases:
objectCreate a source object from a file or from arrays.
A Source object must consist of a spatial and a spectral description of the on-sky source. Many sources can be added together and kept in memory as a single Source object.
The spatial descriptions are kept in the
<Source>.fieldslist, while the spectral descriptions are in the<Source>.spectralist.The spatial description can be built from any combination of:
a list of arrays (like in SimCADO >v0.5)
astropy Table objects
astropy ImageHDU objects
on disk FITS files
on disk ASCII tables
The spectral descriptions can be passed as either
synphot.SourceSpectrumobjects, or a set of two equal length arrays for wavelength and flux.Hint
Initialisation parameter combinations include:
New ScopeSim-style input -
table=<astropy.Table>, spectra=<list of synphot.SourceSpectrum>-table=<astropy.Table>, lam=<array>, spectra=<list of array>-image_hdu=<fits.ImageHDU>, spectra=<list of synphot.SourceSpectrum>-image_hdu=<fits.ImageHDU>, lam=<array>, spectra=<list of array>-image_hdu=<fits.ImageHDU>, flux=<astropy.Quantity>Old SimCADO-style input -
x=<array>, y=<array>, ref=<array>, spectra=<list of synphot.SourceSpectrum>-x=<array>, y=<array>, ref=<array>, spectra=<list of array>, lam=<array>-x=<array>, y=<array>, ref=<array>, weight=<array>, spectra=<list of array>, lam=<array>More details on the content of these combinations can be found in the use-case documentation.
- Parameters:
filename (str)
lam (np.array) – [um] Wavelength bins of length (m)
spectra (list of synphot.SourceSpectra) – [ph/s/cm2/AA]
x (np.array) – [arcsec] coordinates of where the emitting files are relative to the centre of the field of view
y (np.array) – [arcsec] coordinates of where the emitting files are relative to the centre of the field of view
ref (np.array) – the index for .spectra which connects a position (x, y) to a spectrum
flux(x[i], y[i]) = spectra[ref[i]] * weight[i]weight (np.array) – A weighting to scale the relevant spectrum for each position
table (astropy.Table)
image_hdu (fits.ImageHDU) – [arcsec-2] The .data array is simply a map of weights for the assiciated spectrum referenced by .header[“SPEC_REF]. Surface brightness values are assumed to be per arcsec2
flux (astropy.Quantity) – [u.mag, u.ABmag, u.Jy] Flux values are converted to a reference spectrum that is referenced by image_hdu.header[“SPEC_REF”]. flux can only be used in conjuction with image_hdu
- fields#
The spatial distribution of the on-sky source, either as
fits.ImageHDUorastropy.Tableobjects- Type:
- spectra#
Dictionary of spectra associated with the fields
- Type:
dict of
synphot.SourceSpectrumobjects
See also
synphothttps://synphot.readthedocs.io/en/latest/Added the ability to instantiate directly from an existing SourceField subclass instance.
- __init__(filename=None, cube=None, ext=0, lam=None, spectra=None, x=None, y=None, ref=None, weight=None, table=None, image_hdu=None, flux=None, field=None, **kwargs)#
Methods
__init__([filename, cube, ext, lam, ...])append(source_to_add)fluxes(wave_min, wave_max, **kwargs)image(wave_min, wave_max, **kwargs)image_in_range(wave_min, wave_max[, ...])make_copy()photons_in_range(wave_min, wave_max[, area, ...])plot()Plot the location of source components.
rotate(angle[, offset, layers])shift([dx, dy, layers])Shift the position of one or more fields w.r.t.
Attributes
bandpassList of fields that are defined through 3D datacubes.
List of fields that are defined through 2D images.
List of fields that are defined through tables.
- property cube_fields#
List of fields that are defined through 3D datacubes.
- property image_fields#
List of fields that are defined through 2D images.
- photons_in_range(wave_min, wave_max, area=None, indices=None)#
- plot()#
Plot the location of source components.
Source components instantiated from 2d or 3d ImageHDUs are represented by their spatial footprint. Source components instantiated from tables are shown as points.
- shift(dx: float = 0, dy: float = 0, layers=None) None#
Shift the position of one or more fields w.r.t. the optical axis.
- property table_fields#
List of fields that are defined through tables.