Skip to content

Commit

Permalink
Merge pull request #128 from CosmoStat/rename-PSFSimulator
Browse files Browse the repository at this point in the history
Rename SimPSFToolkit.py module
  • Loading branch information
jeipollack authored Mar 18, 2024
2 parents 3eefc04 + ee9fbaf commit d18eb73
Show file tree
Hide file tree
Showing 17 changed files with 34 additions and 35 deletions.
4 changes: 2 additions & 2 deletions docs/source/wf_psf.sims.SimPSFToolkit.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
wf\_psf.sims.SimPSFToolkit module
wf\_psf.sims.psf_simulator module
=================================

.. automodule:: wf_psf.sims.SimPSFToolkit
.. automodule:: wf_psf.sims.psf_simulator
:members:
:undoc-members:
:show-inheritance:
2 changes: 1 addition & 1 deletion docs/source/wf_psf.sims.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ Submodules
.. toctree::
:maxdepth: 4

wf_psf.sims.SimPSFToolkit
wf_psf.sims.psf_simulator

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions src/wf_psf/data/training_preprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import wf_psf.utils.utils as utils
import tensorflow as tf
import tensorflow_addons as tfa
import wf_psf.sims.SimPSFToolkit as SimPSFToolkit
import os


Expand All @@ -24,7 +23,7 @@ class TrainingDataHandler:
training_data_params: Recursive Namespace object
Recursive Namespace object containing training data parameters
simPSF: object
SimPSFToolkit instance
PSFSimulator instance
n_bins_lambda: int
Number of bins in wavelength
Expand Down Expand Up @@ -66,7 +65,7 @@ class TestDataHandler:
test_data_params: Recursive Namespace object
Recursive Namespace object containing test data parameters
simPSF: object
SimPSFToolkit instance
PSFSimulator instance
n_bins_lambda: int
Number of bins in wavelength
Expand Down
4 changes: 2 additions & 2 deletions src/wf_psf/metrics/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import wf_psf.utils.utils as utils
from wf_psf.psf_models.tf_psf_field import build_PSF_model
from wf_psf.psf_models import tf_psf_field as psf_field
from wf_psf.sims import SimPSFToolkit as SimPSFToolkit
from wf_psf.sims import psf_simulator as psf_simulator
import logging

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -640,7 +640,7 @@ def gen_GT_wf_model(test_wf_file_path, pred_output_Q=1, pred_output_dim=64):

## Generate initializations
# Prepare np input
simPSF_np = SimPSFToolkit(
simPSF_np = psf_simulator.PSFSimulator(
zernikes,
max_order=wf_test_params["max_order"],
pupil_diameter=wf_test_params["pupil_diameter"],
Expand Down
8 changes: 4 additions & 4 deletions src/wf_psf/metrics/metrics_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def evaluate_metrics_polychromatic_lowres(self, psf_model, simPSF, dataset):
psf_model: object
PSF model class instance of the psf model selected for metrics evaluation.
simPSF: object
SimPSFToolkit instance
PSFSimulator instance
test_dataset: dict
Test dataset dictionary
Expand Down Expand Up @@ -111,7 +111,7 @@ def evaluate_metrics_mono_rmse(self, psf_model, simPSF, dataset):
psf_model: object
PSF model class instance of the psf model selected for metrics evaluation.
simPSF: object
SimPSFToolkit instance
PSFSimulator instance
test_dataset: dict
Test dataset dictionary
Expand Down Expand Up @@ -157,7 +157,7 @@ def evaluate_metrics_opd(self, psf_model, simPSF, dataset):
psf_model: object
PSF model class instance of the psf model selected for metrics evaluation.
simPSF: object
SimPSFToolkit instance
PSFSimulator instance
test_dataset: dict
Test dataset dictionary
Expand Down Expand Up @@ -201,7 +201,7 @@ def evaluate_metrics_shape(self, psf_model, simPSF, dataset):
psf_model: object
PSF model class instance of the psf model selected for metrics evaluation.
simPSF: object
SimPSFToolkit instance
PSFSimulator instance
dataset: dict
Test dataset dictionary
Expand Down
2 changes: 1 addition & 1 deletion src/wf_psf/psf_models/psf_model_parametric.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def predict_mono_psfs(self, input_positions, lambda_obs, phase_N):
phase_N: int
Required wavefront dimension. Should be calculated with as:
``simPSF_np = wf.SimPSFToolkit(...)``
``simPSF_np = wf_psf.sims.psf_simulator.PSFSimulator(...)``
``phase_N = simPSF_np.feasible_N(lambda_obs)``
"""

Expand Down
2 changes: 1 addition & 1 deletion src/wf_psf/psf_models/psf_model_semiparametric.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def predict_mono_psfs(self, input_positions, lambda_obs, phase_N):
phase_N: int
Required wavefront dimension. Should be calculated with as:
``simPSF_np = wf.SimPSFToolkit(...)``
``simPSF_np = wf_psf.sims.psf_simulator.PSFSimulator(...)``
``phase_N = simPSF_np.feasible_N(lambda_obs)``
"""
Expand Down
6 changes: 3 additions & 3 deletions src/wf_psf/psf_models/psf_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import tensorflow as tf
from tensorflow.python.keras.engine import data_adapter
from wf_psf.utils.utils import PI_zernikes, zernike_generator
from wf_psf.sims.SimPSFToolkit import SimPSFToolkit
from wf_psf.sims.psf_simulator import PSFSimulator
import glob
from sys import exit
import logging
Expand Down Expand Up @@ -186,7 +186,7 @@ def tf_obscurations(pupil_diam, N_filter=2):
TensorFlow EagerTensor type
"""
obscurations = SimPSFToolkit.generate_pupil_obscurations(
obscurations = PSFSimulator.generate_pupil_obscurations(
N_pix=pupil_diam, N_filter=N_filter
)
return tf.convert_to_tensor(obscurations, dtype=tf.complex64)
Expand All @@ -208,7 +208,7 @@ def simPSF(model_params):
"""

simPSF_np = SimPSFToolkit(
simPSF_np = PSFSimulator(
max_order=model_params.param_hparams.n_zernikes,
pupil_diameter=model_params.pupil_diameter,
output_dim=model_params.output_dim,
Expand Down
6 changes: 3 additions & 3 deletions src/wf_psf/psf_models/tf_layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class TF_batch_poly_PSF(tf.keras.layers.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.
with the PSFSimulator class but outside the TF class.
Parameters
----------
Expand Down Expand Up @@ -238,7 +238,7 @@ class TF_batch_mono_PSF(tf.keras.layers.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.
with the PSFSimulator class but outside the TF class.
Parameters
----------
Expand Down Expand Up @@ -945,7 +945,7 @@ class OLD_TF_batch_poly_PSF(tf.keras.layers.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.
with the PSFSimulator class but outside the TF class.
Expand Down
2 changes: 1 addition & 1 deletion src/wf_psf/psf_models/tf_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def __call__(self, opd):
# """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.
# with the PSFSimulator class but outside the TF class.

# packed_elems: Tuple of tensors
# Contains three 1D tensors with the parameters needed for
Expand Down
8 changes: 4 additions & 4 deletions src/wf_psf/psf_models/tf_psf_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def predict_mono_psfs(self, input_positions, lambda_obs, phase_N):
phase_N: int
Required wavefront dimension. Should be calculated with as:
``simPSF_np = wf.SimPSFToolkit(...)``
``simPSF_np = wf_psf.sims.psf_simulator.PSFSimulator(...)``
``phase_N = simPSF_np.feasible_N(lambda_obs)``
"""

Expand Down Expand Up @@ -391,7 +391,7 @@ def predict_mono_psfs(self, input_positions, lambda_obs, phase_N):
phase_N: int
Required wavefront dimension. Should be calculated with as:
``simPSF_np = wf.SimPSFToolkit(...)``
``simPSF_np =wf_psf.sims.psf_simulator.PSFSimulator(...)``
``phase_N = simPSF_np.feasible_N(lambda_obs)``
"""

Expand Down Expand Up @@ -821,7 +821,7 @@ def predict_mono_psfs(self, input_positions, lambda_obs, phase_N):
Observed wavelength in um.
phase_N: int
Required wavefront dimension. Should be calculated with as:
``simPSF_np = wf.SimPSFToolkit(...)``
``simPSF_np = wf_psf.sims.psf_simulator.PSFSimulator(...)``
``phase_N = simPSF_np.feasible_N(lambda_obs)``
"""
Expand Down Expand Up @@ -1103,7 +1103,7 @@ def predict_mono_psfs(self, input_positions, lambda_obs, phase_N):
Observed wavelength in um.
phase_N: int
Required wavefront dimension. Should be calculated with as:
``simPSF_np = wf.SimPSFToolkit(...)``
``simPSF_np = wf_psf.sims.psf_simulator.PSFSimulator(...)``
``phase_N = simPSF_np.feasible_N(lambda_obs)``
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
print("Problem importing skimage..")


class SimPSFToolkit(object):
class PSFSimulator(object):
"""Simulate PSFs.
In the future the zernike maps could be created with galsim or some other
Expand Down
4 changes: 2 additions & 2 deletions src/wf_psf/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def generate_SED_elems(SED, sim_psf_toolkit, n_bins=20):
----------
SED:
sim_psf_toolkit:
An instance of the SimPSFToolkit class with the correct
An instance of the PSFSimulator class with the correct
initialization values.
n_bins: int
Number of wavelength bins
Expand All @@ -64,7 +64,7 @@ def generate_SED_elems_in_tensorflow(
----------
SED:
sim_psf_toolkit:
An instance of the SimPSFToolkit class with the correct
An instance of the PSFSimulator class with the correct
initialization values.
n_bins: int
Number of wavelength bins
Expand Down

0 comments on commit d18eb73

Please sign in to comment.