[IPython-dev] Efficient way to render Javascripts

Brian Granger ellisonbg@gmail....
Sat Jun 15 10:14:21 CDT 2013


Right now (today) the best way is to use the Javascript object along
with the display function.  However, starting in late summer we will
be improving this API so it may change some, but all for the better...

Cheers,

Brian

On Fri, Jun 14, 2013 at 11:33 PM, TARUN GABA <tarun.gaba7@gmail.com> wrote:
> Hi,
>
> I am wondering on what method would be more efficient to serve
> Javascripts on IPython notebooks
>
> I need to visualize/simulate multibody dynamics, and there are two
> methods which are in my mind.
> The rough API of the project is being formed at ..
>
> http://pydy.org/visualization
>
> the two methods are:
> 1) Via http requests:
>
>   on calling something like ..
>
> myobject.visualize(numerical_data)
>
> The browser sends a POST request to the kernel, and python methods
> send a POST request to the required javascripts alongwith POST
> parameters as the numerical data required for visualization, most
> likely a 4*4 transformation matrix, and shape information.
> the Javascripts recieves the post and then it is displayed in the
> IPython output cell.
>
> 2) Another method can be to make Javascript objects and save them as
> text in the classes,
> something like ..
>
> def MyClass():
>
>     def __init__(relevant,args):
>         self.js_data = ''' A call to the Javascript functions,
> alongwith arguments..
>                              var myobject =
> Shape_creating_function(%s)'''%(args)
>
> and then on calling ..
> MyClass.visualize()
>
> from IPython notebook, first calling all the required
> javascripts(files) via publish_javascript()/publish_html() display
> methods and then
>
> display(Javascript(MyClass.js_data))
>
> Which of these would be more feasible and efficient..
> _______________________________________________
> IPython-dev mailing list
> IPython-dev@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev



-- 
Brian E. Granger
Cal Poly State University, San Luis Obispo
bgranger@calpoly.edu and ellisonbg@gmail.com


More information about the IPython-dev mailing list