scopesim.optics.surface_utils module

scopesim.optics.surface_utils.extract_base_from_unit(unit, base_unit)[source]

Extract astropy base unit from a compound unit.

Parameters:
unitastropy.Unit
base_unitUnit, str
Returns:
new_unitUnit

The input unit minus any base units corresponding to base_unit.

extracted_unitsUnit

Any base units corresponding to base_unit.

scopesim.optics.surface_utils.extract_type_from_unit(unit, unit_type)[source]

Extract astropy physical type from a compound unit.

Parameters:
unitastropy.Unit
unit_typestr

The physical type of the unit as given by astropy

Returns:
new_unitUnit

The input unit minus any base units corresponding to unit_type.

extracted_unitsUnit

Any base units corresponding to unit_type.

scopesim.optics.surface_utils.make_emission_from_array(flux, wave, meta) SourceSpectrum[source]

Create an emission SourceSpectrum using an array.

Takes care of bins and solid angles. The solid_angle is kept in the returned SourceSpectrum meta dictionary under self.meta[“solid_angle”].

Parameters:
fluxarray-like, Quantity

if flux is not an array, the emission_unit must be in meta dict

wavearray-like, Quantity

if flux is not an array, the wavelength_unit must be in meta dict

metadict
Returns:
fluxsynphot.SourceSpectrum
scopesim.optics.surface_utils.make_emission_from_emissivity(temp: Quantity, emiss_src_spec) SourceSpectrum[source]

Create an emission SourceSpectrum using blackbody and emissivity curves.

Parameters:
tempQuantity[Kelvin]

Blackbody temperature.

emiss_src_specsynphot.SpectralElement

An emissivity response curve in the range [0..1]

Returns:
fluxsynphot.SourceSpectrum
scopesim.optics.surface_utils.normalise_flux_if_binned(flux, wave)[source]

Convert a binned flux Quantity array back into flux density.

The flux density normalising unit is taken from the wavelength Quantity unit.

Parameters:
fluxarray-like Quantity

flux unit must include bin, e.g. ph s-1 m-2 bin-1

wavearray-like Quantity
Returns:
fluxarray-like Quantity