Demonstrates using deeplenstronomy
in an active learning framework
import deeplenstronomy.deeplenstronomy as dl
First we'll simulate a dataset for which we may want to update some of the parameters.
We'll use a very basic configuration file for this example:
config_file = 'data/demo.yaml'
! cat data/demo.yaml
DATASET: NAME: MyDeeplenstronomyDataset PARAMETERS: SIZE: 100 OUTDIR: MySimulationResults COSMOLOGY: PARAMETERS: H0: 70 Om0: 0.3 IMAGE: PARAMETERS: exposure_time: 90 numPix: 100 pixel_scale: 0.263 psf_type: 'GAUSSIAN' read_noise: 7 ccd_gain: 6.083 SURVEY: PARAMETERS: BANDS: g,r,i,z,Y seeing: 0.9 magnitude_zero_point: 30.0 sky_brightness: 23.5 num_exposures: 10 SPECIES: GALAXY_1: NAME: LENS LIGHT_PROFILE_1: NAME: SERSIC_ELLIPSE PARAMETERS: magnitude: 19.5 center_x: 0.0 center_y: 0.0 R_sersic: 10 n_sersic: 4 e1: 0.2 e2: -0.1 LIGHT_PROFILE_2: NAME: SERSIC_ELLIPSE PARAMETERS: magnitude: 18.0 center_x: 0.0 center_y: 0.0 R_sersic: 3 n_sersic: 8 e1: 0.05 e2: -0.05 MASS_PROFILE_1: NAME: SIE PARAMETERS: theta_E: 1.0 e1: 0.1 e2: -0.1 center_x: 0.0 center_y: 0.0 SHEAR_PROFILE_1: NAME: SHEAR PARAMETERS: gamma1: 0.08 gamma2: 0.01 GALAXY_2: NAME: SOURCE LIGHT_PROFILE_1: NAME: SERSIC_ELLIPSE PARAMETERS: magnitude: 21.5 center_x: 0.0 center_y: 0.0 R_sersic: 6 n_sersic: 5 e1: 0.2 e2: -0.1 SHEAR_PROFILE_1: NAME: SHEAR PARAMETERS: gamma1: 0.08 gamma2: 0.01 POINTSOURCE_1: NAME: AGN HOST: SOURCE PARAMETERS: magnitude: 16 POINTSOURCE_2: NAME: SUPERNOVA HOST: SOURCE PARAMETERS: magnitude: 21.0 sep: 2.0 sep_unit: arcsec POINTSOURCE_3: NAME: STAR HOST: Foreground PARAMETERS: magnitude: 14.0 NOISE_1: NAME: POISSON_NOISE PARAMETERS: mean: 2.0 GEOMETRY: CONFIGURATION_1: NAME: GALAXY_AGN FRACTION: 0.25 PLANE_1: OBJECT_1: LENS PARAMETERS: REDSHIFT: 0.2 PLANE_2: OBJECT_1: SOURCE OBJECT_2: AGN PARAMETERS: REDSHIFT: 0.7 NOISE_SOURCE_1: POISSON_NOISE CONFIGURATION_2: NAME: GALAXY_AGN_NOISELESS FRACTION: 0.25 PLANE_1: OBJECT_1: LENS PARAMETERS: REDSHIFT: 0.2 PLANE_2: OBJECT_1: SOURCE OBJECT_2: AGN PARAMETERS: REDSHIFT: 0.7 CONFIGURATION_3: NAME: LENSED_SNE FRACTION: 0.25 PLANE_1: OBJECT_1: LENS PARAMETERS: REDSHIFT: 0.2 PLANE_2: OBJECT_1: SOURCE OBJECT_2: SUPERNOVA PARAMETERS: REDSHIFT: 0.7 NOISE_SOURCE_1: POISSON_NOISE CONFIGURATION_4: NAME: SPICY_LIFE FRACTION: 0.25 PLANE_1: OBJECT_1: LENS OBJECT_2: STAR OBJECT_3: STAR PARAMETERS: REDSHIFT: 0.2 PLANE_2: OBJECT_1: LENS PARAMETERS: REDSHIFT: 0.7 PLANE_3: OBJECT_1: SOURCE OBJECT_2: SUPERNOVA OBJECT_3: AGN PARAMETERS: REDSHIFT: 1.3 NOISE_SOURCE_1: POISSON_NOISE
Great, now make the dataset.
dataset = dl.make_dataset(config_file, store_in_memory=False, store_sample=True)
As a reminder of what the make_dataset()
function does, let's look at the attributes of the dataset
object.
for x in dir(dataset):
if not x.startswith('_'): print(x)
CONFIGURATION_1_images CONFIGURATION_1_metadata CONFIGURATION_2_images CONFIGURATION_2_metadata CONFIGURATION_3_images CONFIGURATION_3_metadata CONFIGURATION_4_images CONFIGURATION_4_metadata arguments bands config_dict config_file configurations name outdir parser regenerate search seed size species_map update_param update_param_dist
We'll be spending a lot of time looking at update_param
, update_param_dist
, and regenerate
, but for now let's check out the actual image and it's metadata. The dataset size was 1 in the config file, so there will only be one image to look at.
from deeplenstronomy.visualize import view_image_rgb
view_image_rgb(dataset.CONFIGURATION_1_images[0], Q=10, stretch=10)
for col in dataset.CONFIGURATION_1_metadata.columns:
if col[-1] == 'g':
print(col[0:-2], ':', dataset.CONFIGURATION_1_metadata[col].values[0])
OBJID : 0 H0 : 70 Om0 : 0.3 exposure_time : 90 numPix : 100 pixel_scale : 0.263 psf_type : GAUSSIAN read_noise : 7 ccd_gain : 6.083 seeing : 0.9 magnitude_zero_point : 30.0 sky_brightness : 23.5 num_exposures : 10 NUMBER_OF_NOISE_SOURCES : 1 NOISE_SOURCE_1-NAME : POISSON_NOISE NOISE_SOURCE_1-mean : 2.0 CONFIGURATION_LABEL : CONFIGURATION_1 CONFIGURATION_NAME : GALAXY_AGN NUMBER_OF_PLANES : 2 PLANE_1-NUMBER_OF_OBJECTS : 1 PLANE_1-OBJECT_1-NAME : LENS PLANE_2-NUMBER_OF_OBJECTS : 2 PLANE_2-OBJECT_1-NAME : SOURCE PLANE_2-OBJECT_2-NAME : AGN PLANE_1-OBJECT_1-REDSHIFT : 0.2 PLANE_1-OBJECT_1-NUMBER_OF_LIGHT_PROFILES : 2 PLANE_1-OBJECT_1-NUMBER_OF_SHEAR_PROFILES : 1 PLANE_1-OBJECT_1-NUMBER_OF_MASS_PROFILES : 1 PLANE_1-OBJECT_1-HOST : None PLANE_1-OBJECT_1-LIGHT_PROFILE_1-NAME : SERSIC_ELLIPSE PLANE_1-OBJECT_1-LIGHT_PROFILE_1-magnitude : 19.5 PLANE_1-OBJECT_1-LIGHT_PROFILE_1-center_x : 0.0 PLANE_1-OBJECT_1-LIGHT_PROFILE_1-center_y : 0.0 PLANE_1-OBJECT_1-LIGHT_PROFILE_1-R_sersic : 10 PLANE_1-OBJECT_1-LIGHT_PROFILE_1-n_sersic : 4 PLANE_1-OBJECT_1-LIGHT_PROFILE_1-e1 : 0.2 PLANE_1-OBJECT_1-LIGHT_PROFILE_1-e2 : -0.1 PLANE_1-OBJECT_1-LIGHT_PROFILE_2-NAME : SERSIC_ELLIPSE PLANE_1-OBJECT_1-LIGHT_PROFILE_2-magnitude : 18.0 PLANE_1-OBJECT_1-LIGHT_PROFILE_2-center_x : 0.0 PLANE_1-OBJECT_1-LIGHT_PROFILE_2-center_y : 0.0 PLANE_1-OBJECT_1-LIGHT_PROFILE_2-R_sersic : 3 PLANE_1-OBJECT_1-LIGHT_PROFILE_2-n_sersic : 8 PLANE_1-OBJECT_1-LIGHT_PROFILE_2-e1 : 0.05 PLANE_1-OBJECT_1-LIGHT_PROFILE_2-e2 : -0.05 PLANE_1-OBJECT_1-MASS_PROFILE_1-NAME : SIE PLANE_1-OBJECT_1-MASS_PROFILE_1-theta_E : 1.0 PLANE_1-OBJECT_1-MASS_PROFILE_1-e1 : 0.1 PLANE_1-OBJECT_1-MASS_PROFILE_1-e2 : -0.1 PLANE_1-OBJECT_1-MASS_PROFILE_1-center_x : 0.0 PLANE_1-OBJECT_1-MASS_PROFILE_1-center_y : 0.0 PLANE_1-OBJECT_1-SHEAR_PROFILE_1-NAME : SHEAR PLANE_1-OBJECT_1-SHEAR_PROFILE_1-gamma1 : 0.08 PLANE_1-OBJECT_1-SHEAR_PROFILE_1-gamma2 : 0.01 PLANE_2-OBJECT_1-REDSHIFT : 0.7 PLANE_2-OBJECT_2-REDSHIFT : 0.7 PLANE_2-OBJECT_1-NUMBER_OF_LIGHT_PROFILES : 1 PLANE_2-OBJECT_1-NUMBER_OF_SHEAR_PROFILES : 1 PLANE_2-OBJECT_1-NUMBER_OF_MASS_PROFILES : 0 PLANE_2-OBJECT_1-HOST : None PLANE_2-OBJECT_1-LIGHT_PROFILE_1-NAME : SERSIC_ELLIPSE PLANE_2-OBJECT_1-LIGHT_PROFILE_1-magnitude : 21.5 PLANE_2-OBJECT_1-LIGHT_PROFILE_1-center_x : 0.0 PLANE_2-OBJECT_1-LIGHT_PROFILE_1-center_y : 0.0 PLANE_2-OBJECT_1-LIGHT_PROFILE_1-R_sersic : 6 PLANE_2-OBJECT_1-LIGHT_PROFILE_1-n_sersic : 5 PLANE_2-OBJECT_1-LIGHT_PROFILE_1-e1 : 0.2 PLANE_2-OBJECT_1-LIGHT_PROFILE_1-e2 : -0.1 PLANE_2-OBJECT_1-SHEAR_PROFILE_1-NAME : SHEAR PLANE_2-OBJECT_1-SHEAR_PROFILE_1-gamma1 : 0.08 PLANE_2-OBJECT_1-SHEAR_PROFILE_1-gamma2 : 0.01 PLANE_2-OBJECT_2-NUMBER_OF_LIGHT_PROFILES : 0 PLANE_2-OBJECT_2-NUMBER_OF_SHEAR_PROFILES : 0 PLANE_2-OBJECT_2-NUMBER_OF_MASS_PROFILES : 0 PLANE_2-OBJECT_2-HOST : SOURCE PLANE_2-OBJECT_2-ra : 0.0 PLANE_2-OBJECT_2-dec : 0.0 PLANE_2-OBJECT_2-sep : 0.0 PLANE_2-OBJECT_2-sep_unit : arcsec PLANE_2-OBJECT_2-magnitude : 16 BACKGROUND_IDX : 0 PLANE_1-REDSHIFT : nan PLANE_2-REDSHIFT : nan
Let's take a look at the update_param()
function to see how it works.
print(help(dataset.update_param))
Help on method update_param in module deeplenstronomy.deeplenstronomy: update_param(new_param_dict, configuration) method of deeplenstronomy.deeplenstronomy.Dataset instance Update single parameters to new values. Args: new_param_dict (dict): {'param_1_name': new_value_1, 'param_2_name': new_value_2, ...} configuration (str): like 'CONFIGURATION_1', 'CONFIGURATION_2', etc... None
So let's suppose we want to change num_exposures
to 3 and force the source galaxy to be 3 arc sec to the right. From the metadata columns in the above list, create a dictionary with the parameter and new value.
new_param_dict = {'num_exposures': 3, 'PLANE_2-OBJECT_1-LIGHT_PROFILE_1-center_x': 3.0}
And now just call the update function. You will always need to specify the configuration, so if you want to make the change for all configurations, just run the update function in a loop.
dataset.update_param(new_param_dict, 'CONFIGURATION_1')
To see if that worked, let's print out the dataset's config_dict
, which stores all the info about the dataset.
dataset.config_dict
{'DATASET': {'NAME': 'MyDeeplenstronomyDataset', 'PARAMETERS': {'SIZE': 100, 'OUTDIR': 'MySimulationResults'}}, 'COSMOLOGY': {'PARAMETERS': {'H0': 70, 'Om0': 0.3}}, 'IMAGE': {'PARAMETERS': {'exposure_time': 90, 'numPix': 100, 'pixel_scale': 0.263, 'psf_type': 'GAUSSIAN', 'read_noise': 7, 'ccd_gain': 6.083}}, 'SURVEY': {'PARAMETERS': {'BANDS': 'g,r,i,z,Y', 'seeing': 0.9, 'magnitude_zero_point': 30.0, 'sky_brightness': 23.5, 'num_exposures': 3}}, 'SPECIES': {'GALAXY_1': {'NAME': 'LENS', 'LIGHT_PROFILE_1': {'NAME': 'SERSIC_ELLIPSE', 'PARAMETERS': {'magnitude': 19.5, 'center_x': 0.0, 'center_y': 0.0, 'R_sersic': 10, 'n_sersic': 4, 'e1': 0.2, 'e2': -0.1}}, 'LIGHT_PROFILE_2': {'NAME': 'SERSIC_ELLIPSE', 'PARAMETERS': {'magnitude': 18.0, 'center_x': 0.0, 'center_y': 0.0, 'R_sersic': 3, 'n_sersic': 8, 'e1': 0.05, 'e2': -0.05}}, 'MASS_PROFILE_1': {'NAME': 'SIE', 'PARAMETERS': {'theta_E': 1.0, 'e1': 0.1, 'e2': -0.1, 'center_x': 0.0, 'center_y': 0.0}}, 'SHEAR_PROFILE_1': {'NAME': 'SHEAR', 'PARAMETERS': {'gamma1': 0.08, 'gamma2': 0.01}}}, 'GALAXY_2': {'NAME': 'SOURCE', 'LIGHT_PROFILE_1': {'NAME': 'SERSIC_ELLIPSE', 'PARAMETERS': {'magnitude': 21.5, 'center_x': 3.0, 'center_y': 0.0, 'R_sersic': 6, 'n_sersic': 5, 'e1': 0.2, 'e2': -0.1}}, 'SHEAR_PROFILE_1': {'NAME': 'SHEAR', 'PARAMETERS': {'gamma1': 0.08, 'gamma2': 0.01}}}, 'POINTSOURCE_1': {'NAME': 'AGN', 'HOST': 'SOURCE', 'PARAMETERS': {'magnitude': 16}}, 'POINTSOURCE_2': {'NAME': 'SUPERNOVA', 'HOST': 'SOURCE', 'PARAMETERS': {'magnitude': 21.0, 'sep': 2.0, 'sep_unit': 'arcsec'}}, 'POINTSOURCE_3': {'NAME': 'STAR', 'HOST': 'Foreground', 'PARAMETERS': {'magnitude': 14.0}}, 'NOISE_1': {'NAME': 'POISSON_NOISE', 'PARAMETERS': {'mean': 2.0}}}, 'GEOMETRY': {'CONFIGURATION_1': {'NAME': 'GALAXY_AGN', 'FRACTION': 0.25, 'PLANE_1': {'OBJECT_1': 'LENS', 'PARAMETERS': {'REDSHIFT': 0.2}}, 'PLANE_2': {'OBJECT_1': 'SOURCE', 'OBJECT_2': 'AGN', 'PARAMETERS': {'REDSHIFT': 0.7}}, 'NOISE_SOURCE_1': 'POISSON_NOISE', 'SIZE': 25, 'SIM_DICT': {'CONFIGURATION_LABEL': 'CONFIGURATION_1', 'CONFIGURATION_NAME': 'GALAXY_AGN', 'NUMBER_OF_PLANES': 2, 'PLANE_1-NUMBER_OF_OBJECTS': 1, 'PLANE_1-OBJECT_1-NAME': 'LENS', 'PLANE_2-NUMBER_OF_OBJECTS': 2, 'PLANE_2-OBJECT_1-NAME': 'SOURCE', 'PLANE_2-OBJECT_2-NAME': 'AGN', 'PLANE_1-REDSHIFT': 0.2, 'PLANE_2-REDSHIFT': 0.7}}, 'CONFIGURATION_2': {'NAME': 'GALAXY_AGN_NOISELESS', 'FRACTION': 0.25, 'PLANE_1': {'OBJECT_1': 'LENS', 'PARAMETERS': {'REDSHIFT': 0.2}}, 'PLANE_2': {'OBJECT_1': 'SOURCE', 'OBJECT_2': 'AGN', 'PARAMETERS': {'REDSHIFT': 0.7}}, 'SIZE': 25, 'SIM_DICT': {'CONFIGURATION_LABEL': 'CONFIGURATION_2', 'CONFIGURATION_NAME': 'GALAXY_AGN_NOISELESS', 'NUMBER_OF_PLANES': 2, 'PLANE_1-NUMBER_OF_OBJECTS': 1, 'PLANE_1-OBJECT_1-NAME': 'LENS', 'PLANE_2-NUMBER_OF_OBJECTS': 2, 'PLANE_2-OBJECT_1-NAME': 'SOURCE', 'PLANE_2-OBJECT_2-NAME': 'AGN', 'PLANE_1-REDSHIFT': 0.2, 'PLANE_2-REDSHIFT': 0.7}}, 'CONFIGURATION_3': {'NAME': 'LENSED_SNE', 'FRACTION': 0.25, 'PLANE_1': {'OBJECT_1': 'LENS', 'PARAMETERS': {'REDSHIFT': 0.2}}, 'PLANE_2': {'OBJECT_1': 'SOURCE', 'OBJECT_2': 'SUPERNOVA', 'PARAMETERS': {'REDSHIFT': 0.7}}, 'NOISE_SOURCE_1': 'POISSON_NOISE', 'SIZE': 25, 'SIM_DICT': {'CONFIGURATION_LABEL': 'CONFIGURATION_3', 'CONFIGURATION_NAME': 'LENSED_SNE', 'NUMBER_OF_PLANES': 2, 'PLANE_1-NUMBER_OF_OBJECTS': 1, 'PLANE_1-OBJECT_1-NAME': 'LENS', 'PLANE_2-NUMBER_OF_OBJECTS': 2, 'PLANE_2-OBJECT_1-NAME': 'SOURCE', 'PLANE_2-OBJECT_2-NAME': 'SUPERNOVA', 'PLANE_1-REDSHIFT': 0.2, 'PLANE_2-REDSHIFT': 0.7}}, 'CONFIGURATION_4': {'NAME': 'SPICY_LIFE', 'FRACTION': 0.25, 'PLANE_1': {'OBJECT_1': 'LENS', 'OBJECT_2': 'STAR', 'OBJECT_3': 'STAR', 'PARAMETERS': {'REDSHIFT': 0.2}}, 'PLANE_2': {'OBJECT_1': 'LENS', 'PARAMETERS': {'REDSHIFT': 0.7}}, 'PLANE_3': {'OBJECT_1': 'SOURCE', 'OBJECT_2': 'SUPERNOVA', 'OBJECT_3': 'AGN', 'PARAMETERS': {'REDSHIFT': 1.3}}, 'NOISE_SOURCE_1': 'POISSON_NOISE', 'SIZE': 25, 'SIM_DICT': {'CONFIGURATION_LABEL': 'CONFIGURATION_4', 'CONFIGURATION_NAME': 'SPICY_LIFE', 'NUMBER_OF_PLANES': 3, 'PLANE_1-NUMBER_OF_OBJECTS': 3, 'PLANE_1-OBJECT_1-NAME': 'LENS', 'PLANE_1-OBJECT_2-NAME': 'STAR', 'PLANE_1-OBJECT_3-NAME': 'STAR', 'PLANE_2-NUMBER_OF_OBJECTS': 1, 'PLANE_2-OBJECT_1-NAME': 'LENS', 'PLANE_3-NUMBER_OF_OBJECTS': 3, 'PLANE_3-OBJECT_1-NAME': 'SOURCE', 'PLANE_3-OBJECT_2-NAME': 'SUPERNOVA', 'PLANE_3-OBJECT_3-NAME': 'AGN', 'PLANE_1-REDSHIFT': 0.2, 'PLANE_2-REDSHIFT': 0.7, 'PLANE_3-REDSHIFT': 1.3}}}}
As you can see the parameters have been updated. Now to regenerate the dataset, let's check out the regenerate()
function.
print(help(dataset.regenerate))
Help on method regenerate in module deeplenstronomy.deeplenstronomy: regenerate(**make_dataset_args) method of deeplenstronomy.deeplenstronomy.Dataset instance Using the dictionary stored in self.config_dict, make a new dataset Args: make_dataset_args (dict): arguments supplied to make_dataset when original dataset was generated None
The regenerate function will automatically use the same parameters that were supplied in the original call to deeplenstronomy.make_dataset()
.
dataset.regenerate()
To really convince ourselves that this worked, let's look at the image again.
view_image_rgb(dataset.CONFIGURATION_1_images[0], Q=10, stretch=10)
While it's tough to tell by eye that the num_exposures
was updated, we can see the source galaxy has been moved 3 arcseconds to the right. Woohoo!
Next, let's say we want a parameter to be drawn from a distribution, and we want to update the characteristics of that distribution. In this case, we'll use the update_param_dist()
function.
print(help(dataset.update_param_dist))
Help on method update_param_dist in module deeplenstronomy.deeplenstronomy: update_param_dist(new_param_dist_dict, configuration) method of deeplenstronomy.deeplenstronomy.Dataset instance Update the distribution from which a parameter is drawn. Args: new_param_dist_dict (dict): Should look like this {'param_1_name': {'name': 'uniform', 'parameters': {'minimum': new_value_1, 'maximum': new_value_2}}, 'param_2_name': {'name': 'uniform', 'parameters': {'minimum': new_value_3, 'maximum': new_value_4}}, ...} configuration (str): like 'CONFIGURATION_1', 'CONFIGURATION_2', etc... None
So let's suppose that after some analysis we've decided the source galaxy's center_y parameter should be drawn from a uniform distribution on the interval [4, -2].
new_param_dist_dict = {'PLANE_2-OBJECT_1-LIGHT_PROFILE_1-center_y': {'name': 'uniform',
'parameters': {'minimum': -4,
'maximum': -2}}}
dataset.update_param_dist(new_param_dist_dict, 'CONFIGURATION_1')
Again, we can verify that the change was implemented by looking at the configuration dictionary:
dataset.config_dict
{'DATASET': {'NAME': 'MyDeeplenstronomyDataset', 'PARAMETERS': {'SIZE': 100, 'OUTDIR': 'MySimulationResults'}}, 'COSMOLOGY': {'PARAMETERS': {'H0': 70, 'Om0': 0.3}}, 'IMAGE': {'PARAMETERS': {'exposure_time': 90, 'numPix': 100, 'pixel_scale': 0.263, 'psf_type': 'GAUSSIAN', 'read_noise': 7, 'ccd_gain': 6.083}}, 'SURVEY': {'PARAMETERS': {'BANDS': 'g,r,i,z,Y', 'seeing': 0.9, 'magnitude_zero_point': 30.0, 'sky_brightness': 23.5, 'num_exposures': 3}}, 'SPECIES': {'GALAXY_1': {'NAME': 'LENS', 'LIGHT_PROFILE_1': {'NAME': 'SERSIC_ELLIPSE', 'PARAMETERS': {'magnitude': 19.5, 'center_x': 0.0, 'center_y': 0.0, 'R_sersic': 10, 'n_sersic': 4, 'e1': 0.2, 'e2': -0.1}}, 'LIGHT_PROFILE_2': {'NAME': 'SERSIC_ELLIPSE', 'PARAMETERS': {'magnitude': 18.0, 'center_x': 0.0, 'center_y': 0.0, 'R_sersic': 3, 'n_sersic': 8, 'e1': 0.05, 'e2': -0.05}}, 'MASS_PROFILE_1': {'NAME': 'SIE', 'PARAMETERS': {'theta_E': 1.0, 'e1': 0.1, 'e2': -0.1, 'center_x': 0.0, 'center_y': 0.0}}, 'SHEAR_PROFILE_1': {'NAME': 'SHEAR', 'PARAMETERS': {'gamma1': 0.08, 'gamma2': 0.01}}}, 'GALAXY_2': {'NAME': 'SOURCE', 'LIGHT_PROFILE_1': {'NAME': 'SERSIC_ELLIPSE', 'PARAMETERS': {'magnitude': 21.5, 'center_x': 3.0, 'center_y': {'DISTRIBUTION': {'NAME': 'uniform', 'PARAMETERS': {'minimum': -4, 'maximum': -2}}}, 'R_sersic': 6, 'n_sersic': 5, 'e1': 0.2, 'e2': -0.1}}, 'SHEAR_PROFILE_1': {'NAME': 'SHEAR', 'PARAMETERS': {'gamma1': 0.08, 'gamma2': 0.01}}}, 'POINTSOURCE_1': {'NAME': 'AGN', 'HOST': 'SOURCE', 'PARAMETERS': {'magnitude': 16}}, 'POINTSOURCE_2': {'NAME': 'SUPERNOVA', 'HOST': 'SOURCE', 'PARAMETERS': {'magnitude': 21.0, 'sep': 2.0, 'sep_unit': 'arcsec'}}, 'POINTSOURCE_3': {'NAME': 'STAR', 'HOST': 'Foreground', 'PARAMETERS': {'magnitude': 14.0}}, 'NOISE_1': {'NAME': 'POISSON_NOISE', 'PARAMETERS': {'mean': 2.0}}}, 'GEOMETRY': {'CONFIGURATION_1': {'NAME': 'GALAXY_AGN', 'FRACTION': 0.25, 'PLANE_1': {'OBJECT_1': 'LENS', 'PARAMETERS': {'REDSHIFT': 0.2}}, 'PLANE_2': {'OBJECT_1': 'SOURCE', 'OBJECT_2': 'AGN', 'PARAMETERS': {'REDSHIFT': 0.7}}, 'NOISE_SOURCE_1': 'POISSON_NOISE', 'SIZE': 25, 'SIM_DICT': {'CONFIGURATION_LABEL': 'CONFIGURATION_1', 'CONFIGURATION_NAME': 'GALAXY_AGN', 'NUMBER_OF_PLANES': 2, 'PLANE_1-NUMBER_OF_OBJECTS': 1, 'PLANE_1-OBJECT_1-NAME': 'LENS', 'PLANE_2-NUMBER_OF_OBJECTS': 2, 'PLANE_2-OBJECT_1-NAME': 'SOURCE', 'PLANE_2-OBJECT_2-NAME': 'AGN', 'PLANE_1-REDSHIFT': 0.2, 'PLANE_2-REDSHIFT': 0.7}}, 'CONFIGURATION_2': {'NAME': 'GALAXY_AGN_NOISELESS', 'FRACTION': 0.25, 'PLANE_1': {'OBJECT_1': 'LENS', 'PARAMETERS': {'REDSHIFT': 0.2}}, 'PLANE_2': {'OBJECT_1': 'SOURCE', 'OBJECT_2': 'AGN', 'PARAMETERS': {'REDSHIFT': 0.7}}, 'SIZE': 25, 'SIM_DICT': {'CONFIGURATION_LABEL': 'CONFIGURATION_2', 'CONFIGURATION_NAME': 'GALAXY_AGN_NOISELESS', 'NUMBER_OF_PLANES': 2, 'PLANE_1-NUMBER_OF_OBJECTS': 1, 'PLANE_1-OBJECT_1-NAME': 'LENS', 'PLANE_2-NUMBER_OF_OBJECTS': 2, 'PLANE_2-OBJECT_1-NAME': 'SOURCE', 'PLANE_2-OBJECT_2-NAME': 'AGN', 'PLANE_1-REDSHIFT': 0.2, 'PLANE_2-REDSHIFT': 0.7}}, 'CONFIGURATION_3': {'NAME': 'LENSED_SNE', 'FRACTION': 0.25, 'PLANE_1': {'OBJECT_1': 'LENS', 'PARAMETERS': {'REDSHIFT': 0.2}}, 'PLANE_2': {'OBJECT_1': 'SOURCE', 'OBJECT_2': 'SUPERNOVA', 'PARAMETERS': {'REDSHIFT': 0.7}}, 'NOISE_SOURCE_1': 'POISSON_NOISE', 'SIZE': 25, 'SIM_DICT': {'CONFIGURATION_LABEL': 'CONFIGURATION_3', 'CONFIGURATION_NAME': 'LENSED_SNE', 'NUMBER_OF_PLANES': 2, 'PLANE_1-NUMBER_OF_OBJECTS': 1, 'PLANE_1-OBJECT_1-NAME': 'LENS', 'PLANE_2-NUMBER_OF_OBJECTS': 2, 'PLANE_2-OBJECT_1-NAME': 'SOURCE', 'PLANE_2-OBJECT_2-NAME': 'SUPERNOVA', 'PLANE_1-REDSHIFT': 0.2, 'PLANE_2-REDSHIFT': 0.7}}, 'CONFIGURATION_4': {'NAME': 'SPICY_LIFE', 'FRACTION': 0.25, 'PLANE_1': {'OBJECT_1': 'LENS', 'OBJECT_2': 'STAR', 'OBJECT_3': 'STAR', 'PARAMETERS': {'REDSHIFT': 0.2}}, 'PLANE_2': {'OBJECT_1': 'LENS', 'PARAMETERS': {'REDSHIFT': 0.7}}, 'PLANE_3': {'OBJECT_1': 'SOURCE', 'OBJECT_2': 'SUPERNOVA', 'OBJECT_3': 'AGN', 'PARAMETERS': {'REDSHIFT': 1.3}}, 'NOISE_SOURCE_1': 'POISSON_NOISE', 'SIZE': 25, 'SIM_DICT': {'CONFIGURATION_LABEL': 'CONFIGURATION_4', 'CONFIGURATION_NAME': 'SPICY_LIFE', 'NUMBER_OF_PLANES': 3, 'PLANE_1-NUMBER_OF_OBJECTS': 3, 'PLANE_1-OBJECT_1-NAME': 'LENS', 'PLANE_1-OBJECT_2-NAME': 'STAR', 'PLANE_1-OBJECT_3-NAME': 'STAR', 'PLANE_2-NUMBER_OF_OBJECTS': 1, 'PLANE_2-OBJECT_1-NAME': 'LENS', 'PLANE_3-NUMBER_OF_OBJECTS': 3, 'PLANE_3-OBJECT_1-NAME': 'SOURCE', 'PLANE_3-OBJECT_2-NAME': 'SUPERNOVA', 'PLANE_3-OBJECT_3-NAME': 'AGN', 'PLANE_1-REDSHIFT': 0.2, 'PLANE_2-REDSHIFT': 0.7, 'PLANE_3-REDSHIFT': 1.3}}}}
Now all that's left to do is regenerate the dataset and check out the results.
dataset.regenerate()
view_image_rgb(dataset.CONFIGURATION_1_images[0], Q=10, stretch=10)
With the ability to update the parameters of a dataset and regenerate it programatically, you should be able to arrive at a finalized dataset through the optimization of a metric of your choice.