wf_psf.psf_models.tf_layers module
- class wf_psf.psf_models.tf_layers.OLD_TF_batch_poly_PSF(*args, **kwargs)[source]
Bases:
Layer
Calculate a polychromatic PSF from an OPD and stored SED values.
The calculation of the packed values with the respective SED is done with the SimPSFToolkit class but outside the TF class.
- obscurations: Tensor(pupil_len, pupil_len)
Obscurations to apply to the wavefront.
packed_SED_data: Tensor(batch_size, 3, n_bins_lda)
- Comes from: tf.convert_to_tensor(list(list(Tensor,Tensor,Tensor)))
Where each inner list consist of a packed_elem:
packed_elems: Tuple of tensors Contains three 1D tensors with the parameters needed for the calculation of one monochromatic PSF.
packed_elems[0]: phase_N packed_elems[1]: lambda_obs packed_elems[2]: SED_norm_val
The SED data is constant in a FoV.
- psf_batch: Tensor(batch_size, output_dim, output_dim)
Tensor containing the psfs that will be updated each time a calculation is required.
- Attributes:
activity_regularizer
Optional regularizer function for the output of this layer.
compute_dtype
The dtype of the layer’s computations.
dtype
The dtype of the layer weights.
dtype_policy
The dtype policy associated with this layer.
dynamic
Whether the layer is dynamic (eager-only); set in the constructor.
inbound_nodes
Return Functional API nodes upstream of this layer.
input
Retrieves the input tensor(s) of a layer.
input_mask
Retrieves the input mask tensor(s) of a layer.
input_shape
Retrieves the input shape(s) of a layer.
input_spec
InputSpec instance(s) describing the input format for this layer.
losses
List of losses added using the add_loss() API.
metrics
List of metrics added using the add_metric() API.
name
Name of the layer (string), set in the constructor.
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.
non_trainable_weights
List of all non-trainable weights tracked by this layer.
outbound_nodes
Return Functional API nodes downstream of this layer.
output
Retrieves the output tensor(s) of a layer.
output_mask
Retrieves the output mask tensor(s) of a layer.
output_shape
Retrieves the output shape(s) of a layer.
- stateful
submodules
Sequence of all sub-modules.
supports_masking
Whether this layer supports computing a mask using compute_mask.
- trainable
trainable_variables
Sequence of trainable variables owned by this module and its submodules.
trainable_weights
List of all trainable weights tracked by this layer.
- updates
variable_dtype
Alias of Layer.dtype, the dtype of the weights.
variables
Returns the list of all layer variables/weights.
weights
Returns the list of all layer variables/weights.
Methods
__call__
(*args, **kwargs)Wraps call, applying pre- and post-processing steps.
add_loss
(losses, **kwargs)Add loss tensor(s), potentially dependent on layer inputs.
add_metric
(value[, name])Adds metric tensor to the layer.
add_update
(updates)Add update op(s), potentially dependent on layer inputs.
add_variable
(*args, **kwargs)Deprecated, do NOT use! Alias for add_weight.
add_weight
([name, shape, dtype, ...])Adds a new variable to the layer.
build
(input_shape)Creates the variables of the layer (optional, for subclass implementers).
calculate_mono_PSF
(packed_elems)Calculate monochromatic PSF from packed elements.
calculate_poly_PSF
(packed_elems)Calculate a polychromatic PSF.
call
(inputs)Calculate the batch poly PSFs.
compute_mask
(inputs[, mask])Computes an output mask tensor.
compute_output_shape
(input_shape)Computes the output shape of the layer.
compute_output_signature
(input_signature)Compute the output tensor signature of the layer based on the inputs.
count_params
()Count the total number of scalars composing the weights.
finalize_state
()Finalizes the layers state after updating layer weights.
from_config
(config)Creates a layer from its config.
get_config
()Returns the config of the layer.
get_input_at
(node_index)Retrieves the input tensor(s) of a layer at a given node.
get_input_mask_at
(node_index)Retrieves the input mask tensor(s) of a layer at a given node.
get_input_shape_at
(node_index)Retrieves the input shape(s) of a layer at a given node.
get_output_at
(node_index)Retrieves the output tensor(s) of a layer at a given node.
get_output_mask_at
(node_index)Retrieves the output mask tensor(s) of a layer at a given node.
get_output_shape_at
(node_index)Retrieves the output shape(s) of a layer at a given node.
get_weights
()Returns the current weights of the layer, as NumPy arrays.
set_psf_batch
(psf_batch)Set poly PSF batch.
set_weights
(weights)Sets the weights of the layer, from NumPy arrays.
with_name_scope
(method)Decorator to automatically enter the module name scope.
- class wf_psf.psf_models.tf_layers.TF_NP_GRAPH_OPD(*args, **kwargs)[source]
Bases:
Layer
Non-parametric OPD generation with only graph-cosntraint variations.
- Parameters:
obs_pos (tensor(n_stars, 2)) – Observed positions of the n_stars in the dataset. The indexing of the positions has to correspond to the indexing in the spatial_dic.
spatial_dic (tensor(n_stars, n_dic_elems)) – Dictionary containing the spatial-constraint dictionary. n_stars corresponds to the total number of stars in the dataset. n_dic_elems corresponds to the number of elements of the dictionary, not to be confounded with n_comp, the total number of non-parametric features of the wavefront-PSF.
graph_comps (int) – Number of wavefront-PSF features correspondign to the graph constraint.
d_max (int) – Max degree of polynomial determining the FoV variations. The number of wavefront-PSF features of the polynomial part is computed (d_max+1)*(d_max+2)/2.
opd_dim (int) – Dimension of the OPD maps. Same as pupil diameter.
- Attributes:
activity_regularizer
Optional regularizer function for the output of this layer.
compute_dtype
The dtype of the layer’s computations.
dtype
The dtype of the layer weights.
dtype_policy
The dtype policy associated with this layer.
dynamic
Whether the layer is dynamic (eager-only); set in the constructor.
inbound_nodes
Return Functional API nodes upstream of this layer.
input
Retrieves the input tensor(s) of a layer.
input_mask
Retrieves the input mask tensor(s) of a layer.
input_shape
Retrieves the input shape(s) of a layer.
input_spec
InputSpec instance(s) describing the input format for this layer.
losses
List of losses added using the add_loss() API.
metrics
List of metrics added using the add_metric() API.
name
Name of the layer (string), set in the constructor.
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.
non_trainable_weights
List of all non-trainable weights tracked by this layer.
outbound_nodes
Return Functional API nodes downstream of this layer.
output
Retrieves the output tensor(s) of a layer.
output_mask
Retrieves the output mask tensor(s) of a layer.
output_shape
Retrieves the output shape(s) of a layer.
- stateful
submodules
Sequence of all sub-modules.
supports_masking
Whether this layer supports computing a mask using compute_mask.
- trainable
trainable_variables
Sequence of trainable variables owned by this module and its submodules.
trainable_weights
List of all trainable weights tracked by this layer.
- updates
variable_dtype
Alias of Layer.dtype, the dtype of the weights.
variables
Returns the list of all layer variables/weights.
weights
Returns the list of all layer variables/weights.
Methods
__call__
(*args, **kwargs)Wraps call, applying pre- and post-processing steps.
add_loss
(losses, **kwargs)Add loss tensor(s), potentially dependent on layer inputs.
add_metric
(value[, name])Adds metric tensor to the layer.
add_update
(updates)Add update op(s), potentially dependent on layer inputs.
add_variable
(*args, **kwargs)Deprecated, do NOT use! Alias for add_weight.
add_weight
([name, shape, dtype, ...])Adds a new variable to the layer.
build
(input_shape)Creates the variables of the layer (optional, for subclass implementers).
call
(positions)Calculate the OPD maps for the given positions.
compute_mask
(inputs[, mask])Computes an output mask tensor.
compute_output_shape
(input_shape)Computes the output shape of the layer.
compute_output_signature
(input_signature)Compute the output tensor signature of the layer based on the inputs.
count_params
()Count the total number of scalars composing the weights.
finalize_state
()Finalizes the layers state after updating layer weights.
from_config
(config)Creates a layer from its config.
get_config
()Returns the config of the layer.
get_input_at
(node_index)Retrieves the input tensor(s) of a layer at a given node.
get_input_mask_at
(node_index)Retrieves the input mask tensor(s) of a layer at a given node.
get_input_shape_at
(node_index)Retrieves the input shape(s) of a layer at a given node.
get_output_at
(node_index)Retrieves the output tensor(s) of a layer at a given node.
get_output_mask_at
(node_index)Retrieves the output mask tensor(s) of a layer at a given node.
get_output_shape_at
(node_index)Retrieves the output shape(s) of a layer at a given node.
get_weights
()Returns the current weights of the layer, as NumPy arrays.
Initialize trainable variables.
predict
(positions)Prediction step.
Set alpha matrix to the identity.
Set alpha matrix to zero.
set_weights
(weights)Sets the weights of the layer, from NumPy arrays.
with_name_scope
(method)Decorator to automatically enter the module name scope.
- call(positions)[source]
Calculate the OPD maps for the given positions.
Calculating: batch(spatial_dict) x alpha x S
- Parameters:
positions (Tensor(batch, 2)) – First element is x-axis, second is y-axis.
- Returns:
opd_maps
- Return type:
Tensor(batch, opd_dim, opd_dim)
- class wf_psf.psf_models.tf_layers.TF_NP_MCCD_OPD_v2(*args, **kwargs)[source]
Bases:
Layer
Non-parametric OPD generation with hybrid-MCCD variations.
- Parameters:
obs_pos (tensor(n_stars, 2)) – Observed positions of the n_stars in the dataset. The indexing of the positions has to correspond to the indexing in the spatial_dic.
spatial_dic (tensor(n_stars, n_dic_elems)) – Dictionary containing the spatial-constraint dictionary. n_stars corresponds to the total number of stars in the dataset. n_dic_elems corresponds to the number of elements of the dictionary, not to be confounded with n_comp, the total number of non-parametric features of the wavefront-PSF.
graph_comps (int) – Number of wavefront-PSF features correspondign to the graph constraint.
d_max (int) – Max degree of polynomial determining the FoV variations. The number of wavefront-PSF features of the polynomial part is computed (d_max+1)*(d_max+2)/2.
opd_dim (int) – Dimension of the OPD maps. Same as pupil diameter.
- Attributes:
activity_regularizer
Optional regularizer function for the output of this layer.
compute_dtype
The dtype of the layer’s computations.
dtype
The dtype of the layer weights.
dtype_policy
The dtype policy associated with this layer.
dynamic
Whether the layer is dynamic (eager-only); set in the constructor.
inbound_nodes
Return Functional API nodes upstream of this layer.
input
Retrieves the input tensor(s) of a layer.
input_mask
Retrieves the input mask tensor(s) of a layer.
input_shape
Retrieves the input shape(s) of a layer.
input_spec
InputSpec instance(s) describing the input format for this layer.
losses
List of losses added using the add_loss() API.
metrics
List of metrics added using the add_metric() API.
name
Name of the layer (string), set in the constructor.
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.
non_trainable_weights
List of all non-trainable weights tracked by this layer.
outbound_nodes
Return Functional API nodes downstream of this layer.
output
Retrieves the output tensor(s) of a layer.
output_mask
Retrieves the output mask tensor(s) of a layer.
output_shape
Retrieves the output shape(s) of a layer.
- stateful
submodules
Sequence of all sub-modules.
supports_masking
Whether this layer supports computing a mask using compute_mask.
- trainable
trainable_variables
Sequence of trainable variables owned by this module and its submodules.
trainable_weights
List of all trainable weights tracked by this layer.
- updates
variable_dtype
Alias of Layer.dtype, the dtype of the weights.
variables
Returns the list of all layer variables/weights.
weights
Returns the list of all layer variables/weights.
Methods
__call__
(*args, **kwargs)Wraps call, applying pre- and post-processing steps.
add_loss
(losses, **kwargs)Add loss tensor(s), potentially dependent on layer inputs.
add_metric
(value[, name])Adds metric tensor to the layer.
add_update
(updates)Add update op(s), potentially dependent on layer inputs.
add_variable
(*args, **kwargs)Deprecated, do NOT use! Alias for add_weight.
add_weight
([name, shape, dtype, ...])Adds a new variable to the layer.
build
(input_shape)Creates the variables of the layer (optional, for subclass implementers).
call
(positions)Calculate the OPD maps for the given positions.
compute_mask
(inputs[, mask])Computes an output mask tensor.
compute_output_shape
(input_shape)Computes the output shape of the layer.
compute_output_signature
(input_signature)Compute the output tensor signature of the layer based on the inputs.
count_params
()Count the total number of scalars composing the weights.
finalize_state
()Finalizes the layers state after updating layer weights.
from_config
(config)Creates a layer from its config.
get_config
()Returns the config of the layer.
get_input_at
(node_index)Retrieves the input tensor(s) of a layer at a given node.
get_input_mask_at
(node_index)Retrieves the input mask tensor(s) of a layer at a given node.
get_input_shape_at
(node_index)Retrieves the input shape(s) of a layer at a given node.
get_output_at
(node_index)Retrieves the output tensor(s) of a layer at a given node.
get_output_mask_at
(node_index)Retrieves the output mask tensor(s) of a layer at a given node.
get_output_shape_at
(node_index)Retrieves the output shape(s) of a layer at a given node.
get_weights
()Returns the current weights of the layer, as NumPy arrays.
Initialize trainable variables.
predict
(positions)Prediction step.
Set alpha matrix to the identity.
Set alpha matrix to zero.
set_weights
(weights)Sets the weights of the layer, from NumPy arrays.
with_name_scope
(method)Decorator to automatically enter the module name scope.
- call(positions)[source]
Calculate the OPD maps for the given positions.
Calculating: batch(spatial_dict) x alpha x S
- Parameters:
positions (Tensor(batch, 2)) – First element is x-axis, second is y-axis.
- Returns:
opd_maps
- Return type:
Tensor(batch, opd_dim, opd_dim)
- class wf_psf.psf_models.tf_layers.TF_NP_poly_OPD(*args, **kwargs)[source]
Bases:
Layer
Non-parametric OPD generation with polynomial variations.
- Parameters:
- Attributes:
activity_regularizer
Optional regularizer function for the output of this layer.
compute_dtype
The dtype of the layer’s computations.
dtype
The dtype of the layer weights.
dtype_policy
The dtype policy associated with this layer.
dynamic
Whether the layer is dynamic (eager-only); set in the constructor.
inbound_nodes
Return Functional API nodes upstream of this layer.
input
Retrieves the input tensor(s) of a layer.
input_mask
Retrieves the input mask tensor(s) of a layer.
input_shape
Retrieves the input shape(s) of a layer.
input_spec
InputSpec instance(s) describing the input format for this layer.
losses
List of losses added using the add_loss() API.
metrics
List of metrics added using the add_metric() API.
name
Name of the layer (string), set in the constructor.
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.
non_trainable_weights
List of all non-trainable weights tracked by this layer.
outbound_nodes
Return Functional API nodes downstream of this layer.
output
Retrieves the output tensor(s) of a layer.
output_mask
Retrieves the output mask tensor(s) of a layer.
output_shape
Retrieves the output shape(s) of a layer.
- stateful
submodules
Sequence of all sub-modules.
supports_masking
Whether this layer supports computing a mask using compute_mask.
- trainable
trainable_variables
Sequence of trainable variables owned by this module and its submodules.
trainable_weights
List of all trainable weights tracked by this layer.
- updates
variable_dtype
Alias of Layer.dtype, the dtype of the weights.
variables
Returns the list of all layer variables/weights.
weights
Returns the list of all layer variables/weights.
Methods
__call__
(*args, **kwargs)Wraps call, applying pre- and post-processing steps.
add_loss
(losses, **kwargs)Add loss tensor(s), potentially dependent on layer inputs.
add_metric
(value[, name])Adds metric tensor to the layer.
add_update
(updates)Add update op(s), potentially dependent on layer inputs.
add_variable
(*args, **kwargs)Deprecated, do NOT use! Alias for add_weight.
add_weight
([name, shape, dtype, ...])Adds a new variable to the layer.
assign_S_mat
(S_mat)Assign DD features matrix.
build
(input_shape)Creates the variables of the layer (optional, for subclass implementers).
call
(positions)Calculate the OPD maps for the given positions.
compute_mask
(inputs[, mask])Computes an output mask tensor.
compute_output_shape
(input_shape)Computes the output shape of the layer.
compute_output_signature
(input_signature)Compute the output tensor signature of the layer based on the inputs.
count_params
()Count the total number of scalars composing the weights.
finalize_state
()Finalizes the layers state after updating layer weights.
from_config
(config)Creates a layer from its config.
get_config
()Returns the config of the layer.
get_input_at
(node_index)Retrieves the input tensor(s) of a layer at a given node.
get_input_mask_at
(node_index)Retrieves the input mask tensor(s) of a layer at a given node.
get_input_shape_at
(node_index)Retrieves the input shape(s) of a layer at a given node.
get_output_at
(node_index)Retrieves the output tensor(s) of a layer at a given node.
get_output_mask_at
(node_index)Retrieves the output mask tensor(s) of a layer at a given node.
get_output_shape_at
(node_index)Retrieves the output shape(s) of a layer at a given node.
get_weights
()Returns the current weights of the layer, as NumPy arrays.
Initialize trainable variables.
Set alpha matrix to the identity.
Set alpha matrix to zero.
set_weights
(weights)Sets the weights of the layer, from NumPy arrays.
with_name_scope
(method)Decorator to automatically enter the module name scope.
- call(positions)[source]
Calculate the OPD maps for the given positions.
Calculating: Pi(pos) x alpha x S
- Parameters:
positions (Tensor(batch, 2)) – First element is x-axis, second is y-axis.
- Returns:
opd_maps
- Return type:
Tensor(batch, opd_dim, opd_dim)
- class wf_psf.psf_models.tf_layers.TF_batch_mono_PSF(*args, **kwargs)[source]
Bases:
Layer
Calculate a monochromatic PSF from a batch of OPDs.
The calculation of the
phase_N
variable is done with the SimPSFToolkit class but outside the TF class.- Parameters:
obscurations (Tensor [opd_dim, opd_dim]) – Obscurations to apply to the wavefront.
psf_batch (Tensor [batch_size, output_dim, output_dim]) – Tensor containing the psfs that will be updated each time a calculation is required. Can be started with zeros.
output_Q (int) – Output oversampling value.
output_dim (int) – Output PSF stamp dimension.
- Attributes:
activity_regularizer
Optional regularizer function for the output of this layer.
compute_dtype
The dtype of the layer’s computations.
dtype
The dtype of the layer weights.
dtype_policy
The dtype policy associated with this layer.
dynamic
Whether the layer is dynamic (eager-only); set in the constructor.
inbound_nodes
Return Functional API nodes upstream of this layer.
input
Retrieves the input tensor(s) of a layer.
input_mask
Retrieves the input mask tensor(s) of a layer.
input_shape
Retrieves the input shape(s) of a layer.
input_spec
InputSpec instance(s) describing the input format for this layer.
losses
List of losses added using the add_loss() API.
metrics
List of metrics added using the add_metric() API.
name
Name of the layer (string), set in the constructor.
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.
non_trainable_weights
List of all non-trainable weights tracked by this layer.
outbound_nodes
Return Functional API nodes downstream of this layer.
output
Retrieves the output tensor(s) of a layer.
output_mask
Retrieves the output mask tensor(s) of a layer.
output_shape
Retrieves the output shape(s) of a layer.
- stateful
submodules
Sequence of all sub-modules.
supports_masking
Whether this layer supports computing a mask using compute_mask.
- trainable
trainable_variables
Sequence of trainable variables owned by this module and its submodules.
trainable_weights
List of all trainable weights tracked by this layer.
- updates
variable_dtype
Alias of Layer.dtype, the dtype of the weights.
variables
Returns the list of all layer variables/weights.
weights
Returns the list of all layer variables/weights.
Methods
__call__
(*args, **kwargs)Wraps call, applying pre- and post-processing steps.
add_loss
(losses, **kwargs)Add loss tensor(s), potentially dependent on layer inputs.
add_metric
(value[, name])Adds metric tensor to the layer.
add_update
(updates)Add update op(s), potentially dependent on layer inputs.
add_variable
(*args, **kwargs)Deprecated, do NOT use! Alias for add_weight.
add_weight
([name, shape, dtype, ...])Adds a new variable to the layer.
build
(input_shape)Creates the variables of the layer (optional, for subclass implementers).
calculate_mono_PSF
(current_opd)Calculate monochromatic PSF from OPD info.
call
(opd_batch)Calculate the batch poly PSFs.
compute_mask
(inputs[, mask])Computes an output mask tensor.
compute_output_shape
(input_shape)Computes the output shape of the layer.
compute_output_signature
(input_signature)Compute the output tensor signature of the layer based on the inputs.
count_params
()Count the total number of scalars composing the weights.
finalize_state
()Finalizes the layers state after updating layer weights.
from_config
(config)Creates a layer from its config.
get_config
()Returns the config of the layer.
get_input_at
(node_index)Retrieves the input tensor(s) of a layer at a given node.
get_input_mask_at
(node_index)Retrieves the input mask tensor(s) of a layer at a given node.
get_input_shape_at
(node_index)Retrieves the input shape(s) of a layer at a given node.
get_output_at
(node_index)Retrieves the output tensor(s) of a layer at a given node.
get_output_mask_at
(node_index)Retrieves the output mask tensor(s) of a layer at a given node.
get_output_shape_at
(node_index)Retrieves the output shape(s) of a layer at a given node.
get_weights
()Returns the current weights of the layer, as NumPy arrays.
Initialise or restart the PSF generator.
set_lambda_phaseN
([phase_N, lambda_obs])Set the lambda value for monochromatic PSFs and the phaseN.
set_output_params
(output_Q, output_dim)Set output patams, Q and dimension.
set_weights
(weights)Sets the weights of the layer, from NumPy arrays.
with_name_scope
(method)Decorator to automatically enter the module name scope.
- class wf_psf.psf_models.tf_layers.TF_batch_poly_PSF(*args, **kwargs)[source]
Bases:
Layer
Calculate a polychromatic PSF from an OPD and stored SED values.
The calculation of the packed values with the respective SED is done with the SimPSFToolkit class but outside the TF class.
- Parameters:
obscurations (Tensor [opd_dim, opd_dim]) – Obscurations to apply to the wavefront.
packed_SED_data (Tensor [batch_size, 3, n_bins_lda]) –
Comes from: tf.convert_to_tensor(list(list(Tensor,Tensor,Tensor))) Where each inner list consist of a packed_elem:
packed_elems: Tuple of tensors Contains three 1D tensors with the parameters needed for the calculation of one monochromatic PSF.
packed_elems[0]: phase_N packed_elems[1]: lambda_obs packed_elems[2]: SED_norm_val
The SED data is constant in a FoV.
psf_batch (Tensor [batch_size, output_dim, output_dim]) – Tensor containing the psfs that will be updated each time a calculation is required. REMOVED!
- Attributes:
activity_regularizer
Optional regularizer function for the output of this layer.
compute_dtype
The dtype of the layer’s computations.
dtype
The dtype of the layer weights.
dtype_policy
The dtype policy associated with this layer.
dynamic
Whether the layer is dynamic (eager-only); set in the constructor.
inbound_nodes
Return Functional API nodes upstream of this layer.
input
Retrieves the input tensor(s) of a layer.
input_mask
Retrieves the input mask tensor(s) of a layer.
input_shape
Retrieves the input shape(s) of a layer.
input_spec
InputSpec instance(s) describing the input format for this layer.
losses
List of losses added using the add_loss() API.
metrics
List of metrics added using the add_metric() API.
name
Name of the layer (string), set in the constructor.
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.
non_trainable_weights
List of all non-trainable weights tracked by this layer.
outbound_nodes
Return Functional API nodes downstream of this layer.
output
Retrieves the output tensor(s) of a layer.
output_mask
Retrieves the output mask tensor(s) of a layer.
output_shape
Retrieves the output shape(s) of a layer.
- stateful
submodules
Sequence of all sub-modules.
supports_masking
Whether this layer supports computing a mask using compute_mask.
- trainable
trainable_variables
Sequence of trainable variables owned by this module and its submodules.
trainable_weights
List of all trainable weights tracked by this layer.
- updates
variable_dtype
Alias of Layer.dtype, the dtype of the weights.
variables
Returns the list of all layer variables/weights.
weights
Returns the list of all layer variables/weights.
Methods
__call__
(*args, **kwargs)Wraps call, applying pre- and post-processing steps.
add_loss
(losses, **kwargs)Add loss tensor(s), potentially dependent on layer inputs.
add_metric
(value[, name])Adds metric tensor to the layer.
add_update
(updates)Add update op(s), potentially dependent on layer inputs.
add_variable
(*args, **kwargs)Deprecated, do NOT use! Alias for add_weight.
add_weight
([name, shape, dtype, ...])Adds a new variable to the layer.
build
(input_shape)Creates the variables of the layer (optional, for subclass implementers).
calculate_mono_PSF
(packed_elems)Calculate monochromatic PSF from packed elements.
calculate_poly_PSF
(packed_elems)Calculate a polychromatic PSF.
call
(inputs)Calculate the batch poly PSFs.
compute_mask
(inputs[, mask])Computes an output mask tensor.
compute_output_shape
(input_shape)Computes the output shape of the layer.
compute_output_signature
(input_signature)Compute the output tensor signature of the layer based on the inputs.
count_params
()Count the total number of scalars composing the weights.
finalize_state
()Finalizes the layers state after updating layer weights.
from_config
(config)Creates a layer from its config.
get_config
()Returns the config of the layer.
get_input_at
(node_index)Retrieves the input tensor(s) of a layer at a given node.
get_input_mask_at
(node_index)Retrieves the input mask tensor(s) of a layer at a given node.
get_input_shape_at
(node_index)Retrieves the input shape(s) of a layer at a given node.
get_output_at
(node_index)Retrieves the output tensor(s) of a layer at a given node.
get_output_mask_at
(node_index)Retrieves the output mask tensor(s) of a layer at a given node.
get_output_shape_at
(node_index)Retrieves the output shape(s) of a layer at a given node.
get_weights
()Returns the current weights of the layer, as NumPy arrays.
set_weights
(weights)Sets the weights of the layer, from NumPy arrays.
with_name_scope
(method)Decorator to automatically enter the module name scope.
- class wf_psf.psf_models.tf_layers.TF_physical_layer(*args, **kwargs)[source]
Bases:
Layer
Store and calculate the zernike coefficients for a given position.
This layer gives the Zernike contribution of the physical layer. It is fixed and not trainable.
- Parameters:
obs_pos (Tensor (n_stars, 2)) – Observed positions of the n_stars in the dataset. The indexing of the positions has to correspond to the indexing in the zks_prior.
n_zernikes (int) – Number of Zernike polynomials
zks_prior (Tensor (n_stars, n_zernikes)) – Zernike coefficients for each position
interpolation_type (str) – Type of interpolation to be used. Options are: ‘none’, ‘all’, ‘top_K’, ‘independent_Zk’. Default is ‘none’.
interpolation_args (dict) – Interpolation hyper-parameters. The order of the RBF interpolation, and the K elements in the top_K interpolation.
- Attributes:
activity_regularizer
Optional regularizer function for the output of this layer.
compute_dtype
The dtype of the layer’s computations.
dtype
The dtype of the layer weights.
dtype_policy
The dtype policy associated with this layer.
dynamic
Whether the layer is dynamic (eager-only); set in the constructor.
inbound_nodes
Return Functional API nodes upstream of this layer.
input
Retrieves the input tensor(s) of a layer.
input_mask
Retrieves the input mask tensor(s) of a layer.
input_shape
Retrieves the input shape(s) of a layer.
input_spec
InputSpec instance(s) describing the input format for this layer.
losses
List of losses added using the add_loss() API.
metrics
List of metrics added using the add_metric() API.
name
Name of the layer (string), set in the constructor.
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.
non_trainable_weights
List of all non-trainable weights tracked by this layer.
outbound_nodes
Return Functional API nodes downstream of this layer.
output
Retrieves the output tensor(s) of a layer.
output_mask
Retrieves the output mask tensor(s) of a layer.
output_shape
Retrieves the output shape(s) of a layer.
- stateful
submodules
Sequence of all sub-modules.
supports_masking
Whether this layer supports computing a mask using compute_mask.
- trainable
trainable_variables
Sequence of trainable variables owned by this module and its submodules.
trainable_weights
List of all trainable weights tracked by this layer.
- updates
variable_dtype
Alias of Layer.dtype, the dtype of the weights.
variables
Returns the list of all layer variables/weights.
weights
Returns the list of all layer variables/weights.
Methods
__call__
(*args, **kwargs)Wraps call, applying pre- and post-processing steps.
add_loss
(losses, **kwargs)Add loss tensor(s), potentially dependent on layer inputs.
add_metric
(value[, name])Adds metric tensor to the layer.
add_update
(updates)Add update op(s), potentially dependent on layer inputs.
add_variable
(*args, **kwargs)Deprecated, do NOT use! Alias for add_weight.
add_weight
([name, shape, dtype, ...])Adds a new variable to the layer.
build
(input_shape)Creates the variables of the layer (optional, for subclass implementers).
call
(positions)Calculate the prior zernike coefficients for a given position.
compute_mask
(inputs[, mask])Computes an output mask tensor.
compute_output_shape
(input_shape)Computes the output shape of the layer.
compute_output_signature
(input_signature)Compute the output tensor signature of the layer based on the inputs.
count_params
()Count the total number of scalars composing the weights.
finalize_state
()Finalizes the layers state after updating layer weights.
from_config
(config)Creates a layer from its config.
get_config
()Returns the config of the layer.
get_input_at
(node_index)Retrieves the input tensor(s) of a layer at a given node.
get_input_mask_at
(node_index)Retrieves the input mask tensor(s) of a layer at a given node.
get_input_shape_at
(node_index)Retrieves the input shape(s) of a layer at a given node.
get_output_at
(node_index)Retrieves the output tensor(s) of a layer at a given node.
get_output_mask_at
(node_index)Retrieves the output mask tensor(s) of a layer at a given node.
get_output_shape_at
(node_index)Retrieves the output shape(s) of a layer at a given node.
get_weights
()Returns the current weights of the layer, as NumPy arrays.
interpolate_all
(positions)Zernike interpolation
interpolate_independent_Zk
(positions)Zernike interpolation
interpolate_top_K
(positions)Zernike interpolation
set_weights
(weights)Sets the weights of the layer, from NumPy arrays.
with_name_scope
(method)Decorator to automatically enter the module name scope.
- call(positions)[source]
Calculate the prior zernike coefficients for a given position.
The position polynomial matrix and the coefficients should be set before calling this function.
- Parameters:
positions (Tensor(batch, 2)) – First element is x-axis, second is y-axis.
- Returns:
zernikes_coeffs
- Return type:
Tensor(batch, n_zernikes, 1, 1)
- interpolate_all(positions)[source]
Zernike interpolation
Right now all the input elements are used to build the RBF interpolant that is going to be used for the interpolation.
- class wf_psf.psf_models.tf_layers.TF_poly_Z_field(*args, **kwargs)[source]
Bases:
Layer
Calculate the zernike coefficients for a given position.
This module implements a polynomial model of Zernike coefficient variation.
- Parameters:
- Attributes:
activity_regularizer
Optional regularizer function for the output of this layer.
compute_dtype
The dtype of the layer’s computations.
dtype
The dtype of the layer weights.
dtype_policy
The dtype policy associated with this layer.
dynamic
Whether the layer is dynamic (eager-only); set in the constructor.
inbound_nodes
Return Functional API nodes upstream of this layer.
input
Retrieves the input tensor(s) of a layer.
input_mask
Retrieves the input mask tensor(s) of a layer.
input_shape
Retrieves the input shape(s) of a layer.
input_spec
InputSpec instance(s) describing the input format for this layer.
losses
List of losses added using the add_loss() API.
metrics
List of metrics added using the add_metric() API.
name
Name of the layer (string), set in the constructor.
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.
non_trainable_weights
List of all non-trainable weights tracked by this layer.
outbound_nodes
Return Functional API nodes downstream of this layer.
output
Retrieves the output tensor(s) of a layer.
output_mask
Retrieves the output mask tensor(s) of a layer.
output_shape
Retrieves the output shape(s) of a layer.
- stateful
submodules
Sequence of all sub-modules.
supports_masking
Whether this layer supports computing a mask using compute_mask.
- trainable
trainable_variables
Sequence of trainable variables owned by this module and its submodules.
trainable_weights
List of all trainable weights tracked by this layer.
- updates
variable_dtype
Alias of Layer.dtype, the dtype of the weights.
variables
Returns the list of all layer variables/weights.
weights
Returns the list of all layer variables/weights.
Methods
__call__
(*args, **kwargs)Wraps call, applying pre- and post-processing steps.
add_loss
(losses, **kwargs)Add loss tensor(s), potentially dependent on layer inputs.
add_metric
(value[, name])Adds metric tensor to the layer.
add_update
(updates)Add update op(s), potentially dependent on layer inputs.
add_variable
(*args, **kwargs)Deprecated, do NOT use! Alias for add_weight.
add_weight
([name, shape, dtype, ...])Adds a new variable to the layer.
assign_coeff_matrix
(coeff_mat)Assign coefficient matrix.
build
(input_shape)Creates the variables of the layer (optional, for subclass implementers).
call
(positions)Calculate the zernike coefficients for a given position.
compute_mask
(inputs[, mask])Computes an output mask tensor.
compute_output_shape
(input_shape)Computes the output shape of the layer.
compute_output_signature
(input_signature)Compute the output tensor signature of the layer based on the inputs.
count_params
()Count the total number of scalars composing the weights.
finalize_state
()Finalizes the layers state after updating layer weights.
from_config
(config)Creates a layer from its config.
Get coefficient matrix.
get_config
()Returns the config of the layer.
get_input_at
(node_index)Retrieves the input tensor(s) of a layer at a given node.
get_input_mask_at
(node_index)Retrieves the input mask tensor(s) of a layer at a given node.
get_input_shape_at
(node_index)Retrieves the input shape(s) of a layer at a given node.
get_output_at
(node_index)Retrieves the output tensor(s) of a layer at a given node.
get_output_mask_at
(node_index)Retrieves the output mask tensor(s) of a layer at a given node.
get_output_shape_at
(node_index)Retrieves the output shape(s) of a layer at a given node.
Return the shape of the coefficient matrix.
get_weights
()Returns the current weights of the layer, as NumPy arrays.
Initialize coefficient matrix.
set_weights
(weights)Sets the weights of the layer, from NumPy arrays.
with_name_scope
(method)Decorator to automatically enter the module name scope.
- call(positions)[source]
Calculate the zernike coefficients for a given position.
The position polynomial matrix and the coefficients should be set before calling this function.
- Parameters:
positions (Tensor(batch, 2)) – First element is x-axis, second is y-axis.
- Returns:
zernikes_coeffs
- Return type:
Tensor(batch, n_zernikes, 1, 1)
- class wf_psf.psf_models.tf_layers.TF_zernike_OPD(*args, **kwargs)[source]
Bases:
Layer
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 (batch_size, n_zernikes, 1, 1)) –
- Returns:
opd
- Return type:
Tensor (batch_size, x_dim, y_dim)
- Attributes:
activity_regularizer
Optional regularizer function for the output of this layer.
compute_dtype
The dtype of the layer’s computations.
dtype
The dtype of the layer weights.
dtype_policy
The dtype policy associated with this layer.
dynamic
Whether the layer is dynamic (eager-only); set in the constructor.
inbound_nodes
Return Functional API nodes upstream of this layer.
input
Retrieves the input tensor(s) of a layer.
input_mask
Retrieves the input mask tensor(s) of a layer.
input_shape
Retrieves the input shape(s) of a layer.
input_spec
InputSpec instance(s) describing the input format for this layer.
losses
List of losses added using the add_loss() API.
metrics
List of metrics added using the add_metric() API.
name
Name of the layer (string), set in the constructor.
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.
non_trainable_weights
List of all non-trainable weights tracked by this layer.
outbound_nodes
Return Functional API nodes downstream of this layer.
output
Retrieves the output tensor(s) of a layer.
output_mask
Retrieves the output mask tensor(s) of a layer.
output_shape
Retrieves the output shape(s) of a layer.
- stateful
submodules
Sequence of all sub-modules.
supports_masking
Whether this layer supports computing a mask using compute_mask.
- trainable
trainable_variables
Sequence of trainable variables owned by this module and its submodules.
trainable_weights
List of all trainable weights tracked by this layer.
- updates
variable_dtype
Alias of Layer.dtype, the dtype of the weights.
variables
Returns the list of all layer variables/weights.
weights
Returns the list of all layer variables/weights.
Methods
__call__
(*args, **kwargs)Wraps call, applying pre- and post-processing steps.
add_loss
(losses, **kwargs)Add loss tensor(s), potentially dependent on layer inputs.
add_metric
(value[, name])Adds metric tensor to the layer.
add_update
(updates)Add update op(s), potentially dependent on layer inputs.
add_variable
(*args, **kwargs)Deprecated, do NOT use! Alias for add_weight.
add_weight
([name, shape, dtype, ...])Adds a new variable to the layer.
build
(input_shape)Creates the variables of the layer (optional, for subclass implementers).
call
(z_coeffs)Perform the weighted sum of Zernikes coeffs and maps.
compute_mask
(inputs[, mask])Computes an output mask tensor.
compute_output_shape
(input_shape)Computes the output shape of the layer.
compute_output_signature
(input_signature)Compute the output tensor signature of the layer based on the inputs.
count_params
()Count the total number of scalars composing the weights.
finalize_state
()Finalizes the layers state after updating layer weights.
from_config
(config)Creates a layer from its config.
get_config
()Returns the config of the layer.
get_input_at
(node_index)Retrieves the input tensor(s) of a layer at a given node.
get_input_mask_at
(node_index)Retrieves the input mask tensor(s) of a layer at a given node.
get_input_shape_at
(node_index)Retrieves the input shape(s) of a layer at a given node.
get_output_at
(node_index)Retrieves the output tensor(s) of a layer at a given node.
get_output_mask_at
(node_index)Retrieves the output mask tensor(s) of a layer at a given node.
get_output_shape_at
(node_index)Retrieves the output shape(s) of a layer at a given node.
get_weights
()Returns the current weights of the layer, as NumPy arrays.
set_weights
(weights)Sets the weights of the layer, from NumPy arrays.
with_name_scope
(method)Decorator to automatically enter the module name scope.