In [1]:
%pylab
from brawl4d.brawl4d import B4D_startup


Welcome to pylab, a matplotlib-based Python environment [backend: Qt4Agg].
For more information, type 'help(pylab)'.
/Library/Frameworks/Python.framework/Versions/7.2/lib/python2.7/site-packages/matplotlib/__init__.py:908: UserWarning:  This call to matplotlib.use() has no effect
because the the backend has already been chosen;
matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time.

  if warn: warnings.warn(_use_error_msg)

In [2]:
from datetime import datetime
panels = B4D_startup(basedate=datetime(2013,6,6))

In [3]:
# redraw
def redraw():
    from stormdrain.pubsub import get_exchange
    get_exchange('SD_bounds_updated').send(panels.bounds)

In [4]:
from brawl4d.LMA.controller import LMAController

lma_ctrl = LMAController()
d, post_filter_brancher, scatter_ctrl, charge_lasso = lma_ctrl.load_hdf5_to_panels(panels, '/data/20130606/LMA/LYLOUT_130606_030000_0600.dat.flash.bk.h5')


found flash data

In [5]:
#panels.panels['tz'].axis((3*3600, 3*3600 + 0.5*60, 0, 20))
panels.panels['tz'].axis((10805.7, 10806.3, 0, 15))
panels.panels['xy'].axis((-105, -85, -10, 10))


Out[5]:
(-105, -85, -10, 10)

After adjusting the lower bound on station count below, it's necessary to trigger a reflow of the data down the pipeline. You can do this by dragging the plot to adjust the view bounds. Instead, you can also hook into the event machinery to notify that something changed.


In [26]:
lma_ctrl.bounds.stations=(6,99)
redraw()

In [8]:
charge_lasso.charge=1
panels.lasso()

In [6]:
chg = d.data['charge']
wh = np.where(chg > 0)
print d.data[wh]['time']


[ 10805.93215797  10806.02808732  10806.03125458  10806.03154387
  10806.02802381  10806.02626833  10806.01181749  10806.01325117
  10806.02293201  10806.02390299  10805.91438668  10805.9148208
  10805.91492005  10805.97290485  10805.91516207  10805.9142367
  10805.91286845  10805.94910203  10805.94822611  10805.94711127
  10805.9458203   10805.94555017  10805.91037354  10805.91114943
  10805.91138489  10805.99273142  10805.99394959  10805.99443437
  10805.99673448  10805.98889177  10806.00059668  10805.99752533
  10805.98870497  10805.97238815  10805.97350988  10805.96861204
  10805.96586561  10805.96158797  10805.96143     10805.95784797
  10805.97622374  10805.97904491  10805.95709668  10805.98715861
  10805.95617252  10806.00124316  10806.00150719  10805.95039603
  10806.00980618  10806.01150051  10806.00297038  10806.00438956
  10806.00481819  10806.00565804  10806.00758911  10806.00763239
  10806.0090358   10805.9526621   10806.00914832  10805.91533174
  10805.91936255  10805.91594507  10805.91630432  10805.92060359
  10805.9204685   10805.92671691  10805.92637986  10805.94252771
  10805.91590135  10805.93901733  10805.93889009  10805.93684221
  10805.93676358  10805.93669601  10805.93579948  10805.93560968
  10805.93547927  10805.93287609  10805.92175055  10805.92144506
  10805.97333809]

In [21]:
scatter_ctrl.color_field = 'chi2'
redraw()

In [22]:
current_data = charge_lasso.cache_segment.cache[-1]
scatter_ctrl.default_color_bounds.flash_id =(current_data['flash_id'].min(), current_data['flash_id'].max())
scatter_ctrl.color_field = 'flash_id'

redraw()

In [7]:
scatter_ctrl.color_field = 'time'
redraw()

In [6]:
anim=scatter_ctrl.animate(5, repeat=False)

In [9]:
anim.repeat = False # stops the animation if repeat=True above

If the LMA controller found flash data, then it's possible to get a live update of flashes in the current view


In [6]:
current_events_flashes = lma_ctrl.flash_stats_for_dataset(d, scatter_ctrl.branchpoint)


1 of 1 flashes have > 10 points. Their average area = 241.9 km^2
1 of 1 flashes have > 10 points. Their average area = 241.9 km^2

In [6]:


In [ ]: