swagnercarena / paltas

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

numpy error when trying to call ConfigHandler to load test configs #50

Open rahulmkarthik opened 10 months ago

rahulmkarthik commented 10 months ago

While trying to call ConfigHandler in the paltas_movie notebook in the lightcone repo as:

We'll pass one of our example Configs in

config_handler = ConfigHandler(r'C:\Users\hp\Documents\GitHub\lightcone\Data\Paltas\test_config.py')

I run into the error:

ValueError Traceback (most recent call last) c:\Users\hp\Documents\GitHub\lightcone\notebooks\paltas_movie.ipynb Cell 3 line 1 12 print(root_path) 14 # We'll pass one of our example Configs in ---> 15 config_handler = ConfigHandler(r'C:\Users\hp\Documents\GitHub\lightcone\Data\Paltas\test_config.py') 17 # First let's get the lenstronomy kwargs_model and kwargs_param 18 kwargs_model, kwargs_param = config_handler.get_lenstronomy_models_kwargs()

File ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\paltas-0.1.1-py3.11.egg\paltas\Configs\config_handler.py:74, in ConfigHandler.init(self, config_path) 66 self.config_dict = self.config_module.config_dict 68 # Get the random seed to use, or draw a random not-too-large one 69 # (so it is easy to copy-paste from metadata into config files) 70 # Max is 2**32 - 1, see _legacy_seeding in numpy/random/_mt19937.pyx 71 self.base_seed = getattr( 72 self.config_module, 73 'seed', ---> 74 (np.random.randint(np.iinfo(np.uint32).max,))) 75 # Make sure base_seed is a sequence, not a number 76 if isinstance(self.base_seed, (int, float)):

File mtrand.pyx:763, in numpy.random.mtrand.RandomState.randint()

File _bounded_integers.pyx:1336, in numpy.random._bounded_integers._rand_int32()

ValueError: high is out of bounds for int32

swagnercarena commented 10 months ago

Looks like this is a known problem with numpy on Windows: https://github.com/numpy/numpy/issues/17038. Are you running on Windows?