photometry#
Methods for performing photometry / measuring fluxes.
- hsr4hci.photometry._gaussian_integral(amplitude, sigma, radius=0.5)[source]#
This function compute the following integral:
\[\int_{0}^{R} dr \int_{0}^{2\pi} d\phi \ r\ A e^{-\frac{r^2}{2\sigma^2}} = 2 \pi A \sigma^2 (1 - e^{-\frac{R^2}{2\sigma^2}})\]This function can be used to turn the results of the fit of a 2D Gaussian into units that are compatible with aperture photometry.
- hsr4hci.photometry._get_flux__as(frame, position, aperture_radius)[source]#
Auxiliary function to measure the flux using the βASβ mode. See
get_flux()for more details.
- hsr4hci.photometry._get_flux__ass(frame, position, aperture_radius, search_radius)[source]#
Auxiliary function to measure the flux using the βASSβ mode. See
get_flux()for more details.
- hsr4hci.photometry._get_flux__f(frame, position, mask_frame_radius=5.0)[source]#
Auxiliary function to measure the flux using the βFβ mode. See
get_flux()for more details.
- hsr4hci.photometry._get_flux__fs(frame, position, search_radius, mask_frame_radius=5.0)[source]#
Auxiliary function to measure the flux using the βFSβ mode. See
get_flux()for more details.
- hsr4hci.photometry._get_flux__p(frame, position)[source]#
Auxiliary function to measure the flux using the βPβ mode. See
get_flux()for more details.
- hsr4hci.photometry.get_flux(frame, position, mode='AS', aperture_radius=None, search_radius=None, mask_frame_radius=5.0)[source]#
This function estimates the flux at or around a given position in a frame. There are five different modes for how to do this:
- βASβ (aperture sum):
Compute the integrated flux over a circular aperture with radius aperture_radius at the given
position. This is perhaps the most βintuitiveβ way to compute the flux.
- βASSβ (aperture sum + search):
Similar to βASβ, except the position of the circular aperture is varied in a circular region with radius
search_radiusto find the position with the highest flux.
- βPβ (pixel):
Compute or interpolate the value of a single pixel at the given
position. (Internally, this simply uses an aperture with a diameter of 1 pixel.)
- βFβ (fit):
Compute the flux by fitting a 2D Gaussian to the given position and returning its
amplitude.
- βFSβ (fit + search):
Similar to βFβ, except the position of the 2D Gaussian is also optimized within the given
search_radius.
- Parameters:
frame (ndarray) β A 2D numpy array of shape (width, height) containing the data on which to run the aperture photometry.
position (Tuple[float, float]) β A tuple (x, y) specifying the position at which to estimate the flux.
mode (str) β Either βASβ, βASSβ, βPβ, βFβ, or βFSβ (see above for a detailed explanation).
aperture_radius (Optional[Quantity]) β Required for modes βASβ and βASSβ. Defines the radius of the circular aperture over the flux is summed up / integrated.
search_radius (Optional[Quantity]) β Required for modes βASSβ and βFSβ. Defines the size of the region within which we vary the position to find the βoptimalβ (= highest) flux.
mask_frame_radius (float) β
For modes βFβ and βFSβ (i.e., the modes that are based on fitting a 2D Gaussian to the data), we use a mask to set pixels to zero that are further away from the
position(plussearch_radius) than the givenmask_frame_radius. This is useful to avoid that other signals or speckles βin the distanceβ affect the result of the fit. Modes βPβ, βASβ, and βASSβ ignore this parameter.Caution
For measuring the stellar flux, this parameter should be set to a larger value than for planets; otherwise, the stellar flux will be under-estimated.
- Returns:
A tuple (final_position, flux), where the final_position is a 2-tuple of floats (i.e., the Cartesian position using the photutils coordinate convention).
- Return type:
- hsr4hci.photometry.get_fluxes_for_polar_positions(polar_positions, frame, mode='AS', aperture_radius=None, search_radius=None)[source]#
Auxiliary function for applying to
get_flux()to a list of positions that are given in (βastronomicalβ) polar coordinates.- Parameters:
polar_positions (List[Tuple[Quantity, Quantity]]) β A list of positions in polar coordinates, that is, every position is a tuple (separation, angle), where for the angle, 0 degrees is βupβ, not βrightβ.
frame (ndarray) β The frame / image on which to perform the photometry.
mode (str) β The
modeparameter forget_flux(); see there for more details.aperture_radius (Optional[Quantity]) β The
aperture_radiusparameter forget_flux(); see there for more details.search_radius (Optional[Quantity]) β The
search_radiusparameter forget_flux(); see there for more details.
- Returns:
A list of the fluxes for each given polar position.
- Return type:
- hsr4hci.photometry.get_stellar_flux(psf_template, dit_stack, dit_psf_template, mode='FS', scaling_factor=1.0, aperture_radius=None, search_radius=Quantity(1, 'pixel'))[source]#
This function takes the unsaturated PSF template and computes the flux of the star, normalized relative to the integration time of the stack.
- Parameters:
psf_template (ndarray) β 2D numpy array with the unsaturated PSF template.
dit_stack (float) β Integration time of the frames in the stack (in seconds).
dit_psf_template (float) β Integration time of the unsaturated PSF template (in seconds).
scaling_factor (float) β A scaling factor to account for neutral density (ND) filters. Example: If the transmission is 2%, use a value of 0.02 for the
scaling_factor.mode (str) β See
get_aperture_flux()for more details. For the stellar flux, mode βFSβ is recommended.aperture_radius (Optional[Quantity]) β See
get_aperture_flux()for details.search_radius (Optional[Quantity]) β See
get_aperture_flux()for details.
- Returns:
The stellar flux, normalized relative to the DIT of the stack.
- Return type: