PSF#

Function to calculate PSF

psf.Wavefront_pos(x, y, pupil_grid)#

Compute the wavefront with a given position.

Parameters:
  • x (float) – x-coordinate of the wavefront position.

  • y (float) – y-coordinate of the wavefront position.

  • pupil_grid – Grid representing the pupil plane.

Returns:

Wavefront at the specified position.

Return type:

Field

psf.cir_core_throughput_plot(psfs, plot_dpi=300)#

Plot the core throughput of a series of circular symmetric PSFs.

Parameters:
  • psfs (numpy.ndarray) – The normalized PSFs.

  • plot_dpi (int) – Dots per inch (DPI) for the plot.

Returns:

Core_throughput.png

psf.cir_iwa(psfs)#

Calculate the inner working angle (IWA) of a series of circular symmetric PSFs.

Parameters:

psfs (numpy.ndarray) – The normalized PSFs.

Returns:

The IWA of the PSFs, in units of pixel.

Return type:

int

psf.cir_psf(pre_img, planets_pos, planet_brightness, psf_scale, iwa_ignore, add_planet, img_pixel, rot_number, psfs_name)#

Calculates the final image of a circular symmetric pre-image through circular symmetric PSF with added planets.

Parameters:
  • pre_img (np.ndarray) – The input image.

  • planets_pos (list) – List of planet positions.

  • planet_brightness (list) – List of planet brightness values.

  • psf_scale (float) – Scale of the PSF.

  • add_planet (bool) – Whether to add planets to the PSF.

  • img_pixel (int) – Number of pixels in the image.

  • rot_number (int) – Number of rotations for generating the circular PSF.

  • psfs_name (str) – Name of the file containing PSFs.

Returns:

Final image.

Return type:

np.ndarray

psf.cir_psf_contrast(pre_img, planet_psfs_number, planet_angle, planet_brightness, psf_scale, img_pixel, rot_number, psfs_name)#

Find the planet brightness and background brightness in the final image.

Parameters:
  • pre_img (np.ndarray) – The input image.

  • planet_psfs_number (int) – According to the distance between the planet and the origin, choose the nearest psf.

  • planet_angle (float) – The angle between the x-axis and the line of the planet and the origin.

  • planet_brightness (list) – List of planet brightness values.

  • psf_scale (float) – Scale of the PSF.

  • img_pixel (int) – Number of pixels in the image.

  • rot_number (int) – Number of rotations for generating the circular PSF.

  • psfs_name (str) – Name of the file containing PSFs.

Returns:

planet brightness, background brightness, background brightness (ignored dust inside IWA) in Jy.

Return type:

tuple

psf.cir_psf_planets(planets_pos, planet_brightness, psf_scale, img_pixel, psfs_name)#

Add one or more planets to an image through a series of circular symmetric PSFs.

Parameters:
  • planets_pos (list) – A list of planet positions, in units of arcsec.

  • planet_brightness (list) – A list of planet brightnesses, in units of Jy.

  • psf_scale (float) – The scale of the PSF, in units of arcsec.

  • img_pixel (int) – The number of pixels in the image.

  • psfs_name (str) – The file name of the PSFs.

Returns:

The image of planets.

Return type:

np.ndarray

psf.core_throughput_fun(psfs)#

Calculate the core throughput of a series of PSFs.

Parameters:

psfs (numpy.ndarray) – The normalized PSFs.

Returns:

The core throughput of the psfs

Return type:

numpy.ndarray

psf.core_throughput_vectorized(psfs)#

Calculate the core throughput of a series of PSFs in a vectorized way.

Parameters:

psfs (numpy.ndarray) – The normalized PSFs.

Returns:

The core throughput of the psfs

Return type:

numpy.ndarray

psf.psf_calculation(charge, img_pixel, psf_range, lyot_mask_size, num_cores)#

Calculates the PSFs of a vortex coronagraph for a given charge along the positive x-axis, and saves them to a file.

Parameters:
  • charge (int) – Charge of the vortex coronagraph.

  • img_pixel (int) – Number of pixels on one edge of the image.

  • psf_range (float) – Range of the PSF in lambda/D.

  • num_cores (int) – Number of CPU cores to use for multiprocessing.

Returns:

Array of calculated PSFs.

Return type:

np.ndarray

psf.psf_chunk(i, img_pixel, psf_range, pupil_grid, prop, lyot_stop, coro)#

Calculate a chunk of PSF.

Parameters:
  • i (int) – Index of the chunk.

  • img_pixel (int) – Number of pixels in the image.

  • psf_range (float) – Range of the PSF.

  • pupil_grid – Grid representing the pupil plane.

  • prop – Propagator for the PSF calculation.

  • lyot_stop – Lyot stop for the coronagraph.

  • coro – Coronagraph for the PSF calculation.

Returns:

Index and the calculated PSF chunk as a 2D numpy array.

Return type:

tuple