Friday, October 29, 2010

Seminar on clouds


Yesterday, I gave a seminar talk to our department faculty and students, titled as "An Aerosol - Cloud Condensation Nuclei and Cloud Droplet Concentration Closure Study" that is summarizing a majority of my thesis related work on aerosol and cloud micro-physical research, starting and finishing with the presentation slides shown above and at the very end of this post.

One of the most exciting parts of the talk was after I finished demonstrating my research results and showed a few of the technicalities of the research. First of all, thanks go to Dr. Jefferson R. Snider for providing his IDL-based parcel model code and being patient with me while I was re-writing the model in Python. Both versions of the code could be accessed through ccnworks by browsing the source tab, and looking under the thesis folder or alternatively, directly contacting to Dr. Snider to get the latest updated version of the model.

When I was working on the model conversion, at one point I had stuck getting similar outputs from the two languages using the same initial conditions, and with the almost identically progressing code. (Some might object on the definitions of two conditions' being "the same" and "almost identical" in the land of high-precision floating point arithmetic.) Continuing in my numerical instability problem, I had created a simple animation to better demonstrate the issue I was experiencing. As some eyes might easily catch, the droplets in parcel model reaching to so bigger sizes comparing to the results produced by IDL, solely based on condensational growth theory. It took a while to find and correct the variable that was updating its original reference while it was supposed to be operating on a copy of the content instead. This issue and a few other discrepancies were fixed in around May 2010. As a personal important todo note at this point is to restructure the parcel model code so that it behaves as an external library, thus making all the important thermodynamical and cloud micro-physics related functions greatly re-usable. This is when I figure passing dictionaries (or changing the structure of the code) to outer scope of the original file that they are declared in.

The final technicality demonstration comes from the work of Dobashi et. al., (2008) (Their "Feedback Control of Cumuliform Cloud Formation based on Computational Fluid Dynamics" titled work.) Those are by far the most realistic cloud appearances I have ever seen in a physical cloud formation processes applied simulation study. Although cloud modellers are usually interested in studying temporal and spatial statistical properties of clouds rather than synthesizing their realistic shapes and appearances, such a similar work would have a great educational use in visualising and thus better demonstrating the physical processes governing the cloud formation and further precipitation development. I can say that the authors should have prototyped their simulations using a C-like language in order to make low level access to CPU/GPU because of the high computation demands, but there are fast computation techniques available in Python that would make this undertaking possible to be realized be it simulating a research flight or playing in between sequences of a simulation to probe important properties of the formation.

For the curious, I share high-quality PDF version of the slides. Note that I had to take out a couple pages from this original presentation in order to fit 45 minutes allocated presentation time, and it was unfortunate that one of the expected audience was not in the classroom to see a few indistinguishably minute research unrelated points. All analyses and plots in my slides are performed/created using Python and its scientific tool-stack with some additional annotation help from OpenOffice on the slides using DejaVu-Sans font; for the first time with full consistency. There is one exception to the pure Python code, that is when the Python based model calculations taking up five to ten times more than the original IDL-based code, and that is where exactly Cython magic were sought and applied to boost million-times executed functions. Here, I greet the community once more, for making the scientific computation freely, publicly, and easily available to everyone without putting any restrictions in both code and verbal discussions level as how this core work should really be in its very essence within the science endeavor.

I also salute Matthew Turk and his work for that fantastic presentation style even though I couldn't copy his great architectural design throughout my slides. Yet not him, I have other masters around me for letting me embrace Tufte's sayings :)

My work on clouds is on-going and leading me to a PhD level research after successful completion of my Masters thesis within the next month. Feel free to say hi or ask more clouds if you share any research similarities.

Now, it is time for some abstraction: Youth Uprising - Rarefaction

Please keep up imagination and creativity flames are burning all along...

Tuesday, October 19, 2010

Vim magic2 - search and replace in visual selection

Since I thought making generic analysis and plotting routines would have been harder for 8-9 different source airborne data, I am showing some pure uniqueness and laziness of variable name selections on the given screenshot. Like in many cases VIM is here to my rescue :) First we switch to line selection mode by Shift-V combination and highlight the area of interest and then hitting ":" and continuing typing by s/06/08/g in the command insertion area. The magic is done --all the "06" instances are replaced by "08"s readying the code for our April08 case.

Thursday, October 14, 2010

Vim magic: Synchronized scrolling


As shown in this screen capture, I have two minor modifications to my original closure-fitting code. The original code runs using the lab PCASP size ranges and excluding the first PCASP channels data, "zair-fit" version uses the field calibrated PCASP size bins, and still excluding the first two channels. The final file "zair-fit2" runs the code with the size bins and including the pseudo-problematic first two channel PCASP concentration data.
VIM provides me a very practical way to synchronized scrolling of all open windows so that I can easily compare the results from those well-formatted table structure outputs. Solution is simple: execute the following line in each window as shown in this blog entry.
:set scrollbind

Wednesday, September 1, 2010

Damlalar her yerde

Evet, hepsini içmek serbest hatta kendi sıvınızda dahil. Olur ya kurak bir yerde mahsur kalarsınız diye Les Stroud’un Kalahari çölündeki bölümünü izleyebilirsiniz ya da burda kalıp okumaya devam ederek kendinize banyo yaparken soracak yeni sorular edinebilirsiniz.

Duş almaktan söz ediyoruz ya, ilk soru şöyle belirdi: sıcak bir duşta, pek bir havalandırması olmayan bir odanın içinde, yukarıya lamba tarafına doğru bakınca havada asılı danseden bir sürü parçacık göze çarpıyor. Gerçektende havada asılı duran parçacıklar, üfleyince bile uçuşuveriyorlar. Soruyorum, bu parçacıklar ne ölçüde aktifleşmiş? İçerideki ortam hangi oranda neme doymuştur? Sonraki soru bir şekilde banyo duvarına ya da perdesine sıçramış parçacıkların büyümesini, süzülüşünü ve diğerlerine karışıp akıp kaybolmasını izlerken aklıma geliyor. Çok sayıda küçük damlacık ve az sayıda büyük parçacık. Gamma ve Marshall-Pallmer dağılımları ne kadar doğru tanımlamakta bu parçacık dizilimini? (Diğer dağılımlara Kolmogorov–Smirnov testi yapmak isteyen?) Son sorularsa en ilginci. Bu kez damlacıkların üstümden sıçramasını izlerken düşünüyorum ve seyre dalıyorum. Çarpan yüzeyden seken damlacıklar (bu durumda benim omzum) ne şekilde parçalanıyor ve nasıl bir yörünge takip ediyor, ne zaman sonra çiseleyerek yere doğru düşüyor ve ne kadarı buharlaşıverip ya da yan duvarda kümeleşen parçacıklara yapışıp etkisiz hale geliyor?

Ya bu kapta yoğunlaşan parçacıklara ne demeli? Nedir gerçekte onları bu şekilde dengede tutan? Nasıl bir etkileşimle öyle değişik şekiller alabilmekteler ve ne kadar büyümeleri gerekir tutundukları zeminden aşağıya kaymaya başlayıncaya kadar.

Bazıları Percy W. Bridgman’ın “Eğer ölçemiyorsak büyük ihtimalle ne demek istediğimizi bilmiyoruz” sözünü fazlasıyla dikkate alaraktan ya da Meinrat O. Andreae’nin bir konuşmasında alıntıladığı gibi “Gözlemleyerek öğrenmeyecek şey yoktur” sözünün büyüsüne fazlasıyla kendilerini kaptırdıklarından, yukarıdaki soruların bazılarının yanıtlarına ulaşmışlar gibi. Tabii bu bazıları dediklerim akışkanlar mekaniği ve yağış fiziği konularında ileri seviyede bilgisi olup dahası bu minik dünyalardaki hareketlilikleri çok yüksek hızlarda izleyebilecek araç-gerece sahip kişilerdir.

Böyle bir uğraşın sonucunda ortaya çıkanlar ise sadece bir su damlacığını analiz ederek yağmur damlalarının genel dağılımı hakkında bir görüye ulaşılabileceğini gösteriyor. (“Bilinen bir konu üstüne çalışarak, yeni bir olguyu keşfetme.” Bu alıntının nereden geldiğini çözemediyseniz sizi James Burke’nin “Evrenin değistiği gün” belgeselinin ilk bölümüne alalım.) Devam edersek, düşen yağmur parçacıklarının parçalanmaya başlamadan önce teorik olarak ulaşabilecekleri çapın en fazla 6-7 mm dolayında olabileceği (bazı istisnaları ile birlikte). En ilginci ise, her ne kadar Galileo zamanından beri bilinen ve yağış ile ilgili kaynaklarda damlaların belli bir hızın üstüne gidemeyeceği bilgisinin (en azından benim böyle bilişim) yerel olarak doğruluğunu yitirişi. Parçalanış esnasında anne damladan kopan parçacıkların tekrar dengeye ulaşıncaya kadar limit hızdan aşırı hızlarda hareket ediyor oluşu. Detaylarını merak edenler şu makaleyle devam edebilirler,  ya da şu bağlantıdan görüntülenmiş bir parçacığın dansını seyredebilirler.

Tuesday, June 29, 2010

Buradan karşısı daha mavi

    Yok yok, buranın karşısı değil. Bu taraf geçen haftanın macerası idi. Dağın maceracısı çokmuş: kimi normal yoldan çıkıp, bisikletle patikalardan inermiş, kimileri de dağdan aşağıya atıyor kendini paraşüte güvenip :) 

    Evet işte o tepelerin ardı deniz. Şehir bir dağ ile bir tepe arasında alabildiğine uzanmış. Ne güzel bir gün öncesinden karşı taraf kendini açıkça gösteriyordu, fakat oradan dağa bakınca pek açık bir görüntü almak mümkün olmadı. Kirlilikten mi desem, buluttan mı yoksa bulut olamamış parçacıklardan mı desem dağ kendini göstermedi ertesi günü. Yandan uzanan el bana gidilecek tarafları gösteriyor: Gündoğdu, oradan aşağı Kurşunlu, sonra yan yan Mudanya.
(Son cümle tamamlanamadan bir bölünme oldu, annem tarafından ekmek ve yufka almaya gitmem gerekçesiyle, yazı bekler patatesler kızarıyor neticesinde :) Ben yolda, acaba diyorum şimdi Texas'daki SciPy10 eğlencesinde olmak nasıl olurdu diye söyleniyorum kendi kendime, ya da Oregon'daki Bulut Fiziği konferansında geziniyor olup, poster sunmak, makalelerde ve kitaplarda adlarını gördüğümüz kişilerle karşılaşıp iki laf yapmak hiç fena olmazdı.)

    Karşısı yalnızca daha mavi değil, ayrıca daha da yeşil. Yol boyu isteyene zeytinlik, sahibine incirlik, yoldan geçenine çamlıklar dizili. Kimi dut vardı, kimi erik, şeftali, armut yemek isteyenine. Ara ara çeşmelerde vardı yol boyunda, ama su içmek isteyeni dağa çıkmalı...

    Bu resmi yukarıdakinin önüne koyunca körfeze baktığımız anlaşılıyordur sanırım. Aslında tepeden denize inince kanoya tekneye binip karşı tarafa kürek çekmek vardı. Belki ileride; tepeler yeşilini, deniz de mavisini korumaya devam ederse...

    Her inişin bir çıkışı varmış. Gerçi bisikletler güzel güzel poz verse de, elde taşındılar epeyce. Özellikle bu çıkış dağa çıkışın çok benzeri, yalnız bir farkla; burası 5-10 dakikada tükenip yine aşağıya akıyor, fakat dağ yolunda buna benzer en az 100 tanesi aşılmayı bekleyen. 

    Bu sefer N900'ün şarjı tam doluydu yola çıkmadan. Bizim gezi yaklaşık 10 saat sürsede hem resimler hem de yol koordinatları bu kez bir aksiliğe uğramadılar. Bu yukarıdaki Runsaturday sitesinden; GPS olunca gezi daha başka bir hal oluyor. Gerçi yol boyu halinden memnun olmayanlar olsa da, bol iniş-çıkışlı ve bol manzaralı, yine son dönüş kısmı geceye kalan eğlenceli bir bisiklet turu oldu. 

Friday, June 25, 2010

A is for Acceleration

    I was reading the comments for Best Way To Publish an "Indie" Research Paper? entry on Slashdot. Then I have jumped to The Journal of Irreproducible Results. Somehow I have ended up meeting the Annals of Improbable Research magazine. Among the titles I semi-randomly clicked on their March-April 2007 Theoretical Figures issue. "Stress Analysis of Gawn" has kept me busy for a little while (keeping my comments private, no worries) Here comes a part of the poem in the same issue. See the free PDF if you are curious to read the rest...
You’d think there were enough. You’d think
There were no need for tricks.
The letters of our alphabet
Seem plenty— twenty-six.

The choices should be obvious
When making letters stand
For quantities of physics. Well,
Things weren’t quite that well-planned.

The quantities are many, 
And the letters not enough.
Some choices feel intuitive,
But some feel off-the-cuff.

Yes, some are fairly obvious,
But others feel make-do.
In case you have forgotten, kids,
Let’s do a quick review.

A is for acceleration.
B, magnetic feld.
C is for the speed of light
That prism tests revealed.

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.

A Comparison of Measured and Predicted Cloud Condensation Nuclei (CCN) Concentrations

I presented my research on Tuesday at the University of North Dakota 2010 Scholarly Forum. Although a lot has changed from the original abstract I still provide it here for the curious. (Follow the links to access the PDF slides and the code and data.) Once I achieve the closure on the lab data I should be able to easily extend the similar methodology onto our field data.


Abstract:

    Research on CCN helps us to understand cloud and precipitation formation in a local scale and resolving the indirect aerosol effects on a global perspective. Following the conclusions of similar studies which emphasize the particle size distribution's being the biggest impactor on cloud nucleation ability of aerosols, and accounting for the chemical composition with the hygroscopicity parameter in κ-Köhler theory, a CCN closure study was performed. Measurements of the aerosol size distributions in the range of 0.1 to 3 μm is made by using a Passive Cavity Aerosol Spectrometer Probe (PCASP-100X), and the missing 0.01 to 0.1 μm range data is extrapolated with a spline interpolation technique. A two-parameter log-normal distribution is also estimated by fitting on the aerosol measurements including total aerosol particle concentrations measured by a Condensation Particle Counter (CPC - TSI-3771). Determination of the critical activation diameters is done by utilizing the κ-Köhler theory as proposed by Petters and Kreidenweis (2007). The closure resulted with the best R2=0.33 between the predicted and measured CCN concentrations at the 0.2% supersaturation (SS). Additional to this poor agreement, the concentrations obtained from the calculations under-predict the CCN concentrations over the full range of supersaturation measurements. The ground and airborne data from the spring 2009 Saudi Arabia field campaign are currently being analyzed.

Saturday, March 6, 2010

PCASP aerosol number-size distribution

Following the similar approach given in Chapter 8 "Properties of the Atmospheric Aerosol" [Seinfeld, J. H., and S. N. Pandis, 2006: Properties of Atmospheric Aerosol, in: Atmospheric Chemistry and Physics: From Air Pollution to Climate Change. 2nd ed. Wiley-Interscience] one can construct PCASP aerosol number-size distributions as shown in the figure.

 
The code used for this demonstration is given at pcasp_aerosol.py

Wednesday, March 3, 2010

Record number of equations

Chapter 7 "Collection Growth" of "Cloud and Precipitation Microphysics - Principles and Parameterizations" (Jerry M. Straka, 2009, Cambridge University Press) has 278 numbered equations. Other chapters follow:

238 in Chapter 2 "Foundations of microphysical parameterizations"

206 in Chapter 5 "Vapor diffusion growth of liquid-water drops"

These are the highest number of equations I have seen so far listed in a textbook.

Saturday, February 27, 2010

Bubbles in a bottle

 
If Mayavi can do it, so does nature...

Friday, February 19, 2010

Weird clouds on Wired magazine


Some interesting looking clouds are shown on Wired with brief explanations about their formations.

I spotted Mammatus clouds and Kelvin-Helmholz waves after I have started looking up into the sky with an increased curiosity. I posted a few of them on my Picasa...

Friday, February 12, 2010

Py4Science: a Starter Kit



This is a great collection of resources from Fernando Pérez (research scientist at the Helen Wills Neuroscience Institute at U.C. Berkeley) for those who want to try Python for Scientific Computing.

Sunday, February 7, 2010

Random particles in a cube

 

Gamma-size distributed randomly placed particles using MayaVi.

Friday, January 29, 2010

Fedora is about Freedom

“Freedom, Friends, Features, First”
 
The four foundations of Fedora.

Sunday, January 24, 2010

Sage - open source mathematics software



Sage is a free open-source mathematics software system licensed under the GPL. It combines the power of many existing open-source packages into a common Python-based interface.



My words on Stories page:

Sage is one of the well designed approaches to blur the boundaries among being a user, developer and contributor in the open-source ecosystem. Probably I will be hanging around for a long time be it bugging, complaining, documenting, adding content and eventually digging into source codes ;)