Implemeenting PDF in 6x9 format.
I did the work on chapter 1 just to start somewhere. Trying to make the book fit nicely on a 6x9 book format.
This commit is contained in:
parent
0d836c7e03
commit
335db298ff
1
.gitignore
vendored
1
.gitignore
vendored
@ -8,5 +8,6 @@ short.pdf
|
||||
book.ipynb
|
||||
*.tex
|
||||
*.toc
|
||||
book.pdf
|
||||
Kalman_and_Bayesian_Filters_in_Python.pdf
|
||||
book_files
|
File diff suppressed because one or more lines are too long
@ -2,6 +2,41 @@ import numpy as np
|
||||
import pylab as plt
|
||||
from matplotlib.patches import Circle, Rectangle, Polygon, Arrow, FancyArrow
|
||||
import book_plots
|
||||
import book_format
|
||||
|
||||
def plot_errorbar1():
|
||||
with book_format.figsize(y=1.5):
|
||||
book_plots.plot_errorbars([(160, 8, 'A'), (170, 8, 'B')],
|
||||
xlims=(145, 185))
|
||||
|
||||
def plot_errorbar2():
|
||||
with book_format.figsize(y=1.5):
|
||||
book_plots.plot_errorbars([(160, 3, 'A'), (170, 9, 'B')],
|
||||
xlims=(145, 185))
|
||||
|
||||
def plot_errorbar3():
|
||||
with book_format.figsize(y=1.5):
|
||||
book_plots.plot_errorbars([(160, 1, 'A'), (170, 9, 'B')], xlims=(145, 185))
|
||||
|
||||
|
||||
|
||||
def plot_gh_results(weights, estimates, predictions):
|
||||
n = len(weights)
|
||||
|
||||
xs = list(range(n+1))
|
||||
book_plots.plot_filter(xs, estimates, marker='o')
|
||||
book_plots.plot_measurements(xs[1:], weights, color='k', label='Scale', lines=False)
|
||||
book_plots.plot_track([0, n], [160, 160+n], c='k', label='Actual Weight')
|
||||
book_plots.plot_track(xs[1:], predictions, c='r', label='Predictions', marker='v')
|
||||
book_plots.show_legend()
|
||||
book_plots.set_labels(x='day', y='weight (lbs)')
|
||||
plt.xlim([0, n])
|
||||
plt.show()
|
||||
|
||||
|
||||
def print_results(estimates, prediction, weight):
|
||||
print('previous: {:.2f}, prediction: {:.2f} estimate {:.2f}'.format(
|
||||
estimates[-2], prediction, weight))
|
||||
|
||||
def create_predict_update_chart(box_bg = '#CCCCCC',
|
||||
arrow1 = '#88CCFF',
|
||||
|
5
pdf/6x9build_book.bat
Normal file
5
pdf/6x9build_book.bat
Normal file
@ -0,0 +1,5 @@
|
||||
copy /Y ..\01-g-h-filter.ipynb book.ipynb
|
||||
|
||||
ipython nbconvert --to latex --template book6x9 book.ipynb
|
||||
ipython to_pdf.py
|
||||
REM move /Y book.pdf book6x9.pdf
|
42
pdf/book6x9.tplx
Normal file
42
pdf/book6x9.tplx
Normal file
@ -0,0 +1,42 @@
|
||||
% Inherit from report
|
||||
((* extends 'report.tplx' *))
|
||||
|
||||
((* set cell_style = 'style_ipython.tplx' *))
|
||||
|
||||
((* block margins *))
|
||||
\geometry{verbose,papersize={6in, 9in}, tmargin=.5in,bmargin=.5in,lmargin=.5in,rmargin=.5in}
|
||||
((* endblock margins *))
|
||||
|
||||
((*- block in_prompt -*))
|
||||
\mbox{ }\\ \\
|
||||
{In [{}(((cell.execution_count)))]:}
|
||||
((*- endblock in_prompt -*))
|
||||
|
||||
((* block input scoped *))
|
||||
((( cell.source | highlight2latex )))
|
||||
((* endblock input *))
|
||||
|
||||
|
||||
((* block output_prompt *))
|
||||
\mbox{ }\\
|
||||
Out [{}(((cell.execution_count)))]:
|
||||
((* endblock output_prompt *))
|
||||
|
||||
|
||||
((* block docclass *))
|
||||
\documentclass{book}
|
||||
\setcounter{chapter}{0}
|
||||
((* endblock docclass *))
|
||||
|
||||
((* block preamble *))
|
||||
((* endblock preamble *))
|
||||
|
||||
((* block title *))
|
||||
\title{Kalman and Bayesian Filters in Python}
|
||||
\author{Roger R Labbe Jr}
|
||||
((* endblock title *))
|
||||
|
||||
((* block markdowncell scoped *))
|
||||
((( cell.source | citation2latex | strip_files_prefix | markdown2latex(extra_args=["--chapters"]) )))
|
||||
((* endblock markdowncell *))
|
||||
|
Loading…
Reference in New Issue
Block a user