« What's up with the UoB clocktower... | Main | An afternoon walk at Fish Creek »

Degrees to steradians

I quite often find myself wanting to convert from square degrees to [steradians] (SI unit
for solid angle), its simple but I waste too much time doing it (just recalling if its pi/180 or the otherway etc), so I've wrote a PHP function to do it - [deg2sr.php]. Oh, I've also wrote a python implementation of this:

#!/usr/bin/python 
#usage: deg2sr.py -v 0  #convert square degrees to steradians.
import string, sys, math, scipy, numpy, pylab, os
from numpy import *
values_pass = sys.argv[2:]  #return value passed to script
deg = (double(values_pass[0]))
sr = ((pi/180)**2)*deg
print deg, sr

Simply copy this and save it and run as deg2sr.py -v 10 (where 10 is the number of square degrees).

TrackBack

TrackBack URL for this entry:
http://www.krioma.net/cgi-bin/mt_new/mt-tb.cgi/445

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

About

This page contains a single entry from the blog posted on May 14, 2010 4:55 AM.

The previous post in this blog was What's up with the UoB clocktower....

The next post in this blog is An afternoon walk at Fish Creek.

Many more can be found on the main index page or by looking through the archives.

Get Firefox! Valid XHTML 1.0! Valid CSS! RSS Feed BlogUniverse - listed Powered by Apache Creative Commons License ringsofsaturnrock's Most Interesting Photos on Flickriver

Powered by
Movable Type 3.33