If you are trying to build a set of simulated data with the same characteristics as astronomical survey experiments, then look no further than the deeplenstronomy.surveys
functionality.
from deeplenstronomy import surveys
The available surveys are:
[x for x in dir(surveys) if not x.startswith('__')]
['delve', 'des', 'euclid', 'hst', 'lsst', 'ztf']
If you operate in one of these modes, the IMAGE
and SURVEY
sections of your configuration file will be overwritten with the characteristics of the specified astronomical survey. These characteristics are found in the surveys
module.
For example, we can look at the Hubble Space Telescope (hst
):
from inspect import getsource
print(getsource(surveys.hst))
def hst(): """ Force Hubble Space Telescope single band survey conditions into your simulated dataset. Utilize this function by passing `survey='hst'` in `deeplenstronomy.make_dataset()`. """ info = """ IMAGE: PARAMETERS: exposure_time: 5400.0 numPix: 100 pixel_scale: 0.08 psf_type: 'GAUSSIAN' read_noise: 4 ccd_gain: 2.5 SURVEY: PARAMETERS: BANDS: F160W seeing: 0.08 magnitude_zero_point: 25.96 sky_brightness: 22.3 num_exposures: 1 """ return info
These are the IMAGE
and SURVEY
conditions needed to produce Hubble Space Telescope-like images.
deeplenstronomy
offers a simple way of introducing these pre-written sections into your configuration file through its make_dataset()
function. Just set survey
to the desired survey from the list above.
import deeplenstronomy.deeplenstronomy as dl
from deeplenstronomy.visualize import view_image
dataset = dl.make_dataset('data/demo.yaml', survey='hst', store_in_memory=False, store_sample=True, verbose=True)
Entering main organization loop Organizing CONFIGURATION_1 Organizing CONFIGURATION_2 Organizing CONFIGURATION_3 Organizing CONFIGURATION_4 Generating images for CONFIGURATION_1 Progress: 100.0 % --- Elapsed Time: 0 H 0 M 1 S Generating images for CONFIGURATION_2 Progress: 100.0 % --- Elapsed Time: 0 H 0 M 1 S Generating images for CONFIGURATION_3 Progress: 100.0 % --- Elapsed Time: 0 H 0 M 0 S Generating images for CONFIGURATION_4 Progress: 100.0 % --- Elapsed Time: 0 H 0 M 5 S
We can inspect the image using deeplenstornomy
's built-in visualization functions.
view_image(dataset.CONFIGURATION_4_images[4][0])
We can compare to a different survey, with noticeable different image quality:
new_dataset = dl.make_dataset('data/demo.yaml', survey='ztf', store_in_memory=False, store_sample=True, verbose=True)
Entering main organization loop Organizing CONFIGURATION_1 Organizing CONFIGURATION_2 Organizing CONFIGURATION_3 Organizing CONFIGURATION_4 Generating images for CONFIGURATION_1 Progress: 100.0 % --- Elapsed Time: 0 H 0 M 2 S Generating images for CONFIGURATION_2 Progress: 100.0 % --- Elapsed Time: 0 H 0 M 2 S Generating images for CONFIGURATION_3 Progress: 100.0 % --- Elapsed Time: 0 H 0 M 2 S Generating images for CONFIGURATION_4 Progress: 100.0 % --- Elapsed Time: 0 H 0 M 8 S
view_image(new_dataset.CONFIGURATION_4_images[2][0])
In new_dataset
we are not simulating exactly the same system, since new parameters are drawn from specified distributions each time make_dataset()
is called. However, the difference in seeing
and pixel_scale
between the Zwicky Transient Facility and the Hubble Space Telescope are certainly observable.