Skip to content

Instantly share code, notes, and snippets.

@bryan-lunt
Created December 22, 2014 18:04
Show Gist options
  • Save bryan-lunt/25163c390005bd3e03b3 to your computer and use it in GitHub Desktop.
Save bryan-lunt/25163c390005bd3e03b3 to your computer and use it in GitHub Desktop.
Calculate Telescope properties
import scipy as S
import pylab
#My Cheap Telescope
APPERTURE = 0.114
FOCAL_LENGTH= 0.910
#http://en.wikipedia.org/wiki/Visible_spectrum
min_visible = 380e-9
max_visible = 750e-9
#http://en.wikipedia.org/wiki/Luminosity_function
SCOTOPIC_PEAK = 507e-9 #The peak of the low-light luminosity function. Usually you use this if you are looking in a telescope
PHOTOPIC_PEAK = 555e-9 #The peak of the daylight luminosity function.
def plank_law(L,T):
"""
Plank's Law for the radiation density of a black-body or cavity radiator.
L because Lambda is a reserved word in Python
T for temperature in Kelvins
http://en.wikipedia.org/wiki/Planck%27s_law
http://en.wikipedia.org/wiki/Stefan%E2%80%93Boltzmann_law
"""
h = 6.62606957e-34#Plank's Constant
k = 1.3806488e-23#Boltzmann's Constant
c = 299792458.0 #Speed of light in a vacuum
density = (8.0*S.pi*h*c)*S.power(L,-5.0) * S.power(S.exp(h*c*S.power(L*k*T,-1.0))-1.0, -1.0)
return density
def myarange(start,stop, numstep=100):
return S.arange(start, stop, stop/numstep)
def angular_resolution_at_wavelength(aperture, L):
"""
Calculates the best theoretical angular resolution for a given aperture and wavelength (L).
http://en.wikipedia.org/wiki/Angular_resolution
"""
return S.arcsin(1.220*L*S.power(aperture, -1.0))
def rad_to_deg(R):
return R*180.0*S.power(S.pi,-1.0)
temps = [3000,4000,5778, 6000]
#fig = pylab.figure()
#x = myarange(0.0, 3e-6,100)[1:]
#for T in temps:
# pylab.plot(x,plank_law(x,T))
#pylab.show()
#realy, the arcsin here is just for the principle of the thing. At this tiny angles, the sin is roughly the angle(in radians)
fig = pylab.figure()
x_vis = myarange(min_visible, max_visible,100)
y_arcsec = rad_to_deg((angular_resolution_at_wavelength(APPERTURE, x_vis)))*60.0*60.0
pylab.plot(x_vis, y_arcsec)
pylab.axvline(SCOTOPIC_PEAK)
pylab.axvline(PHOTOPIC_PEAK)
pylab.show()
Rayleigh_Limit = rad_to_deg((angular_resolution_at_wavelength(APPERTURE, SCOTOPIC_PEAK)))*60.0*60.0
print "Theoretical Resolution (Rayleigh): %f\"" % Rayleigh_Limit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment