Question: is it possible to recreate such functionality with python? http://itools.subhashbose.com/grapher/index.php
Backstory: We want to create a hybrid online teaching/computational resource for undergraduate students of our institute, running on a local server. I have worked only in matlab, and have fair bit experience in c++. so wanted to choose appropriate language (preferably open source, but not strictly) which can facilitate above functionality with mathematica cdf like properties. I wanted to learn python form long time so wanted to know if it can do the job. Dont want to use javascript (which i suppose is used in this page).
For fetching data from html have a look at this site: http://docs.python.org/2/howto/urllib2.html.
If you want to built your own site, there are small web frameworks like flask and bottle. If you are interested in a more comprehensive web framework, check out Django: http://www.djangoproject.com/.
Matplotlib could be used to generate the plot e.g. in jpg or svg. The latter might give you the option to have the image respond to e.g. hovering over specific parts of the plot like in your example page.
Maybe also have a look at https://pypi.python.org/pypi/django-chart-tools. From their webpage:
django-chart-tools is a simple app for creating charts in django templates using Google Chart API.
Related
Im starting a new project for personal porpuse!
Im working personally in finance, I decided to create personal chart viewing software to suit my needs. I thought I'd create a good part of the backend in Python as it is a language I know quite well. Use Javascript for the graphic side, and use a webview in a windows form to make everything available as if it were software.
As for the graphics I thought of using: Lightweight Library for JS, I find that today it is the most avant-garde library compared to the classic plotly, matplotlib.
Use pywebview as a bridge between Python and JS and to redirect everything in a windows form.
However I find it a bit difficult to use this library (pywebview), there is a poor documentation around and not very clear to me (my level of JS is really basic). However, I believe it is one of the most convenient solutions.
I would have thought of using pyscript, but it still seems early to use this library in production.
Questions:
Do you think such a job is feasible?
Do you know other libraries/better solutions to do such jobs?
What kind of approach would you use if you were to do such work?
What I am trying to achieve is to write most of the functions in python and use only JS to make calls through buttons or to get data from various inputs.
Wandering around the web I found a work already partially created by this guy (if you are reading, Thanks Filipe you have been very helpful! here you can see his project hosted on Github) but unfortunately it is difficult for me to get my hands on a code not produced by me.
I'm currently developing a Django app that allows students to programmatically develop SVG graphics. They can code Python in their browser with ACE editor. The code is executed on the server, stored in a database and the generated SVG (custom library) returned and displayed. An example code that displays a filled ellipse looks like so:
graph.draw(Circle(cx=0, cy=0, r=20, fill="lime").scale(2, 1)
Now I'm wondering, how I could extend this app to do some 3D. I stumbled over X3Dom, which seems promising and not too hard to generate and I could write another lightweight pythonic library for this. But, it doesn't seem to do CSG (constructive solid geometry) which is major drawback.
Any hints in what direction I should investigate for some 3D web technology that allows easy 3D scene generation with server-side python and that implements CSG?
NB: OpenJSCad is simalar to what I'd like to achieve, except that my solution allows for classroom collaboration and it must expose Python to students as the programming language. The aim is to spice up the teaching of Python programming with graphics.
I believe I used three.js to do CSG a while back. There used to be an example online. You are right that X3D does not do CSG. I was doing cross sections of the earth and found a way with X3D. You might be able to use VPython or brython in the browser if your worried about Python not running in the browser. I’ve only brython for a short time testing another person’s project and vpython not at all.
If you’re doing something like inverseCSG or CSGNet, is your class available online?
In other words, maybe try to find a Python library that does CSG instead searching for a rendering engine in JS. Don’t view the browser as limited to JS.
I only found three.js when I was looking.
Maybe search for a solution which is not a solid solution.
try checking out the library "trimesh" for python which relays mainly on watertight stl files, but allows you to do some boolean operations for CSG. You can substract one file from the other, extended and find the intersection. Plus, it has some primitive functions directly like cylinders and spheres.
This is definitely the most vague question I have asked on SO but I hope it will not be too heavily frowned upon.
I recently started a project for the company I am interning at this summer. The task is to test traffic between two servers using the program iperf.
Long story short: I am successfully able to run the tests, get the data (saved as a txt file), and generate graphs all in python (company specification of language).
My question for all is how can I create a webpage to store this information via python? The webpage would not need to be complicated by any stretch of the imagination. What I am imagining is that every time a test case is run it adds a link to a "homepage" once the user clicks on that link they will have the test results. Test results would be something along the lines of the graphs (perhaps in iframes?) and the txt file (also in an iframe?). Nothing exciting.
I am extremely lost on how to even start something like. Any and all guidance would be helpful.
I think what you're looking for is a templating engine for Python. Jinja2 is a good example of one.
Jinja2 is a full featured template engine for Python. It has full
unicode support, an optional integrated sandboxed execution
environment, widely used and BSD licensed. source
You could pull the test data into Python and generate a dashboard-style webpage with it. If you're looking for something more powerful, take a look at Flask, which is a microframework and uses Jinja2, and combine it with Highcharts
I have a live feed of data that represents network traffic for a remote machine. I would like to take this data and visualize it in a live plot in my webapp that is using Django, What is the easiest and fast way to achieve this.
What I tried so far: Generating scatter plots using matplotlib and updating the .png image on the webapp
Use RRDTool:
RRDtool is the OpenSource industry standard, high performance data logging and graphing system for time series data. RRDtool can be easily integrated in shell scripts, perl, python, ruby, lua or tcl applications.
Some examples including web-based system monitoring applications of RRDTool:
http://oss.oetiker.ch/rrdtool/gallery/index.en.html
http://snm.sourceforge.net/
http://munin-monitoring.org/
A good option (I know from first hand experience) is using the Ajax update method with the Flot js library to plot live updating graphs. +1 for simplicity, extensible options, plugins and for the MIT license.
Look at an example here http://people.iola.dk/olau/flot/examples/ajax.html
Cheers!
In the past when I've had to plot data in a browser, I've used jqPlot. You could set javascript up to periodically poll a url on your django app that returns JSON encoded data to plot.
I just discovered impure.com and was very impressed by what can be achieved in terms of visualizing data using their workspace. Although the platform is free to use, but not open source yet. This causes a few problems because the API section works with .com sites for eg. for ebay, so I cannot visualize ebay listings for regional sites such as ebay.in because the link to ebay.com is hardcoded.
I searched around, but didn't find other projects that offer a similar way to work with site APIs and other data sources with the kind of user interface and detail that impure.com does in a realtime way within a browser window.
This brings me to the questions:
What technologies would be involved in creating a similar kind of project
What are the open source tools that can help develop a fullscreen UI to render the workspace. Are there any alternatives to flash for this, and how do they compare
The goal would be to use standard python data structures, python scripts to do some processing on these data structures, scripts to gather data from csv, json and API sources such as google yahoo, wikipedia and flickr, and scripts to render graphs, tag clouds, network visualizations etc. Then bring them all together into a visual interface that supports drag drop and simple type checking
How would the python backend integrate with the UI
sorry for the rambling question, but i wanted to present as much detail as possible. I'd like to do this for the fun of it
So, restating, Impure is like OpenDX but running in a browser and you are interested in suggestions for an architecture to build your own web version of it?
I suggest using Cappuccino as your front end Web GUI. This is a toolkit for building RIAs in the browser that are completely based on HTML and Javascript (no Flash). It is modeled after Apple's Cocoa so you can build some very sophisticated apps with it.
On the web server side, I would use the Python bindings to OpenDX to build a JSON API that is exposed to the web browser. Note, this Python module uses DXLink, which appears to be mainly a batch/command interface to OpenDX - you might still need to do some work to get visualizations out of it and back to the web browser. But, it's all open source so it should be feasible. Here's a discussion where others are attempting the same thing.
I don't know for sure that OpenDX supports pulling data via web service calls but you could certainly handle that on the Python side and feed it into OpenDX.
Note, I don't mention a Python web framework because, since your app will be mostly a JSON API almost any of them would work just as well. I suggest the thinnest and simplest one that appeals to you.