Displaying posts tagged with

“Python”

Friday Odds and Ends

So things have been busy in non-blog land. Putting together a tenure packet, some travel, teaching, and oh yes, even science. So no insightful post here, just some odds and ends I collected, in no particular order: There are quite a few species named after famous people: alive, dead, real or fictional.  Wikipedia has a […]

Wasting time with Google Trends

  It seems like the forces of light have triumphed somewhere around September 2006: …as have their evil counterparts, April 2009:     bacteria are neck-in-neck with humans:     But they beat the largest creatures on Earth:     Of course, you can’t beat cats:      

Stupid Python tricks, #3296: sorting a dictionary by its values

Suppose you have a dictionary mydict, with key:value pairs mydict = {‘a’:5, ‘b’:2, ‘c’:1, ‘d’:6} You want to sort the keys by the values,  maintaining the keys first in a list of tuples, so that the final list will be: [(‘c’,1), (‘b’,2), (‘a’,5), (‘d’,6)] aaaand, the stupid Python trick involves a nested list comprehension: sorted_list […]

A Belated Valentine’s Day Post

This is romantic!  So listen up! A 3D heart shape may be drawn using the following implicit function: Or, in Python: def  heart_3d(x,y,z): return (x**2+(9/4)*y**2+z**2-1)**3-x**2*z**3-(9/80)*y**2*z**3 Trouble is, there is no direct way of graphing implicit functions in Python. But anything can be found on Stack Overflow. Putting it all together: #!/usr/bin/env python from mpl_toolkits.mplot3d import […]

Brainf**k while waiting for a flight

Warning: NSFW language. Brainfuck is a Turing-complete programming language consisting of eight commands, each of which is represented as a single character. > Increment the pointer. < Decrement the pointer. + Increment the cell at the pointer. – Decrement the cell at the pointer. . Output the ASCII value of the cell at the pointer. […]

Warren DeLano

For those who are not in the structural biology community: Warren DeLano wrote and maintained PyMol, the software of choice for molecular visualization. Practically anyone who published anything requiring a biomolecular image used PyMol. It is a great piece of software, powerful and extensible. Warren was strongly committed to writing quality product that served the […]

Ten years of coding with the snake

Biopython is entering its 10th year; the unofficial birthday is on September, since that is when the mailing list started: September 1999. I stumbled onto that list mid-September, 1999. I believe the Python version was 1.5, I was still working on SGI Irix, and I was an 0.3 PhD candidate. Today I am coding with […]

Genetic Algorithms

XKCD appeals to my geeky humor side. Also, as a staunch Pythoneer, I cherish the occasional Python reference. To complete the trifecta, I just saw T2 for the umptieth time two days ago.