Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
| Download
Project: test
Views: 91872from __future__ import print_function1import io2import IPython.nbformat as nbformat3import sys4from formatting import *567def merge_notebooks(outfile, filenames):8merged = None9added_appendix = False10for fname in filenames:11with io.open(fname, 'r', encoding='utf-8') as f:12nb = nbformat.read(f, nbformat.NO_CONVERT)13remove_formatting(nb)14if not added_appendix and fname[0:8] == 'Appendix':15remove_links_add_appendix(nb)16added_appendix = True17else:18remove_links(nb)19if merged is None:20merged = nb21else:22merged.cells.extend(nb.cells)23#merged.metadata.name += "_merged"2425outfile.write(nbformat.writes(merged, nbformat.NO_CONVERT))262728if __name__ == '__main__':29f = open('book.ipynb', 'w', encoding='utf-8')30'''merge_notebooks(31['../00_Preface.ipynb',32'../01_g-h_filter.ipynb',33'../Appendix_A_Installation.ipynb'])'''3435merge_notebooks(f,36['../00-Preface.ipynb',37'../01-g-h-filter.ipynb',38'../02-Discrete-Bayes.ipynb',39'../03-Gaussians.ipynb',40'../04-One-Dimensional-Kalman-Filters.ipynb',41'../05-Multivariate-Gaussians.ipynb',42'../06-Multivariate-Kalman-Filters.ipynb',43'../07-Kalman-Filter-Math.ipynb',44'../08-Designing-Kalman-Filters.ipynb',45'../09-Nonlinear-Filtering.ipynb',46'../10-Unscented-Kalman-Filter.ipynb',47'../11-Extended-Kalman-Filters.ipynb',48'../12-Particle-Filters.ipynb',49'../13-Smoothing.ipynb',50'../14-Adaptive-Filtering.ipynb',51'../Appendix-A-Installation.ipynb',52'../Appendix-B-Symbols-and-Notations.ipynb',53'../Appendix-C-Walking-Through-KF-Code.ipynb',54'../Appendix-D-HInfinity-Filters.ipynb',55'../Appendix-E-Ensemble-Kalman-Filters.ipynb'])565758