Closed amn3142 closed 3 years ago
Hi, yeah I can look into it. A default value for delta_power_law_index = 0 is set on line 144 of defaults.py, but mabye the error is related to another missing key word.
do you specify values for log_mass_sheet_min/log_mass_sheet_max?
Yes, I'm working off an old version. Here are the keywords:
kwargs_realization = {'mass_func_type': 'POWER_LAW', 'log_mlow': log_mlow, 'log_mhigh': log_mhigh, 'log_mass_sheet_min': log_mlow, 'log_mass_sheet_max': log_mhigh, 'mdef_main': 'TNFW', 'mdef_los': 'TNFW', 'sigma_sub': SHMF_norm, 'cone_opening_angle': draw_halos_diameter, 'power_law_index': -1.9, 'LOS_normalization': LOS_norm, 'log_mlow_subs': log_mlow, 'log_mhigh_subs': log_mhigh, 'subhalo_convergence_correction_profile':'NFW'}
Hi,
Are you using the pyhaloDynamic or pyHalo class?
On Oct 12, 2020, at 5:43 PM, amn3142 notifications@github.com wrote:
No, I'm working off an old version. Here are the keywords:
keword input for the pyhalo realization
kwargs_realization = {'mass_func_type': 'POWER_LAW', 'log_mlow': log_mlow, 'log_mhigh': log_mhigh, 'log_mass_sheet_min': log_mlow, 'log_mass_sheet_max': log_mhigh, 'mdef_main': 'TNFW', 'mdef_los': 'TNFW', 'sigma_sub': SHMF_norm, 'cone_opening_angle': draw_halos_diameter, 'power_law_index': -1.9, 'LOS_normalization': LOS_norm, 'log_mlow_subs': log_mlow, 'log_mhigh_subs': log_mhigh, 'subhalo_convergence_correction_profile':'NFW'}
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/dangilman/pyHalo/issues/1#issuecomment-707360854, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADXTNDQNC7HPNYXGOLVN4Y3SKNZ6LANCNFSM4SNM4YMQ.
Just pyhalo, but then I'm running shift background to source
hmm, can you send me a screenshot of the error and the code you're trying to run?
Terminal output:
File "getImages.py", line 193, in
lens_model_with_halos,kwargs_lens= multiplane_powerspec_cdmwdm_mod_light_5.returnLensmodel(lens_system_with_halos, multiplaneBoo=True)
File "/home/nierenbe/pk/multiplane_powerspec_cdmwdm_mod_light_5.py", line 191, in returnLensmodel lensModel, kwargs_lens = lens_system_with_halos.get_lensmodel() File "/home/nierenbe/repositories/LenstronomyWrapper/lenstronomywrapper/LensSystem/lens_base.py", line 87, in get_lensmodel include_substructure, substructure_realization) File "/home/nierenbe/repositories/LenstronomyWrapper/lenstronomywrapper/LensSystem/lens_base.py", line 124, in get_lenstronomy_args realization.lensing_quantities() File "/home/nierenbe/repositories/pyHalo/pyHalo/single_realization.py", line 297, in lensing_quantities kwargs_mass_sheets, profile_list, z_sheets = self.mass_sheet_correction(self.rendering_classes) File "/home/nierenbe/repositories/pyHalo/pyHalo/single_realization.py", line 333, in mass_sheet_correction rendering_class.negative_kappa_sheets_theory() File "/home/nierenbe/repositories/pyHalo/pyHalo/Rendering/Main/base.py", line 63, in negative_kappa_sheets_theory kwargs_mass_sheets = self.keys_convergence_sheets File "/home/nierenbe/repositories/pyHalo/pyHalo/Rendering/Main/base.py", line 162, in keys_convergence_sheets raise Exception(text) Exception: When specifying mass function type POWER_LAW and rendering subhalos, must provide all required keyword arguments. The following need to be specified: delta_power_law_index
The code call is: lens_model_with_halos,kwargs_lens= multiplane_powerspec_cdmwdm_mod_light_5.returnLensmodel(lens_system_with_halos, multiplaneBoo=True)
where lens_system_with_halos is a pickled pyhalo object
And returnLensmodel just calls lens_system_with_halos.get_lensmodel()
ah... yeah I've run into issues myself when I pickle something, update code, and then try to go back and use the pickled object with the new code loaded on my computer. I actually don't totally understand how it works when you pickle an old version of a class, and then load it with a new code version... let me try to think of a solution
Would it be possible to put in default values for the new keywords e.g. 'delta_power_law_index' for 'POWER_LAW' mass function so this is backward compatible with old versions that don't have these specified?
Specifically what's happened is I'm loading in a pickled realization of subhalos and now it can't be processed because it was generated without that keyword.