Conversion from scene to photon.
Add model 'simple_aperture'.
# scene -> photon
photon_collection:
- name: simple_aperture
func: pyxel.models.photon_collection.simple_aperture
enabled: true
arguments:
pixel_scale: 1.65 #arcsec/pixel
aperture: 126.70e-3 #m
wavelength: 550.0 #nm
def flux2phot(flux: np.ndarray, t_exp: float, aperture: float) -> np.ndarray:
"""Convert flux (photon/s/cm2) to photon/s/pixel.
Parameters
----------
flux : np.ndarray
Scene object. Unit: photon/pixel/s/cm2.
t_exp : float
Exposure time. Unit: s.
aperture : float
Collecting area of the telescope. Unit: m.
Returns
-------
np.ndarray
Converted flux in photon/s/pixel.
"""
col_area = np.pi * (aperture * 1e2 / 2) ** 2
flux_converted = flux * t_exp * col_area
return flux_converted
converted_photon = tools.flux2phot(
flux=stars_flux, t_exp=detector.absolute_time, aperture=aperture
)
detector.photon.array += converted_photon