swagnercarena / paltas

Conduct simulation-based inference on strong gravitational lensing systems.
MIT License
13 stars 12 forks source link

kwargs_synthesis #53

Open parlange opened 9 months ago

parlange commented 9 months ago

Hi @swagnercarena

I've been reproducing the experiments in Ovejero and recently have been trying to run the Paltas notebooks, and managed to test MCMC with the Population Analysis notebook. However, I cannot create my own config file or train the model with the provided example configs. In both cases, it ends in an error with kwargs_synthesis

The paltas package is installed at: /anaconda3/envs/paltas/lib/python3.11/site-packages/paltas/

(I've tried without Anaconda with the same results)

The repository is cloned at: /home/parlange/paltas/

Where do you initialize your jupyter lab kernel so that root_path is correct and you can access the /paltas/notebooks/ folder?

If I initialize at /home/parlange/paltas/ the root_path is:

print(root_path)
/home/parlange/anaconda3/envs/paltas/lib/python3.11/site-packages/paltas

root_path = paltas.__path__[0][:-7]
/home/parlange/anaconda3/envs/paltas/lib/python3.11/site-packages

config_handler joins

config_handler = ConfigHandler(os.path.join(root_path,'/paltas/Configs/config_simple.py'))

Result:

/home/parlange/anaconda3/envs/paltas/lib/python3.11/site-packages/paltas/Configs/config_simple.py (*removed /Examples/ because the package does not have that folder)

As requested, downloaded and extracted the COSMOS dataset into the cloned repository [COSMOS_23.5_training_sample.tar.gz].

Terminal commands. Tried both:

python generate.py /home/parlange/paltas/paltas/Configs/Examples/config_all.py example --n 100

python generate.py /home/parlange/anaconda3/envs/paltas/lib/python3.11/site-packages/paltas/Configs/config_all.py example --n 100

Output:

python generate.py /home/parlange/anaconda3/envs/paltas/lib/python3.11/site-packages/paltas/Configs/config_all.py example --n 100
/home/parlange/anaconda3/envs/paltas/lib/python3.11/site-packages/numba/core/decorators.py:262: NumbaDeprecationWarning: numba.generated_jit is deprecated. Please see the documentation at: https://numba.readthedocs.io/en/stable/reference/deprecation.html#deprecation-of-generated-jit for more information and advice on a suitable replacement.
  warnings.warn(msg, NumbaDeprecationWarning)
Save folder path: example
/home/parlange/anaconda3/envs/paltas/lib/python3.11/site-packages/paltas/Sampling/sampler.py:110: UserWarning: Parameter in cross dict specified elsewhere! Will be overwritten
  warnings.warn('Parameter in cross dict specified elsewhere!'
  0%|                                                                        | 0/100 [00:00<?, ?it/s]/home/parlange/anaconda3/envs/paltas/lib/python3.11/site-packages/paltas/Configs/config_handler.py:528: RuntimeWarning: kwargs_numerics supersampling_factor modified for drizzle
  warnings.warn('kwargs_numerics supersampling_factor modified '
/home/parlange/anaconda3/envs/paltas/lib/python3.11/site-packages/paltas/Configs/config_handler.py:535: RuntimeWarning: kwargs_numerics point_source_supersampling_factor modified for drizzle
  warnings.warn('kwargs_numerics point_source_supersampling_factor'
Traceback (most recent call last):
  File "/home/parlange/anaconda3/envs/paltas/lib/python3.11/site-packages/paltas/generate.py", line 137, in <module>
    main()
  File "/home/parlange/anaconda3/envs/paltas/lib/python3.11/site-packages/paltas/generate.py", line 81, in main
    image, metadata = config_handler.draw_image(new_sample=True)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/parlange/anaconda3/envs/paltas/lib/python3.11/site-packages/paltas/Configs/config_handler.py", line 646, in draw_image
    image,metadata = self._draw_image_drizzle()
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/parlange/anaconda3/envs/paltas/lib/python3.11/site-packages/paltas/Configs/config_handler.py", line 544, in _draw_image_drizzle
    image_ss, metadata = self._draw_image_standard(add_noise=False,
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/parlange/anaconda3/envs/paltas/lib/python3.11/site-packages/paltas/Configs/config_handler.py", line 414, in _draw_image_standard
    kwargs_model, kwargs_params = self.get_lenstronomy_models_kwargs(
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/parlange/anaconda3/envs/paltas/lib/python3.11/site-packages/paltas/Configs/config_handler.py", line 190, in get_lenstronomy_models_kwargs
    self.main_deflector_class.draw_main_deflector())
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/parlange/anaconda3/envs/paltas/lib/python3.11/site-packages/paltas/MainDeflector/simple_deflectors.py", line 133, in draw_main_deflector
    p_names = ProfileListBase._import_class(model,None,None).param_names
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: ProfileListBase._import_class() missing 1 required positional argument: 'kwargs_synthesis'
  0%|                                                                        | 0/100 [00:02<?, ?it/s]

Thank you for releasing your work on strong lensing.