Skip to content
New issue

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

mcdriver.py shape mismatch #1

Open
hpaulj opened this issue Oct 24, 2011 · 1 comment
Open

mcdriver.py shape mismatch #1

hpaulj opened this issue Oct 24, 2011 · 1 comment

Comments

@hpaulj
Copy link

hpaulj commented Oct 24, 2011

In mcdriver.py, the 3 arrays used for plotting do not match in shape.

prices.shape = (n_strikes, n_sigmas)
strike_mesh, sigma_mesh = np.meshgrid(strike_vals, sigma_vals)

strike_mesh.shape == (n_sigmas, n_strikes), the transpose of prices.

np.meshgrid is a bit confusing in this regard. np.mgrid produces arrays with the shape you apparently expect, but is 'called' with slices, not arrays.

This error is hidden to the casual user because the default invocation uses the same size (5) in both dimensions. But the contour plots are wrong (as shown in the tutorial text). The call should have lower values for lower sigmas (and higher strike prices).

@minrk
Copy link
Owner

minrk commented Nov 27, 2011

Thanks! I pulled the example from the IPython docs, and did not write it. I will see if I can't fix it with your suggestions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants