  Electronic transport is at the heart of many phenomena in condensed matter
physics and material science. Magnetic imaging is a non-invasive tool for
detecting electric current in materials and devices. A two-dimensional current
density can be reconstructed from an image of a single component of the
magnetic field produced by the current. In this work, we approach the
reconstruction problem in the framework of Bayesian inference, i.e. we solve
for the most likely current density given an image obtained by a magnetic
probe. To enforce a sensible current density priors are used to associate a
cost with unphysical features such as pixel-to-pixel oscillations or current
outside the device boundary. Beyond previous work, our approach does not
require analytically tractable priors and therefore creates flexibility to use
priors that have not been explored in the context of current reconstruction.
Here, we implement several such priors that have desirable properties. A
challenging aspect of imposing a prior is choosing the optimal strength. We
describe an empirical way to determine the appropriate strength of the prior.
We test our approach on numerically generated examples. Our code is released in
an open-source \texttt{python} package called \texttt{pysquid}.
