We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi,
I'm getting an error because the filename generated for the chain history file contains a colon (:), as part of the timestamp.
My code and error message (for one thread) are added below.
cheers, Maarten
from pydream.core import run_dream from pydream.parameters import FlatParam import numpy as np from scipy.stats import norm, uniform mu = 0 var = 1 def Latin_hypercube(minn, maxn, N): y = np.random.rand(N, len(minn)) x = np.zeros((N, len(minn))) for j in range(len(minn)): idx = np.random.permutation(N) P = (idx - y[:,j])/N x[:,j] = minn[j] + P * (maxn[j] - minn[j]) return x if __name__ == '__main__': history_seed = Latin_hypercube([-1],[1],50) np.save('history_seed.npy',history_seed) param = FlatParam(np.array(0)) sampled_params, log_ps = run_dream(param, likelihood, start = np.array(0), start_random = False, niterations = 1000, verbose = False, history_file = 'history_seed.npy')
multiprocessing.pool.RemoteTraceback: """ Traceback (most recent call last): File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\multiprocessing\pool.py", line 119, in worker result = (True, func(*args, **kwds)) File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\multiprocessing\pool.py", line 44, in mapstar return list(map(*args)) File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\pydream\core.py", line 127, in _sample_dream raise e File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\pydream\core.py", line 114, in _sample_dream sampled_params[iteration], log_prior , log_like = step_fxn(q0) File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\pydream\Dream.py", line 421, in astep raise e File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\pydream\Dream.py", line 362, in astep self.record_history(self.nseedchains, self.total_var_dimension, q_new, self.len_history) File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\pydream\Dream.py", line 945, in record_history self.save_history_to_disc(np.frombuffer(Dream_shared_vars.history.get_obj()), prefix) File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\pydream\Dream.py", line 959, in save_history_to_disc np.save(filename, history) File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\numpy\lib\npyio.py", line 517, in save fid = open(file, "wb") OSError: [Errno 22] Invalid argument: '2020_04_26_18:58:29_DREAM_chain_history.npy'
The text was updated successfully, but these errors were encountered:
Thanks for reporting this issue. The fastest workaround for this problem is to pass a str to themodel_name argument in the run_dream function:
model_name
sampled_params, log_ps = run_dream(param, likelihood, start = np.array(0), start_random = False, niterations = 1000, verbose = False, history_file = 'history_seed.npy', model_name='pydream_example')
That way pydream would use pydream_example as the prefix for all output files.
pydream_example
I am going to leave this issue open as I think this should be fixed in pydream anyway.
Please let me know if you have any other questions of issues.
Best,
Oscar
Sorry, something went wrong.
Thanks. The workaround solves it.
No branches or pull requests
Hi,
I'm getting an error because the filename generated for the chain history file contains a colon (:), as part of the timestamp.
My code and error message (for one thread) are added below.
cheers,
Maarten
The text was updated successfully, but these errors were encountered: