idies / pyJHTDB

Python wrapper for the Johns Hopkins turbulence database library
Apache License 2.0
96 stars 47 forks source link

example ipython notebooks #3

Closed chichilalescu closed 4 years ago

chichilalescu commented 9 years ago

I found out that ipython notebooks exist. we should definitely have an example of pyJHTDB usage in that form...

sshamilton commented 9 years ago

I agree--the ipython notebooks would be a great starter for someone new to it.

chichilalescu commented 9 years ago

added basic example http://nbviewer.ipython.org/github/chichilalescu/pyJHTDB/blob/develop/pyJHTDB/pyJHTDB_example.ipynb we should probably decide where these examples should be placed (if they're not under pyJHTDB, then they don't get installed by pip, right?)

petebachant commented 9 years ago

In my opinion, examples shouldn't be installed (via pip or anything else). They should go in the top level directory of the repo (/examples/notebook1.ipynb etc.). Users can download the notebooks from nbviewer or clone from GitHub.

sshamilton commented 9 years ago

I agree--that makes sense. Lets put it in the top level directory.

chichilalescu commented 9 years ago

it makes sense to me too, so I moved it. New link is http://nbviewer.ipython.org/github/chichilalescu/pyJHTDB/blob/develop/examples/basic_usage.ipynb

alexlib commented 6 years ago

Thanks for the great package - we need to use GetPosition - do you have an example for it in Python? Notebook? Thanks in advance

chichilalescu commented 6 years ago

I can't go through the package now, but I'll see what examples we have and let you know. as far as I can remember, I did put in the functionality.

chichilalescu commented 6 years ago

I've added an example with commit caf32a60e46138a550c5923a973897f1f29de759. Basically there's a method of the libJHTDB objects that returns trajectories, at a desired density of samples in time. Please let us know if you'd like more explanations with the code.

chichilalescu commented 6 years ago

One more comment: the relevant method is defined in pyJHTDB/libJHTDB.py at line 253. It's an almost direct call of the C function itself, with some minor tweaking for the sampling. The important bit is that if a finely spaced trajectory is desired, this will be more expensive.

alexlib commented 6 years ago

Thanks a lot.