Monday, June 21, 2010

On my way to the summit

    This is the story of my unsuccessful attempt to reach to the peak of Uludağ on Saturday, June 19. I had to give up my ascent about 200 m below the summit. I had to give up because I ran out battery on my N900 where I was logging my coordinates, communicating with my family down in the city of Bursa, and capturing all those beautiful moments that I came across along the way. To my luck, the battery died just at the point where I photographed the little summit without being saved to the device memory. Coincidentally, this was the point where I stopped climbing any further.
    I was readying myself to greet Erden Eruç from the top for his amazing solo journey. Along with him, I was going to send some special messages to a few people in my life, and to a few that I have met in the last couple of years in my life. Unfortunately I couldn't touch the sky from the summit; I couldn't keep the sun up for two more hours nor managed to last my batteries to document all my progress. However I managed to got back home safely; without being eaten by wolves or birds while biking in the dark from the mountain top to the almost downtown area. I returned with beautiful stories and beautiful pictures. Sometimes reaching the destination isn't all about, but it is the journey what matters most (What!, you haven't read the Alchemist yet?).
    Here on, the real story begins. We started ascending (me and my bike in the same cabin) in a famous aerial tramway. I spent about 8$ for one-way two stage trip for both myself and the bike. It takes about 15-20 minutes without to reach up to Sarıalan and as seen in the above picture the trip is highly scenic but a scary one especially if you feel fear from looking down high heights.
This is the Sarıalan plateau, and also showing where I was heading to. Although the mini-buses on the front was waiting for passengers to go to the hotels region, I have passed my chance for  the next time to experience the scenery as closely as possible and to mimic Erden's style a bit. The sub-motivation of this trip was to see if the white looking parts on the slope of the summit was really snow packs or some sort of rocks. 
    Wasn't I right? It is all green in between lovely bird songs. This was one my most beautiful biking path I have ever taken. Although after less than a kilometer pedaling the slope of the road got steeper, I reached to a point that I was after in about 3 km more biking.
    Finally, my bike is at the crossroad. It is actually my cousin's bike. I stressed the bike probably more than what its manufacturer had done on it. Through wet or dry, bumpy or straight, rocky or sandy roads, day or night and blazingly fast or turtle slow, in climbing or descending it never broke down, and never had me to touch on it once. Thank you Bisan, you really know how to make a durable mountain bike at very affordable prices.
    Water water everywhere, and all drops for drinking. This was another pure joy moment. I should have stopped my climb after washing my head under this fridge cold spring. I know of myself being content with small things most of the time. Apparently, this was not of those moments. I ended up continuing upwards and instead the bike carrying me I had to carry it on the very harsh roads.  On the way up there was many small creaks flowing downwards conveniently freeing me from carrying water. I gave about 4-5 water breaks. Could those be any signs of melting rocks? :)  Although the nature was very generous to water me any time I needed, there wasn't much to eat around the grass and on trees.

    
    Here comes the challenges. I felt like playing the latest Prince of Persia game when I came by these missing bridges. The trail was getting rougher; partially eroded by the flowing water mostly, and covered by rocks at its particular places. The first pass was the easier one, since the columns were as if specially designed for bikers in mind. When I came to the next one, I paused for a moment and Damian Walter's clip started playing in my head, immediately.  I saved this part for him; one wrong move could have stranded me there. I took the easier path and walked around the bridge by spending 2 extra minutes, refreshing myself once again from that fresh snow water. 
    This photo was my final summit capture. It was taken about half an hour before I reach my bridge challenges. At point A, I left my bike behind departing from the trail a bit uphill. It took me about another half an hour to get to the point B.  If "C" had located on one down the right, I would have continued and touched there in a good one hour in spite of lack of all the supplies. I saw two hikers and a car parked on one hill along the way. Definitely, I would camp somewhere on the hills if I had enough equipments and companied by a good friend. 
    And a bonus sunset. I was lucky enough to see double suns appearing in the sky. I should improve my ability to interpret universe's language. (Haven't I mentioned somewhere above about the Alchemist?) When the nature has sent me omens like above I should have been wiser and not to turn my back at them. Clearly, one of the suns (illusion or not) was setting and telling me it's time to go back home. 
   After about three hours ascent, in almost an hour I managed to return to the hotels region safely. Only at one point, I was stopped by a watchdog and had to veer off to bushes. I was not sure whether the dog was leashed or not. He barked a few times and stepped a few feet towards me, while I was backing up at the same time. Later on, I stopped for a short snack break. 
    It was after 45 minutes fast descent, when I called my dad to pick me up by the İnkaya sycamore about 10 minutes biking distance before I could reach to the downtown. (You still don't know the story of the Alchemist starts by a sycamore? :)  Through the dark, water splash, wind whispering, dog barking, car lighting, and half moon lit ways my 25-30 km descent was completed within 45 minutes, slowing down at a few points but without ever once stopping. It could be argued if it was smart to take this adventure alone at night, but one thing is for sure; there is a lot to learn facing the darkness. In case someone still wonders, this bike proved me once again that a bike's most essential feature is its tires turning unceasingly when one most needs them to be.    
    Final words are taken from a verse attributed to Imam al-Shafi which I heard in the The Man Who Walked Across the World titled documentary made for the Islamic seyyah Ibn Battuta:



         Travel! Set out for pastures new
                                 Life tastes richer when you have road-worn feet.
                No water that stagnates is fit to drink,
                 For only that which flows is truly sweet.

Friday, April 16, 2010

Celebrating the first year of IPython logging

It was last year today when I first started logging my IPython sessions explicitly using Pierre Raybaut's idea. All you need to do is just to make the changes/additions described in this piece of documentation (Logging to a file) on its soon-to-be-change LP repository. (Applies to IPython 0.10 and below)

You get a time-stamped log file (in your ~/ipython/ or wherever your IPython home directory is set at) created per day that looks like below:

#!/usr/bin/env python
# 2009-04-16.py
# IPython automatic logging file
# 13:15
# =================================
d = loadtxt(file, skiprows=30)
plot([d[i][8:] for i in range(12)])
# =================================
# 14:08
# =================================
boxplot(d[:][8:])

As of writing this entry I count almost 300 separate logs and combining them into one file using this little script yields about 37.5 k-lines (including lots of multiple entries, time-stamps, empty comments, many copy-paste codes that I haven't actually typed in)

Besides having this combined file as a rough measure for myself there is another good use for it as triggered with this question: How to exit IPython properly? IPython internal history file forgets what was in the session if you accidentally or intentionally kill your IPython session without issuing an Exit at the exit :) That new combined history file comes to our help.

First we will append all the time-stamp logs into one file (rename it to "history" so that IPython can load it at the start-up) Then from iplib.py comment the readline.set_history_length(1000) line to prevent 1000 lines limit in your history file. Now I can access all my previous coding history from within IPython again no matter how I end my sessions. (Providing that I will stitch my logs periodically)

Lazy coding at its best!

It would be great if IPython could handle history lines more smartly to read multiple lines back properly. Who knows maybe an IPython super user has a solution for that laziness as well.

By the way anyone knows how to remove duplicate lines from a file without actually sorting it?

Monday, April 5, 2010

GVIM+IPython with Conque plug-in

Here is an alternative way to bridge (G)VIM and IPython applications. GVIM is my editor-of-choice and IPython is a great interactive Python interpreter. If you are a user of these two environments, this simple integration technique could greatly boost your programming / prototyping speeds.

First go to conque (Thanks to Nico Raffo for the plug-in and helping me to include IPython functionality in it) page and install the plug-in following the simple installation instructions. (In my Fedora 12 system, I pulled the latest tar.gz package from the download list section and extracted it under ~/.vim folder.) Next grab the latest conque_term_pylab.vim file from the same section and place under ~/.vim/plugin directory.

When you open a simple Python script you can easily launch an "IPython -pylab" instance by hitting F6 and execute the whole script content by F8, use F9 to send a visual selection. The IPython inside the buffer acts as a part of GVIM, so you can easily switch between buffers and copy/move text from/to buffers. You can modify the IPython switch, default window position, mapped keys editing conque_term_pylab.vim

The screenshot below shows the bridge in action:


Hint: Add the following line into your vimrc file to get equally spaced buffer windows independent of the main GVIM window size.

autocmd VimResized * wincmd =

Currently only %run magic of IPython is implemented. Here are some of the ideas that could be added to improve this IPython + VIM integration:
  • Add %whos key-mapping
  • Launch IPython -pylab on start-up automatically if a Python script is opened.
  • If "run" command is sent before an IPy launched instantiate one automatically.
  • Make sure only one instance of IPython is running!
  • GUI integration, create GVIM menus, reading %whos values back into a separate window and changing values.
These last points could be well achieved by working on PIDA project. It is very possible to have an VIM + IPython powered IDE that is especially suited towards scientific use.

Saturday, April 3, 2010

Scenes from under a microscope window

This photo is showing about 40 μm dry soda lime glass microspheres. They are perfectly spherical indeed. We use these particles to calibrate optical particle detectors e.g. Forward Scattering Spectrometer Probe (FSSP) The picture with less beads shows even tinier particles -- I will say sizes down to 5-10 μm from the same bottle. However these are the smallest sizes it gets from the microscope we used. It is not possible to detect by eye the sphericity of microspheres from the 2.1 μm bottle.

The microscope we used is a Nikon SMZ-U (Zoom 1:10) Unfortunately, our efforts were not successful in trying to show the more sphericity of Ammonium Sulfate {(NH4)2SO4} particles than Salt (NaCl) crystals. We definitely need a powerful electron microscope to confirm this riddle. See the rest of the images at my Particles titled Picasa album.
PS: In one of the pictures the hands belong to Julia Beard. Without those hands it would take me a day to finish this work. Thanks Julia for your patience and tolerating my never-ending requests.
PPS: This posting has really nothing to do with Dream Theater's Scenes from a Memory album :)

Tuesday, March 16, 2010

Where you can't code...



Please don't have the feeling that a research aircraft isn't one of the places where you can't code comfortably :) This blog is more to do with post-philosophical investigations of the title.

This is one of the times that my programming literacy is to no avail to perform the research task ahead of me.

The problem is simply defined: Find the time-ranges where the research aircraft was sampling at cloud-bases.

What about the data-set?
About 37 hours of airborne data-set from the Saudi Spring 09 atmospheric measurement campaign. It contains aerosol and cloud micro-physical data and atmospheric state parameters from at least 10 different probes, listing over 100 different measured variables (e.g. pressure altitude, cloud condensation nuclei concentration, 2D images of ice-cloud particles.) We also recorded some of the flights from take-off to landing for nostalgia purposes and mainly aiding us while performing post-flight studies.

I get these ideas half-way through my manual exploration of the data-set. Many measurements are helpful in this analysis (e.g. air-dew point temperatures to determine where clouds are forming, the state of the aircraft in a given time-series plot, amount of liquid water content to distinguish in and out of cloud conditions, and most valuably in my opinion is visual observation from the recorded videos) helping me to infer when actually the aircraft was sampling right underneath a cloud in a level path.

This is part of my job and at the core of my thesis work. Even tough I complain little about the situation I get paid for what I am doing right now. My complaints are mostly for, in spite of all that rich data-set I am the one eventually making that final informative decision after manually and cautiously going through the data at hand. Far from being generic or universal. Good luck to myself if I need to extend the analysis for another airborne data-set :) I wish I had taken much wiser notes instead of trying to spot the most interesting occurring cloud of the day.

To complicate the analysis to a bit further level: not only find the cloud-base measurements also find the consecutive vertical passes of that same cloud in an automated fashion. No, not the one on its left nor the one on the right.

I am counting months backward for my graduation. Probably I won't have much time to see a breakthrough in AI research till then as mentioned in this article: How Long Till Human-Level AI?

Monday, March 15, 2010

Simple animation of UWyo CCN counter chamber








After modifying my Random particles in a cube example with Mayavi's @animate decorator I can get this simple animation which I use to demonstrate particle growth inside the device chamber. 

The Chemistry department of our school hosting a two-days Air Pollution Workshop for the neighbourhood high-school students. As a part of "Aerosol Particles" lab I am giving a demonstration about "Cloud Condensation Nuclei (CCN)" and University of Wyoming designed CCN counter.

The example is really the simplest it gets since it is designed for high-school students to little better appreciate the particle growth in a sealed chamber. There are many improvements could be made on this animation to make things much closer to what they are in reality. Such as:
  • Particle locations should be depicted in a cylindrical space inside of a cube as given in this example. 
  • Animation could be run in parallel with the counter by simply reading the status of the device through its serial port. (i.e., reading TWAIT, FLUSH, CCN_DETC status)
  • A GUI could be added to control parameters of the instrument. (e.g., setting its supersaturation)
  • Hot top-plate and cold bottom-plate could be drawn on newly created cylindrical chamber and supersaturation could be modelled and shown.
  • Different continuous distributions could be added. (For now the particles are gamma distributed -using NumPy's gamma distribution function.)
  • Instead of growing all the particles activation could be modeled more realistically (i.e. simply via κ-Köhler theory.) and applying condensational growth equation.
  • Particle interractions could be included (e.g. gravitational settlings, collisions in between particles etc...)
  • Particle detection could be modelled employing the Mie scattering theory.
This list could be expanded with many other considerations. Some are easy to implement, some really takes a while to achieve. Before I move further it is a good idea to read Dr. Snider's Supersaturation in the Wyoming CCN Instrument article while I have chance to spend time with the counter. In case you are curious about the code just follow the ccnanim.py link. Yes, all this buzz have been 33 lines of code. That's what you get when start coding with Python.

*
The bottom left photo is courtesy of Dr. David Delene (The photo should have been taken in one of Mali precipitation enhancement campaigns.) The bottom right one is courtesy of Dr. Manfred Wendisch in his Airborne Physical Measurements: Methods and Instruments lecture notes.

Thursday, March 11, 2010

Py4Science @ University of North Dakota


On my second attempt to popularize Python and its scientific computing ecosystem I volunteered to introduce interested people in an interactive tutorial session as a part of the University of North Dakota 2010 Scholarly Forum program. The Graduate School kindly helped and supported me for this one-of-a-kind interactive presentation in the Forum history.

The session was advertised on the Scholarly Forum web-page and e-mails were circulated throughout the campus spreading the session information. The first half-hour of the tutorial was spent installing and demonstrating the PythonXY, Enthought Python Distribution [EPD] and Sage via the notebook interface. After introducing the Python language we briefly went over the most fundamental members of the Py4Science family; IPython, NumPy, SciPy, Matplotlib, SymPy, and Enthought Tool Suite [ETS]. Along with the technical demonstrations I presented how developments are made in open-source environments and try to emphasize the blurring line of user-developer distinction in Py4Science habitat. I provided some selected resources for the attenders to their further study. I finished the tutorial by showing some advanced level examples demonstrating the powers of Python in scientific computing. Lastly, I invited everyone to the upcoming SciPy10 conference that will take place in Austin, Texas starting on June 28.

You can access the slides of the tutorial by clicking this link.


Acknowledgements:

Although the original title of the tutorial was "Python and Scientific Computing in Open-Source" I have chosen to use Py4Science name by following the Fernando Pérez's tradition. I am thankful to my faculty advisor David Delene for joining us and introducing me and telling us an exciting Python news from the European Aerosol-Cloud Research [EUCARI] group. Susan Caraher of the Graduate School helped me with some of the logistics of the session and Vicki Thompson of the Continuing Education department provided eight PythonXY installed laptops for our use. Thanks to Enthought for allowing us to use multiple copies of their EPD. Finally, I am indebted to Jarrod Millman for providing me some of the t-shirts from the previous SciPy conferences. His kind jest inevitably doubled the joy of my teaching experience.