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

Website Content #40

Closed
rgommers opened this issue Sep 9, 2019 · 22 comments
Closed

Website Content #40

rgommers opened this issue Sep 9, 2019 · 22 comments
Assignees
Labels

Comments

@rgommers
Copy link
Member

rgommers commented Sep 9, 2019

We're missing some stuff (mostly cool looking images), but copy too. Continue working on this.

New content lives on the branch newsite (branched from master of numpy.org), in the directory /new-content. We can add and commit updated content there for the time being.

@rgommers rgommers created this issue from a note in NumPy.org Redesign (To do) Sep 9, 2019
@InessaPawson InessaPawson moved this from To do to In progress in NumPy.org Redesign Sep 20, 2019
@InessaPawson InessaPawson changed the title Complete site Content Website Content Sep 20, 2019
@InessaPawson InessaPawson self-assigned this Sep 20, 2019
@stefanv
Copy link
Contributor

stefanv commented Sep 23, 2019

Is this the appropriate issue for discussing the front page?

The front page is arguably the most important part of the site, since it has to capture users and focus their attention to deeper within the website. It took a look at the current mock-up. It is beautiful, but I feel it goes too far in the simplicity direction: i.e., while it succeeds in not being visually overwhelming, it misses an opportunity to convey some useful information in that prime space.

See, e.g., the Haskell website. It immediately shows you interesting parts of the project, in this case even allowing you to play with some elements of it. Somewhat similar for nim.

We have a beautiful API, so maybe we can showcase it?

@joelachance
Copy link
Collaborator

I really like the Haskell website. I think the interactive command shell quite a bit, and it's a little bit addicting. I now know more Haskell than I did 5 minutes ago :)

That being said, I think that will likely take some time if people are interested in that (I think it would be a great addition). However, I do think we could easily implement something static that will give the same message. Any suggestions for content?

@stefanv
Copy link
Contributor

stefanv commented Sep 23, 2019

The interactive session is fun, but probably a stretch for us to build. I more wanted to focus on the code snippets and the value they could add.

(That said, an interactive component could be backed by AWS Lambda quite easily.)

@joelachance
Copy link
Collaborator

So Haskell (and others) are using this library: https://github.com/chrisdone/jquery-console
I think we can do this easier than I was expecting, but probably not priority #1.

If anyone has an impressive code snippet you'd prefer we use, I can add that for now.

@stefanv
Copy link
Contributor

stefanv commented Sep 24, 2019

Maybe something like:

import numpy as np

x = np.linspace(-1, 1, 1000)
y = x[..., np.newaxis]
z = np.sin(x**2 + y)

p0 = np.sum(z, axis=0)
p1 = np.sum(z, axis=1)

And then display something like a [marginal plot]:

image

Instead of histograms, showing p0 and p1.

If that code snippet is too complicated, something like:

# Pure Python

N = 10000 
samples = [s/N for s in range(0, N)] 
squared = [s**2 for s in samples] 

# NumPy: simpler notation, and much faster
samples = np.linspace(0, 1, N) 
squared = samples**2 

@rgommers
Copy link
Member Author

Good point, a code snippet would be great. I like that hexbin plot code better. Showing that plot without the code for it is a nice idea. Could you add the code here @stefanv so it can be tweaked (e.g. green needs change to our color scheme)?

@rgommers
Copy link
Member Author

(That said, an interactive component could be backed by AWS Lambda quite easily.)

So Haskell (and others) are using this library: https://github.com/chrisdone/jquery-console
I think we can do this easier than I was expecting, but probably not priority #1.

Single expressions are doable it seems, but an actual shell is much harder probably. If it's responsive and backed by AWS Lambda it would be cool indeed ....

@mattip
Copy link
Member

mattip commented Sep 24, 2019

Running an interpreter instance on a server via javascript can open up security problems and resource abuse. Solutions such as the PyPy sandbox which recently got and update exist, but are not trivial. We could consider running something like pyiodide which runs in the user's browser, but I don't think that should be our first priority.

@stefanv
Copy link
Contributor

stefanv commented Sep 24, 2019

Good point, a code snippet would be great. I like that hexbin plot code better. Showing that plot without the code for it is a nice idea. Could you add the code here @stefanv so it can be tweaked (e.g. green needs change to our color scheme)?

The hexbin was just an example, taken from the seaborn gallery. It doesn't illustrate NumPy very much.

@joelachance
Copy link
Collaborator

Running an interpreter instance on a server via javascript can open up security problems and resource abuse. Solutions such as the PyPy sandbox which recently got and update exist, but are not trivial. We could consider running something like pyiodide which runs in the user's browser, but I don't think that should be our first priority.

100%. However, I am interested in solving this problem. I think this would be really great to have either on the site, or standalone (or both).

I think I may reach out to the person who did Haskell's sandbox and see what he has to say. Looking at what code I can in the browser, I have a feeling their implementation might not be very secure.

Regardless, not our first priority :)

@rgommers
Copy link
Member Author

Cool, be curious to hear what you learn @joelachance.

@stefanv
Copy link
Contributor

stefanv commented Sep 26, 2019

100%. However, I am interested in solving this problem. I think this would be really great to have either on the site, or standalone (or both).

AWS lambda now has a layer with NumPy and SciPy included:

https://aws.amazon.com/blogs/aws/new-for-aws-lambda-use-any-programming-language-and-share-common-components/

Our system could be as simple as CodeMirror -> send code to lambda -> display resulting object. AWS will allow us to set very clear resource limits, and we can switch networking off so that no remote data can be fetched. We can also have the call timeout in 5 seconds or so.

@stefanv
Copy link
Contributor

stefanv commented Oct 2, 2019

@joelachance I spoke to Chris Holdgraf this morning and turns out this can be done trivially using ThebeLab + MyBinder: https://thebelab.readthedocs.io/en/latest/

Only downside is that it takes a few seconds for the kernel to spin up, but subsequent commands execute quickly.

If we have some money, we could also host our own binder instance, which would make startup very quick (we can pre-pull the image we are interested in, which currently is what causes the delay).

@joelachance
Copy link
Collaborator

I will look into this! I never heard back from Chris Done who did the Haskell sandbox. I may try him at Twitter next...

@stefanv
Copy link
Contributor

stefanv commented Oct 3, 2019

If you get stuck, you can get in touch with @choldgraf, who also uses this for Jupyter Book.

@choldgraf
Copy link

Note that if you ran your own Binder instance, you could also request the kernel upon page load instead of waiting for someone to click a button before requesting the kernel. It's all a question of resource management and cost :-)

@joelachance
Copy link
Collaborator

@choldgraf, good to know! I'm going to look at this this coming week, I may be in touch with questions :)

@InessaPawson
Copy link
Member

The front page is arguably the most important part of the site, since it has to capture users and focus their attention to deeper within the website. It took a look at the current mock-up. It is beautiful, but I feel it goes too far in the simplicity direction: i.e., while it succeeds in not being visually overwhelming, it misses an opportunity to convey some useful information in that prime space.

See, e.g., the Haskell website. It immediately shows you interesting parts of the project, in this case even allowing you to play with some elements of it. Somewhat similar for nim.

We have a beautiful API, so maybe we can showcase it?

@stefanv The website content is still at the stage of brainstorming. Excellent timing on your idea for the front page!

@charris
Copy link
Member

charris commented Oct 29, 2019

        # Map centroids to ideal camera FPA and turn them into 3-D
        # direction vectors
        pts[..., :2] = self.fpamap(self.centroids, parm, desc)
        pts[..., 2] = 1.0
        pts /= np.sqrt(np.sum(pts * pts, axis=-1, keepdims=True))

        # Compute correlation matrices for all patches.  The result has
        # dimensions (n, 3, 3).
        wpts = pts * weight
        cor = np.einsum('kij, kim -> kjm', pin, wpts, out=self.cor)

        # Compute matching rotations using the singular value method.
        # Requires numpy >= 1.8 for stacked svd. The output has dimensions
        # (n, 3, 3).
        u, d, v = np.linalg.svd(cor)
        rot = np.einsum('ijk, ikl -> ijl', u, v, out=self.rot)

@erfannariman
Copy link

One of the most impressive numpy usage I've seen are from this user on SO. Definitely worth to check his answers.

@joelachance
Copy link
Collaborator

@choldgraf I have binder working and a NumPy shell working in the browser. Splitting this out into another ticket (#66). Thank you for the suggestion, it's working well!

rgommers added a commit to rgommers/numpy.org that referenced this issue Mar 22, 2020
Note that the styling for this needs fixing in shell.css

Closes numpygh-40
@rgommers
Copy link
Member Author

Okay this is all done and can be closed. The shell content in this issue is superseded by gh-81. Thanks everyone for the input!

NumPy.org Redesign automation moved this from In progress to Done Mar 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

No branches or pull requests

8 participants