diff --git a/docs/source/wf_psf.sims.SimPSFToolkit.rst b/docs/source/wf_psf.sims.SimPSFToolkit.rst index b71254bc..176e9635 100644 --- a/docs/source/wf_psf.sims.SimPSFToolkit.rst +++ b/docs/source/wf_psf.sims.SimPSFToolkit.rst @@ -1,7 +1,7 @@ -wf\_psf.sims.SimPSFToolkit module +wf\_psf.sims.PSFSimulator module ================================= -.. automodule:: wf_psf.sims.SimPSFToolkit +.. automodule:: wf_psf.sims.PSFSimulator :members: :undoc-members: :show-inheritance: diff --git a/docs/source/wf_psf.sims.rst b/docs/source/wf_psf.sims.rst index 184d80bf..4fd22b24 100644 --- a/docs/source/wf_psf.sims.rst +++ b/docs/source/wf_psf.sims.rst @@ -12,4 +12,4 @@ Submodules .. toctree:: :maxdepth: 4 - wf_psf.sims.SimPSFToolkit + wf_psf.sims.PSFSimulator diff --git a/papers/Neurips2021_ML4Physics_workshop/notebooks/Neurips2021-ML4Physics_Reconstructions-chromatic-NASA.ipynb b/papers/Neurips2021_ML4Physics_workshop/notebooks/Neurips2021-ML4Physics_Reconstructions-chromatic-NASA.ipynb index a7909cb1..26762ef9 100644 --- a/papers/Neurips2021_ML4Physics_workshop/notebooks/Neurips2021-ML4Physics_Reconstructions-chromatic-NASA.ipynb +++ b/papers/Neurips2021_ML4Physics_workshop/notebooks/Neurips2021-ML4Physics_Reconstructions-chromatic-NASA.ipynb @@ -21,7 +21,7 @@ "\n", "import wf_psf as wf\n", "\n", - "import wf_psf.SimPSFToolkit as SimPSFToolkit\n", + "import wf_psf.PSFSimulator as PSFSimulator\n", "import wf_psf.utils as wf_utils\n", "import wf_psf.tf_psf_field as tf_psf_field\n", "\n", @@ -176,7 +176,7 @@ "tf_zernike_cube = tf.convert_to_tensor(np_zernike_cube, dtype=tf.float32)\n", "\n", "# Prepare np input\n", - "simPSF_np = SimPSFToolkit(\n", + "simPSF_np = PSFSimulator(\n", " zernikes,\n", " max_order=args['n_zernikes'],\n", " pupil_diameter=args['pupil_diameter'],\n", diff --git a/papers/Neurips2021_ML4Physics_workshop/notebooks/Neurips2021-ML4Physics_Reconstructions.ipynb b/papers/Neurips2021_ML4Physics_workshop/notebooks/Neurips2021-ML4Physics_Reconstructions.ipynb index 17062b69..22ba872c 100644 --- a/papers/Neurips2021_ML4Physics_workshop/notebooks/Neurips2021-ML4Physics_Reconstructions.ipynb +++ b/papers/Neurips2021_ML4Physics_workshop/notebooks/Neurips2021-ML4Physics_Reconstructions.ipynb @@ -21,7 +21,7 @@ "\n", "import wf_psf as wf\n", "\n", - "import wf_psf.SimPSFToolkit as SimPSFToolkit\n", + "import wf_psf.PSFSimulator as PSFSimulator\n", "import wf_psf.utils as wf_utils\n", "import wf_psf.tf_psf_field as tf_psf_field\n", "\n", @@ -176,7 +176,7 @@ "tf_zernike_cube = tf.convert_to_tensor(np_zernike_cube, dtype=tf.float32)\n", "\n", "# Prepare np input\n", - "simPSF_np = SimPSFToolkit(\n", + "simPSF_np = PSFSimulator(\n", " zernikes,\n", " max_order=args['n_zernikes'],\n", " pupil_diameter=args['pupil_diameter'],\n", diff --git a/papers/article_IOP/notebooks/DD-features-dataset-examples.ipynb b/papers/article_IOP/notebooks/DD-features-dataset-examples.ipynb index 7ff34903..96165d77 100644 --- a/papers/article_IOP/notebooks/DD-features-dataset-examples.ipynb +++ b/papers/article_IOP/notebooks/DD-features-dataset-examples.ipynb @@ -21,7 +21,7 @@ "\n", "import wf_psf as wf\n", "\n", - "import wf_psf.SimPSFToolkit as SimPSFToolkit\n", + "import wf_psf.PSFSimulator as PSFSimulator\n", "import wf_psf.utils as wf_utils\n", "import wf_psf.tf_psf_field as tf_psf_field\n", "\n", @@ -176,7 +176,7 @@ "tf_zernike_cube = tf.convert_to_tensor(np_zernike_cube, dtype=tf.float32)\n", "\n", "# Prepare np input\n", - "simPSF_np = SimPSFToolkit(\n", + "simPSF_np = PSFSimulator(\n", " zernikes,\n", " max_order=args['n_zernikes'],\n", " pupil_diameter=args['pupil_diameter'],\n", diff --git a/papers/article_IOP/notebooks/generate-coherent-dataset-scrip.ipynb b/papers/article_IOP/notebooks/generate-coherent-dataset-scrip.ipynb index a2e6145d..4c2affe0 100644 --- a/papers/article_IOP/notebooks/generate-coherent-dataset-scrip.ipynb +++ b/papers/article_IOP/notebooks/generate-coherent-dataset-scrip.ipynb @@ -80,7 +80,7 @@ "zernikes = wf_psf.utils.zernike_generator(n_zernikes=max_order, wfe_dim=pupil_diameter)\n", "\n", "# Initialize PSF simulator\n", - "sim_PSF_toolkit = wf_psf.SimPSFToolkit(\n", + "sim_PSF_toolkit = wf_psf.PSFSimulator(\n", " zernikes, max_order=max_order, max_wfe_rms=max_wfe_rms, oversampling_rate=oversampling_rate,\n", " output_Q=output_Q, output_dim=output_dim, pupil_diameter=pupil_diameter, euclid_obsc=euclid_obsc,\n", " LP_filter_length=LP_filter_length)\n", diff --git a/src/wf_psf/data/training_preprocessing.py b/src/wf_psf/data/training_preprocessing.py index 2002211f..f7132408 100644 --- a/src/wf_psf/data/training_preprocessing.py +++ b/src/wf_psf/data/training_preprocessing.py @@ -10,7 +10,7 @@ import wf_psf.utils.utils as utils import tensorflow as tf import tensorflow_addons as tfa -import wf_psf.sims.SimPSFToolkit as SimPSFToolkit +import wf_psf.sims.PSFSimulator as PSFSimulator import os @@ -24,7 +24,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 @@ -66,7 +66,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 diff --git a/src/wf_psf/metrics/metrics.py b/src/wf_psf/metrics/metrics.py index ed7fa58c..a5206235 100644 --- a/src/wf_psf/metrics/metrics.py +++ b/src/wf_psf/metrics/metrics.py @@ -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 PSFSimulator as PSFSimulator import logging logger = logging.getLogger(__name__) @@ -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 = PSFSimulator( zernikes, max_order=wf_test_params["max_order"], pupil_diameter=wf_test_params["pupil_diameter"], diff --git a/src/wf_psf/metrics/metrics_interface.py b/src/wf_psf/metrics/metrics_interface.py index 2249a38b..49b20a8a 100644 --- a/src/wf_psf/metrics/metrics_interface.py +++ b/src/wf_psf/metrics/metrics_interface.py @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/src/wf_psf/psf_models/psf_model_parametric.py b/src/wf_psf/psf_models/psf_model_parametric.py index 44fc75a7..40530d41 100644 --- a/src/wf_psf/psf_models/psf_model_parametric.py +++ b/src/wf_psf/psf_models/psf_model_parametric.py @@ -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.PSFSimulator(...)`` ``phase_N = simPSF_np.feasible_N(lambda_obs)`` """ diff --git a/src/wf_psf/psf_models/psf_model_semiparametric.py b/src/wf_psf/psf_models/psf_model_semiparametric.py index 3a250490..cbade603 100644 --- a/src/wf_psf/psf_models/psf_model_semiparametric.py +++ b/src/wf_psf/psf_models/psf_model_semiparametric.py @@ -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.PSFSimulator(...)`` ``phase_N = simPSF_np.feasible_N(lambda_obs)`` """ diff --git a/src/wf_psf/psf_models/psf_models.py b/src/wf_psf/psf_models/psf_models.py index bcfec0b4..7cdbb789 100644 --- a/src/wf_psf/psf_models/psf_models.py +++ b/src/wf_psf/psf_models/psf_models.py @@ -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.PSFSimulator import PSFSimulator import glob from sys import exit import logging @@ -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) @@ -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, diff --git a/src/wf_psf/psf_models/tf_layers.py b/src/wf_psf/psf_models/tf_layers.py index 619917f2..225edb33 100644 --- a/src/wf_psf/psf_models/tf_layers.py +++ b/src/wf_psf/psf_models/tf_layers.py @@ -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 ---------- @@ -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 ---------- @@ -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. diff --git a/src/wf_psf/psf_models/tf_modules.py b/src/wf_psf/psf_models/tf_modules.py index cc9a8bd2..2598fd13 100644 --- a/src/wf_psf/psf_models/tf_modules.py +++ b/src/wf_psf/psf_models/tf_modules.py @@ -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 diff --git a/src/wf_psf/psf_models/tf_psf_field.py b/src/wf_psf/psf_models/tf_psf_field.py index 1e95e584..65762bc3 100644 --- a/src/wf_psf/psf_models/tf_psf_field.py +++ b/src/wf_psf/psf_models/tf_psf_field.py @@ -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.PSFSimulator(...)`` ``phase_N = simPSF_np.feasible_N(lambda_obs)`` """ @@ -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.PSFSimulator(...)`` ``phase_N = simPSF_np.feasible_N(lambda_obs)`` """ @@ -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.PSFSimulator(...)`` ``phase_N = simPSF_np.feasible_N(lambda_obs)`` """ @@ -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.PSFSimulator(...)`` ``phase_N = simPSF_np.feasible_N(lambda_obs)`` """ diff --git a/src/wf_psf/utils/utils.py b/src/wf_psf/utils/utils.py index d2e3d426..dbb0328d 100644 --- a/src/wf_psf/utils/utils.py +++ b/src/wf_psf/utils/utils.py @@ -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 @@ -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