Skip to main content

JUPYTER / More Interesting Modules

Turtle slowly walks in spiral in search for Zen of programming.

Over the weekend, I am again searching and exploring Jupyter Notebook in a heuristic fashion. I indeed found some interesting modules along the way that worth nothing, and as well discovering a few more *hickups*.

Basically, I have a need to find enough "visual" modules, probably under 10 modules, that give me starting tools so that I could create some interesting Image Output, in the way that Wolfram Language can.

Wolfram Lab Cloud indeed is powerful visually. I don't know how to explain, but being able to query Planets images (or all kind of stuff), and then seeing the list as image picture of some sort, then filtering the list or further scrambling the images... are brilliant.

So, I do have come to some realization that a lot of codes are to be required and studied in order to be able to make some of the "cool stuffs" that Wolfram can do much easier.

Yet, still, there is a good feeling of being able to do it using open source tools, even when the results are basics. Continue on searching for what I am looking for.

Soon, I will slow down and try to explore area that I am interested the most.

TIPS:

Installing Python module often is as simple as running "pip install" in the Command Prompt (Windows) or Terminal (Mac). If you are using Anaconda, it comes with a bundle of modules already pre-installed for you. You may need to run "conda install" for adding module.

MODULE: ipythonblocks

http://ipythonblocks.org/bcMjca

I have mentioned this one in the previous blog post. ipythonblocks should be a great starter easy basic exploration that give you output of visual colorful blocks. This is a good module to study before anyone attempting to jump into PIL or Pillow module for further image processing and dealing with bigger number of pixels.



NOTE:
For this ipythonblocks, if you like to export out image, you can use the save_image("output.png") method. But you need PIL/Pillow module to be loaded in order for this to work. So there is this can of dependency of module. Something to keep in mind.

Thanks to Matt Davis for this tip.

It was Mardi Gras over the weekend and I was coding at home!

MODULE: Turtle


Turtle is one of old drawing module from legacy Python 2.7, that can still work inside Jupyter. If you want inline output, you can use this mobilechelonian module. It does not have all the original Turtle methods, however, it can still work.

Installing modules can be as easy as typing this in Terminal, for this one you do this: 
pip install mobilechelonian 




MODULE: WordCloud

We all love word cloud.

Type this in Terminal: 
pip install wordcloud

Above should work, if you have all the requirements. I tested on Mac, it works.

However, I found that sometimes working in Windows, PIP stuff often fail to install. For the wordcloud module, I found out in Windows that I don't have Microsoft Visual C++ vcvarsall.bat (compiler). It is pretty dumb thing.

Working in Mac and Linux, and things tend to be smoother.

https://github.com/amueller/word_cloud
http://peekaboo-vision.blogspot.com.au/2012/11/a-wordcloud-in-python.html



MODULE: matplotlib

This one module should come pre-installed. If you have been using this Jupyter Notebook (was iPython Notebook) and reading lots of documentations, you will find matplotlib is used quite a lot. You will also find plotly module.
http://www.labri.fr/perso/nrougier/teaching/matplotlib/



You will find that matplotlib, together with numpy, and PIL will work together to give you the output inline inside Jupyter.
http://nbviewer.jupyter.org/gist/minrk/7076095
http://qiita.com/zaburo/items/5637b424c655b136527a


MODULE: NetworkX


matplotlib and plotly are quite big in itself.

Sometimes we also like to make flowchart or node graph, for that reasons, module like Network X should give you the tool you need.
http://networkx.readthedocs.org/en/networkx-1.11/overview.html


MODULE: ipywidgets

http://ipywidgets.readthedocs.org/en/latest/

I have not tested every widgets built in for Jupter. However, even by understanding the basic like slider widget can add a powerful interactivity that helps you to understand code.

Below I am using pythonblocks together with ipywidgets.


Below is similar with above, just to create checked pattern. I changed around the code like testing different RGB block color, but the point is for value that I make to interact, the result will be shown instantly, and this will explain the code better.



NOTE: 
I would love to be able to embed the Jupyter Notebook itself that is interactive into Blogger at some point. I need to search around for this information.

Turning a Notebook into HTML can be done quite easily following this blog post:
http://prooffreaderplus.blogspot.com.au/2014/11/how-to-quickly-turn-ipython-notebook.html



I supposed above are enough interesting modules. Should keep one busy, whether for purpose of turning data into some sort of visualization.

Perhaps there are modules that can do animation, etc. Maybe Processing Javascript can also be embedded inside Jupyter Notebook? Don't know yet.

Looks like with Jupyter Notebook, we are starting to see the future of narrative. Especially with example books by Google that cannot be printed.
https://editionsatplay.withgoogle.com/#/


MODULE: ipython.display


One more thing... actually a lot more things. IPython.display module itself can display and visualize inline inside the Notebook. This alone is worth exploring.

My old photo: "cat in the pot"

MODULE: Bokeh

Another plotting module with style.
http://bokeh.pydata.org/en/latest/docs/user_guide/quickstart.html

MODULE: Cairo

Well, it's not Processing, however, it let you draws complexity, if you dare.
http://cairographics.org/

TEXT TO SPEECH MODULE

http://pyttsx.readthedocs.org/en/latest/install.html
https://github.com/parente/pyttsx

Supposedly simple and straight forward to install and to use. I am using Windows 7, 64 bit and was using Python 3. But failed to run properly. I then switch to Python 2.7 environment and install the pyttsx and it works fine. Although in Windows, I only have the voice of Microsoft Anna. Will try this on Mac and see it has more voices.

Making computer speaking is easy, making it listen apparently could be interesting. Here link below takes you to a tutorial that uses "BitVoicer", good cheap server listener:
http://letsmakerobots.com/node/41226

I like this robotic video, a lot:
https://www.youtube.com/watch?v=xs0MVZD1LsI&feature=share

Fast forward....

3D VISUALIZATION USING BLENDER AND PYTHON

I don't know if Blender will every be possible to be under Jupyter Notebook. Maybe having something like Jupyter Notebook inside Blender will be a cool thing one day. That will be pretty weird interesting.

But, at some stage, I will focus on 3D visualization, and maybe working with Particles and Point Cloud to do 3D visualization. Interesting book:
http://www.cv.nrao.edu/~bkent/blender/thebook.html

Blender has Python Console running Python 3, and it has Text Editor built in already. So that is quite handy and helpful already:


Well I just tested something like below with numpy. Random 3 values array generated and visualized.

http://blender.stackexchange.com/questions/2407/how-to-create-a-mesh-programmatically-without-bmesh
http://blender.stackexchange.com/questions/5745/creating-a-geometry-from-a-python-array


So Blender, will be my Jupyter -> visualize 3D cloud way. Will see ...

Comments

Popular posts from this blog

PYTHON PROCESSING / It only really begins ...

Back into Processing again, with Python! While Daniel Shiffman is continuously inspiring us with his CODING TRAIN series on YouTube, using Processing with Java and Javascript language, I decided to free my mind and trying to really do something using Processing and Python language. Installing Python language version on Processing 3 is easy enough, just first download the latest Processing and install the Python language mode via Add Mode button. Other link that might help: https://github.com/jdf/processing.py http://py.processing.org/tutorials/ BLANK MODE As soon as Processing Python Mode, opens up and running I am presented with a  blank environment. Suddenly I recalled my journey in learning programming from zero until now... With Python, outside Processing, commonly people will be introduced to Python IDE or IDLE environment. Something that looks like Console Window or Command Prompt, where we type single liners command. Python Command Line and IDE normally have t

PYTHON / OpenCV, Recreate Uncanny Manga - Anime Style

Can you tell what it is? Computer Vision. Yesterday, I spend almost whole day exploring this opencv module using Python. What I discovered was revealing. Even at the very basic level, I could produce some interesting Image and Video manipulation using all the code collected from documentation and many, many blog tutorials. If you are a total noob like me, I am still getting used to knowing that the CV in OpenCV means Computer Vision! Actuallly, I recalled that I did try to get into OpenCV few years back ago, when I knew no Python and when Python opencv module was probably still early. It was all C++ code and it was a little bit too hard for me. I read a couple of books about opencv at the library, I did not understand a single thing. That was back then. Today, for strange reason, with a bit of knowledge of Python, I can go a little further. EDGE DETECT IN OPENCV Me holding you know what. What leads me this far is my curiosity on how we can replicate Wolfram Langu

WOLFRAM / Making Text With Rainbow Color

Continuing with my Wolfram Mathematica Trial Experience... I watched and went through some more Mathematica introduction videos, read lots of Mathematica documentation and also going through the Wolfram Lab Online again a few times. There are some major learning curves and Mathematica is a lot different from normal programming language. Sometimes there is a lot of interesting "shortcuts", say like: FindFaces[] , WordCloud[] . Sometimes I got a little confused on how one can do iterations. Normally FOR LOOP concept is introduced early, but in Wolfram, because everything is EXPRESSIONS and ENTITY (like OBJECTS), sometimes it gets quite quirky. Mind you I am still in the first impression and having to look at many tutorials. Lots of NEAT EXAMPLES from documentation, but sometimes I got lost. I found Wolfram to be really awesome with LIST and generating list. It's almost too easy when it works visually. I cannot explain them with my own words yet, but there are