Exemple #1
0
print "Cressman 1st - 3rd rms: %f" % misc.rms(cress1 - cress3)
print "Cressman 2nd - 3rd rms: %f" % misc.rms(cress2 - cress3)

#Cressman single pass for comparison with Barnes passes
cress_187 = oban.analyze_grid(data.heights, x_grid, y_grid, data.x, data.y,
  oban.cressman_weights, 1.87 * d)
diffs = oban.get_ob_incs(data.x, data.y, data.heights, x, y, cress_187,
  cressman_radius = 1.87 * d)
cress_187_rms = misc.rms(diffs)
print "Cressman 1.87d rms: %f" % cress_187_rms

#Do the list of 2-pass barnes analyses
gammas = N.array([1.0,0.4,0.2])
barnes_analyses = []
barnes_rms = []
kappa0 = oban.calc_barnes_param(d)
for g in gammas:
  field = oban.analyze_grid_multipass(data.heights, x_grid, y_grid, data.x, 
    data.y, 2, oban.barnes_weights, (kappa0, g))
  barnes_analyses.append(field)
  diffs = oban.get_ob_incs(data.x, data.y, data.heights, x, y, field)
  barnes_rms.append(misc.rms(diffs))
  print "Barnes 2-pass gamma=%.1f rms: %f" % (g, barnes_rms[-1])

#Do the barnes 3-pass
barnes_3pass = oban.analyze_grid_multipass(data.heights, x_grid, y_grid,
  data.x, data.y, 3, oban.barnes_weights, (kappa0, 1.0))
diffs = oban.get_ob_incs(data.x, data.y, data.heights, x, y, barnes_3pass)
barnes_3pass_rms = misc.rms(diffs)
print "Barnes 3-pass rms: %f" % barnes_3pass_rms
Exemple #2
0
import sys
import numpy as N
import pylab as P
import matplotlib as M
import oban

lam_star = N.linspace(0,10,100)
delta_n = 2.30564
L = 2 * delta_n
lam = lam_star * L
kappa0 = oban.calc_barnes_param(delta_n)

D0 = N.exp(-kappa0 * (N.pi / lam)**2).reshape(-1,1)
gamma = N.array([1.0, 0.4, 0.2]).reshape(1,-1)
D1 = D0 * (1.0 + D0**(gamma - 1.0) - D0**gamma)
D2 = D0 * (1.0 + (1.0 - D0) + (1.0 - D0)**2)

P.plot(lam_star, D0, '--', label=r'$D_0$')
specs = ('c', 'y', 'r')
for ind, g in enumerate(gamma.flatten()):
  P.plot(lam_star, D1[:,ind], specs[ind], label=r'$D_1, \gamma =%.1f$' % g)
P.plot(lam_star, D2, '-.', label=r'$D_2$')

P.xlabel(r'$\lambda/\rm{L}$')
P.ylabel('Filter Response')
P.title('Comparison of Barnes Filter Response Functions')
P.legend(loc = 'lower right')

if len(sys.argv) > 1 and sys.argv[1].startswith('silent'):
  P.savefig('response_funcs.png', dpi=300)
else: