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)) 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).