lsqfitics
Wrapper of lsqfit for computing various information criteria, particularly those listed in arXiv:2208.14983 [stat.ME], using vegas.
A python noteboook for plotting points and lines, expressly written for making spacetime diagrams. To get started with a tutorial, launch the binder instance of the notebook.
The purpose of this repo is to abstract away the details of creating a plot in matplotlib
, a module which is notoriously tricky for first-time users (especially those with little or no programming experience). For instance, per the documentation, here is about the simplest plot one can make using matplotlib
.
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
# Data for plotting
t = np.arange(0.0, 2.0, 0.01)
s = 1 + np.sin(2 * np.pi * t)
fig, ax = plt.subplots()
ax.plot(t, s)
ax.set(xlabel='time (s)', ylabel='voltage (mV)',
title='About as simple as it gets, folks')
ax.grid()
plt.show()
A simple matplotlib plot |
This “simple example”, however, is already too complicated for our purposes – we’re only interested in plotting lines and points. To that end, let’s plot a couple line. Recall that a line can be specified by either (1) a pair of points or (2) a point and a line. Suppose we’re interested in plotting two lines with slope $-0.5$, one passing through $A = (1, 2)$ and the other passing through $B = (1, -1)$. Using matplotlib
, we cannot directly plot this line – instead, we must convert this description of a line into a collection of points, which can then be plotted via matplotlib.pyplt.plot
.
Using either the code in this repo or matplotlib
, we should get the following plot.
Two lines, a grid, and a legend |
Here is the matplotlib implementation.
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
# Determine range
xlim = (-5, 5)
# Line a
m_a = -0.5
A = (1, 2)
label_a = 'a'
# Line b
m_b = -0.5
B = (1, -1)
label_b = 'b'
# Convert description to arrays
for label, m, P in zip([label_a, label_b], [m_a, m_b], [A, B]):
b = P[1] - m *P[0]
x = np.linspace(xlim[0], xlim[1])
y = m *x + b
# Actually plot the line
plt.plot(x, y, label=label, lw=2)
# Format plot to look nice
plt.xlim(xlim)
plt.ylim(xlim)
plt.gca().set_aspect('equal')
plt.minorticks_on()
plt.tick_params(direction='in', which='both')
plt.grid(which='major', alpha=0.7)
plt.grid(which='minor', alpha=0.2)
plt.legend(bbox_to_anchor=(1, 1), loc='upper left', prop={'size': 16})
plt.axhline(0, ls='--')
plt.axvline(0, ls='--')
plt.grid()
plt.show()
Compare with the much simpler implementation in this repo.
from plotter import plot_diagram
# Change these
xlim = (-5, 5)
lines = [
('a', (1, 2), -0.5), # line a
('b', (1, -1), -0.5), # line b
]
# Make plot
plot_diagram(lines, xlim)
Of course, there are additional wrinkles to a matplotlib
approach that must be accounted for (plotting vertical lines, specifying a line by two points instead, plotting a single point). The matplotlib
wrapper plot_diagram
takes care of those issues for us.
Wrapper of lsqfit for computing various information criteria, particularly those listed in arXiv:2208.14983 [stat.ME], using vegas.
Sixth Plenary Workshop of the Muon g-2 Theory Initiative [PDF of slides]
Lawrence Berkeley National Lab [seminar] [PDF of slides]
PoS(Lattice2021) Volume 396 (2022) [arXiv:2201.01343]
Los Alamos National Lab [invited talk] [PDF of slides]
Chiral Dynamics 2021 bulletin [PDF of slides]
Graphical user interface for lsqfit using dash.
Lattice 2021 bulletin [PDF of slides]
Director’s review of the Nuclear Science Division [PDF of poster]
Python code for our scale setting analysis.
Phys. Rev. D 103, 054511 (2021) [arXiv:2011.12166]
American Physical Society bulletin [PDF of slides]
A python noteboook for plotting points and lines, expressly written for making spacetime diagrams. To get started with a tutorial, launch the binder inst...
Phys. Rev. D 102, 034507 (2020) [arXiv:2005.04795]
Python code for our $F_K/F_\pi$ analysis.