wf_psf.psf_models.tf_modules module

class wf_psf.psf_models.tf_modules.TF_Zernike_mono_PSF(phase_N, lambda_obs, obscurations, zernike_maps, output_dim=64, name=None)[source]

Bases: Module

Build a monochromatic PSF from zernike coefficients.

Following a Zernike model.

Attributes:
name

Returns the name of this module as passed or determined in the ctor.

name_scope

Returns a tf.name_scope instance for this class.

non_trainable_variables

Sequence of non-trainable variables owned by this module and its submodules.

submodules

Sequence of all sub-modules.

trainable_variables

Sequence of trainable variables owned by this module and its submodules.

variables

Sequence of variables owned by this module and its submodules.

Methods

__call__(z_coeffs)

Call self as a function.

with_name_scope(method)

Decorator to automatically enter the module name scope.

class wf_psf.psf_models.tf_modules.TF_build_phase(phase_N, lambda_obs, obscurations, name=None)[source]

Bases: Module

Build complex phase map from OPD map.

Attributes:
name

Returns the name of this module as passed or determined in the ctor.

name_scope

Returns a tf.name_scope instance for this class.

non_trainable_variables

Sequence of non-trainable variables owned by this module and its submodules.

submodules

Sequence of all sub-modules.

trainable_variables

Sequence of trainable variables owned by this module and its submodules.

variables

Sequence of variables owned by this module and its submodules.

Methods

__call__(opd)

Build the phase from the opd.

apply_obscurations(phase)

Multiply element-wise with the obscurations.

opd_to_phase(opd)

Convert from opd to phase.

with_name_scope(method)

Decorator to automatically enter the module name scope.

zero_padding_diffraction(no_pad_phase)

Pad with zeros corresponding to the required lambda.

apply_obscurations(phase)[source]

Multiply element-wise with the obscurations.

opd_to_phase(opd)[source]

Convert from opd to phase.

zero_padding_diffraction(no_pad_phase)[source]

Pad with zeros corresponding to the required lambda.

Important: To check the original size of the no_pad_phase variable we have to look in the [1] dimension not the [0] as it is the batch.

class wf_psf.psf_models.tf_modules.TF_fft_diffract(output_dim=64, output_Q=2, name=None)[source]

Bases: Module

Diffract the wavefront into a monochromatic PSF.

Parameters:
  • output_dim (int) – Dimension of the output square postage stamp

  • output_Q (int) – Downsampling factor. Must be integer.

Attributes:
name

Returns the name of this module as passed or determined in the ctor.

name_scope

Returns a tf.name_scope instance for this class.

non_trainable_variables

Sequence of non-trainable variables owned by this module and its submodules.

submodules

Sequence of all sub-modules.

trainable_variables

Sequence of trainable variables owned by this module and its submodules.

variables

Sequence of variables owned by this module and its submodules.

Methods

__call__(input_phase)

Calculate the normalized PSF from the padded phase array.

tf_crop_img(image, output_crop_dim)

Crop images with tf methods.

with_name_scope(method)

Decorator to automatically enter the module name scope.

crop_img

normalize_psf

crop_img(image)[source]
normalize_psf(psf)[source]
tf_crop_img(image, output_crop_dim)[source]

Crop images with tf methods.

It handles a batch of 2D images: [batch, width, height]

class wf_psf.psf_models.tf_modules.TF_mono_PSF(phase_N, lambda_obs, obscurations, output_Q, output_dim=64, name=None)[source]

Bases: Module

Calculate a monochromatic PSF from an OPD map.

Attributes:
name

Returns the name of this module as passed or determined in the ctor.

name_scope

Returns a tf.name_scope instance for this class.

non_trainable_variables

Sequence of non-trainable variables owned by this module and its submodules.

submodules

Sequence of all sub-modules.

trainable_variables

Sequence of trainable variables owned by this module and its submodules.

variables

Sequence of variables owned by this module and its submodules.

Methods

__call__(opd)

Call self as a function.

with_name_scope(method)

Decorator to automatically enter the module name scope.

class wf_psf.psf_models.tf_modules.TF_zernike_OPD(zernike_maps, name=None)[source]

Bases: Module

Turn zernike coefficients into an OPD.

Will use all of the Zernike maps provided. Both the Zernike maps and the Zernike coefficients must be provided.

Parameters:
  • zernike_maps (Tensor (Num_coeffs, x_dim, y_dim)) –

  • z_coeffs (Tensor (num_star, num_coeffs, 1, 1)) –

Returns:

opd

Return type:

Tensor (num_star, x_dim, y_dim)

Attributes:
name

Returns the name of this module as passed or determined in the ctor.

name_scope

Returns a tf.name_scope instance for this class.

non_trainable_variables

Sequence of non-trainable variables owned by this module and its submodules.

submodules

Sequence of all sub-modules.

trainable_variables

Sequence of trainable variables owned by this module and its submodules.

variables

Sequence of variables owned by this module and its submodules.

Methods

__call__(z_coeffs)

Call self as a function.

with_name_scope(method)

Decorator to automatically enter the module name scope.