In [33]:
%matplotlib inline
%load_ext autoreload
%autoreload 2
from CO2simulation import CO2simulation
import runCO2simulation as simCO2
import matplotlib.pyplot as plt
import numpy as np
import visualizeCO2 as vco2
import matplotlib as mpl
from display_notebook import css_styling
from IPython.display import Image
mpl.rcdefaults()
mpl.matplotlib_fname()
css_styling() # suppress matplotlibrc


The autoreload extension is already loaded. To reload it, use:
  %reload_ext autoreload
Out[33]:

Scalable Kalman filtering for Temporal-Spatial Analysis

  • ### Seismic monitoring of CO$_2$
    • State estimation
    • Time-series data
  • ### Methodology
    • Kalman filter
    • Scalability
  • ### Result Visit my GitHub page!

Track a CO$_2$ Plume from Sensor Measurements

Objective: monitor a CO$_2$ plume for $5$ days resulted from injecting $300$ tons of CO$_2$ at a depth of $1657m$.

  • The sensor measures the travel time of a seismic signal from a source to a receiver.

  • The presence of CO$_2$ slows down the seismic signal and causes travel time delay along a ray path.

  • Goal: interpret the changes in seismic signals into maps of moving CO$_2$ plume.


In [159]:
from IPython.html.widgets import interact, interactive, fixed
from IPython.html.widgets import FloatSlider
from CO2simulation import CO2simulation
def plot_CO2plume(time):
    import param as param
    CO2 = CO2simulation(param)
    x = CO2.extract_state(int(time/3))
    data = CO2.extract_data(int(time/3))
    fig_setting = vco2.getImgParam(param)
    vco2.plotCO2_data_map(x, data, 0, 20, fig_setting)
    plt.show()
    
interact(plot_CO2plume,
         time = FloatSlider(value=0, min=0, max=120));


Kalman filtering

  • Linear dynamic system, estimation, inference
  • Two phases:
    • Prediction
    • Update

Scalability Issues

  • Computationally prohibitive for large-scale problem
  • Store and update covariance matrix ($N^2$) at each Kalman step
  • Computational cost grows quadratically with $N$
  • $80$ days for a typical problem size ~1 million
Resolution Low Medium High
State dimension N = 3245 N = 3245 x 4 N = 3245 x 16
Run time 1.2 min 19 minutes 4.4 hours
Storage cost 100 MB 1331 MB 20 G

Scalable Kalman filtering

  • $\mathcal{O}(N)$: a linear computational complexity algorithm
  • Conventional dimension reduction algorithms (e.g.,PCA) truncates information
  • Lossless compression for a kernel covariance matrix
  • Hierarchical matrices approach efficiently explore the structure of a kernel matrix

In [146]:
vCO2.scale_barplot()


Results

                                    TRUE                             HIKF

Filter Design

By choosing an appropriate $Q/R$ ratio to optimize the filter preformance


In [186]:
# For low resolution case show KF is equivalent to HiKF
# Running the high resolution case using HiKF
def plot_CO2maps(theta):
    import param
    CO2 = CO2simulation(param)
    param.theta = (theta,1e-5)
    hikf, x_kf, cov_kf = simCO2.CO2_filter(CO2, param)
    fig_setting = vco2.getImgParam(param)
    vco2.plotCO2map(x_kf,cov_kf,fig_setting)
    plt.show()
    print "Theta            Variance"
    print " %d              %d" % (theta,np.sum(cov_kf[-1]))
    
interact(plot_CO2maps,
         theta = FloatSlider(value=1.14, min=1.14e-3, max=1.14e1));


  File "<ipython-input-186-e077fd813b98>", line 14
    interact(plot_CO2maps,
           ^
SyntaxError: invalid syntax

In [13]:
from IPython.display import Image
Image(filename='Q_R_ratio.png')


Out[13]:

Summary

Efficient tools to interprete the time-series data recorded in the seismic sensors into spatial maps of a moving CO$_2$ plume, a problem very similar to CT scanning widely used in medical imaging.


In [178]:
from moviepy.editor import *

olaf = (VideoFileClip("co2estimatefinal.avi")
        .subclip((0,1),(0,10))
        .resize(0.999))
olaf.write_gif("co2movie.gif")


[MoviePy] Building file co2movie.gif with imageio