deepskies / deeplenstronomy Goto Github PK
View Code? Open in Web Editor NEWA pipeline for versatile strong lens sample simulations
License: MIT License
A pipeline for versatile strong lens sample simulations
License: MIT License
As a precaution, it would be good to have a structure in place to check that everything the user asked for is present in the final metadata
Then convert to image.
write lenstronomy code API for this.
Do we need more documentation about where to find options for different settings?
@bnord @AleksCipri Moving the issue here
I did install everything successfully but...:
AttributeError: 'Dataset' object has no attribute 'update_param_dist'
Can you do a dir(dataset)? and check the attributes?
Motivated by Erik Zaborowski and Alex Drlica-Wagner, applying a Poisson resampling to image backgrounds for dataset diversity is not appropriate if the background images have been background-subtracted.
To remedy this behavior, Erik suggests removing the Poisson resampling. To ensure dataset diversity, we should also warn the user if the distribution of background images utilized could prove troublesome.
Consider a function placed in deeplenstronomy.py:
def check_background_indices(idx_list: list):
"""Issue a warning if an element occurs to frequently in the list.
Calculate number of elements in the list that deviate from a uniform distribution
by more than 1 standard deviation. If this number is more than 1/3 of the elements
in the list, print a warning.
Args:
idx_list (list): List of background image indices to use.
"""
values = np.unique(idx_list)
average_value, std = np.mean(values), np.std(values)
num_deviating = sum(np.abs(values - average_value) > np.std(values))
if num_deviating > len(idx_list) / 3:
print("WARNING: Non-uniform distribution of background images detected, check map.txt file.")
If this function is called on the output of utils.organize_image_backgrounds, then we should be safe to remove the Poisson resampling.
It would be neat to have fits as an output image format option, specifically matching the DES Strong Lensing Cutout format
AttributeError: 'Dataset' object has no attribute 'update_param_dist' - when trying to use function for updating.
These are some minor suggestions on improving the documentation in the README. openjournals/joss-reviews#2854
make_dataset()
in the markdown, but I wouldn't have known to look for it there.test_all.py
and it's a bit hard to tell exactly what functionality of what module is being tested. A better organization would be to break it down into multiple files named after the modules being tested. Also, I strongly recommend setting up CI via GitHub Actions!Some of the notebooks take a while to load on GitHub. It would be good to use jupyter to convert the notebooks to html, use those html pages in the documentation, and then link to the full notebooks
I would make a specific lenstronomy version as a requirement of the installation (e.g. the latest) or have the current requirement on the latest version. In this way the deployment is stable and you are not getting people approaching us with error messages due to outdated lenstronomy versions.
would be good to have functionality to automatically plot a light curve
To better match astronomical data, it would be nice to have
When I ran view_image(dataset.CONFIGURATION_1_images[2][1])
as instructed in the DeepLenstronomyDemo.ipynb, it output one object instead of four objects in the demo.yaml file. I've tried with different image indexes and bands, but the problem persists:
as opposed to
Possible solutions:
where will we put the random seed?
Is there one called explicitly in lenstronomy?
This independent of the survey plate scale.
the peak parameter and static model should be added to the timeseries demo notebook
Hi! I just started using this. I tried to run test.ipynb, but it tries to import the module Simulations.lenstronomy_sim, which doesn't seem to be in deeplenstronomy.
read in json or yml files that makes sky_survey.py more generalizable.
... to determine from physical/empirical factors how large or how far away an object should appear.
To make deeplenstronomy lightweight, the user will be allowed to provide their own input files to specify
Each of these will need a default file format and options in the main configuration file to specify them.
Lenstronomy has some new profiles so they need to be added to the check.py
functionalities.
Even better, check.py
should be updated to find all lenstornomy modules programmatically.
# Lens properties
Velocity_Dispersion = 250.
# light Model
Einstein_Radius = 1.
Apparent_Magnitude_Lens = [21., 21., 21., 21., 21]
Absolute_Magnitude_Lens = [21., 21., 21., 21., 21]
Apparent_Magnitude_Source = [21., 21., 21., 21., 21]
Absolute_Magnitude_Source = [21., 21., 21., 21., 21]
Position_angle_Lens = 0.0
Position_angle_Source = 0.0
Halflight_Radius_Lens = 1.0
Halflight_Radius_Source = 1.0
magnification = 2.0
Source_position_x = 0.0
Source_position_y = 0.0
Source_position_ra = 0.0
Source_position_dec = 0.0
Lens_position_x = 0.0
Lens_position_y = 0.0
Lens_position_ra = 0.0
Lens_position_dec = 0.0
# Mass Model
Halo_mass_Lens = 10.
Halo_mass_Lens_slope = 1.0
Halo_mass_Lens_core = 1.0 # e.g., NFW
Stellar_mass_Lens = 10.
Shear_External = 1.
# Distances
Redshift_Lens = 0.5
Redshift_Source = 1.0
Signal_to_Noise_model = 5.0
Cross_section = 1.0
Logo does not load.
These two dictionary elements give me different redshifts:
zs_plane = dataset.CONFIGURATION_1_metadata['PLANE_2-REDSHIFT-g']
zs_object = dataset.CONFIGURATION_1_metadata['PLANE_2-OBJECT_1-REDSHIFT-g']
They have nearly the same distributions (histograms), but there is no obvious element-by-element correlation.
I didn't find the specific documentation on "planes" and how those connect to object attributes. Could you share some guidance here?
The LSST survey seems to be broken in version 0.0.1.3
Steps to reproduce:
change cell 5 to
dataset = dl.make_dataset('data/demo.yaml', survey='lsst', store_in_memory=False, store_sample=True, verbose=True)
This results in an error,
SURVEY.PARAMETERS.num_exposures.DISTRIBUTION.PARAMETERS must be a dictionary or None
Fatal error(s) detected in config file. Please edit and rerun.
---------------------------------------------------------------------------
ConfigFileError Traceback (most recent call last)
~/anaconda3/envs/deeplens/lib/python3.7/site-packages/deeplenstronomy/check.py in _run_checks(full_dict, config_dict)
959 try:
--> 960 check_runner = AllChecks(full_dict, config_dict)
961 except ConfigFileError:
~/anaconda3/envs/deeplens/lib/python3.7/site-packages/deeplenstronomy/check.py in __init__(self, full_dict, config_dict)
83 _kind_output(total_errs)
---> 84 raise ConfigFileError
85
ConfigFileError:
During handling of the above exception, another exception occurred:
ConfigFileError Traceback (most recent call last)
<ipython-input-6-2a8fd3d7f5db> in <module>
----> 1 dataset = dl.make_dataset('data/demo.yaml', survey='lsst', store_in_memory=False, store_sample=True, verbose=True)
~/anaconda3/envs/deeplens/lib/python3.7/site-packages/deeplenstronomy/deeplenstronomy.py in make_dataset(config, dataset, save_to_disk, store_in_memory, verbose, store_sample, image_file_format, survey, return_planes, skip_image_generation, solve_lens_equation)
313 if not _check_survey(survey):
314 raise RuntimeError("survey={0} is not a valid survey.".format(survey))
--> 315 parser = Parser(config, survey=survey)
316 dataset.config_dict = parser.config_dict
317
~/anaconda3/envs/deeplens/lib/python3.7/site-packages/deeplenstronomy/input_reader.py in __init__(self, config, survey)
49
50 # Check for user errors in inputs
---> 51 self.check()
52
53 return
~/anaconda3/envs/deeplens/lib/python3.7/site-packages/deeplenstronomy/input_reader.py in check(self)
173 Check configuration file for possible user errors.
174 """
--> 175 big_check._run_checks(self.full_dict, self.config_dict)
176
177 return
~/anaconda3/envs/deeplens/lib/python3.7/site-packages/deeplenstronomy/check.py in _run_checks(full_dict, config_dict)
961 except ConfigFileError:
962 print("\nFatal error(s) detected in config file. Please edit and rerun.")
--> 963 raise ConfigFileError
964
965 return
ConfigFileError:
what does sculpting mean?
This means being able to make the distributions take a particular shape, even if starting from another (e.g., empirical) distribution.
A good feature to have would be BACKGROUNDS functionalities with time series of images. In principle you could use one background image and realize the noise as a time series, but it would be cool to have the ability to load single-epoch images into deeplenstronomy
Often, multiple deeplenstronomy CONFIGURATIONs might get mapped to the same class in a ML problem. Perhaps a feature like this:
GROUP_1:
NAME: InsertNameHere
MEMBERS: ['CONFIGURATION_1', 'CONFIGURATION_2']
SHUFFLE: True
GROUP_2:
NAME: InsertOtherNameHere
MEMBERS: ['CONFIGURATION_3, 'CONFIGURATION_4']
SHUFFLE: True
at the main level in the configuration file could trigger automatic grouping and shuffling of the specified configurations after the simulation finishes
function must output kwargs_{source, lens} to be used to create light model.
Is there something like this in lenstronomy?
The test suite has two major issues:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.