Skip to content

Instantly share code, notes, and snippets.

@cossatot
Last active January 18, 2020 00:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cossatot/bb042e307e21134adba497179ca7f35e to your computer and use it in GitHub Desktop.
Save cossatot/bb042e307e21134adba497179ca7f35e to your computer and use it in GitHub Desktop.
Jupyter notebook for a Bayesian inversion of critical wedge parameters
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@virgilioamaris
Copy link

Good afternoon Richard, I don't know if you're around here, but I'm trying to run your script and I can't get my PC to run the cell you ran as In [39] "Run the inversion Calculate the likelihoods" I don't know if it's the parallel processing or it might require a library that I don't know or anyway. I would appreciate any comments.
Thank you.

@cossatot
Copy link
Author

Hi, if it doesn't work, try calling it with calc_row_likelihood instead of calc_row_likelihood_parallel and see if that works.

@virgilioamaris
Copy link

virgilioamaris commented Dec 19, 2019 via email

@cossatot
Copy link
Author

Hi Virgilio,

The images didn't upload. Can you copy and paste the error message instead of posting a screenshot?

@virgilioamaris
Copy link

virgilioamaris commented Dec 21, 2019 via email

@virgilioamaris
Copy link

virgilioamaris commented Dec 26, 2019

Sorry, again...

=========
t_start = time.time()

priors = calc_row_likelihood(priors)
t_end = time.time()

print('done with {} calcs in {:.1f} seconds'.format(n_iters, (t_end - t_start)))

done with 100000 calcs in 0.1 seconds


C:\Users\vamaris\AppData\Local\Continuum\anaconda3\lib\site-packages\scipy\stats\stats.py:308: RuntimeWarning: divide by zero encountered in log
log_a = np.log(np.array(a, dtype=dtype))

priors['rel_likelihood'] = priors['likelihood'] / priors['likelihood'].max()


IndexError Traceback (most recent call last)
in
----> 1 priors['rel_likelihood'] = priors['likelihood'] / priors['likelihood'].max()

IndexError: invalid index to scalar variable.

priors.head()


AttributeError Traceback (most recent call last)
in
----> 1 priors.head()

AttributeError: 'numpy.float64' object has no attribute 'head'


As you see Im here.

@virgilioamaris
Copy link

Err1

@cossatot
Copy link
Author

I see the problem now.

You need to run something like

priors['likelihood'] = priors.apply(calc_row_likelihood, axis=1)

instead of

priors = calc_row_likelihood(priors)

If it doesn't work exactly, read the error messages and try to understand them to find the problem.

@virgilioamaris
Copy link

Ok. Perfect.

@virgilioamaris
Copy link

Thank you. It work correctly.

@cossatot
Copy link
Author

Great, I am glad I could help. Good luck with your research!

@virgilioamaris
Copy link

virgilioamaris commented Jan 18, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment