Skip to content

Commit

Permalink
Merge pull request #23 from kmnhan/dev
Browse files Browse the repository at this point in the history
Added new interface for fitting, see #22 for discussions.
Made loader argument optional for `erlab.io.loader_context` so it can be used to just change the data directory.
Momentum conversion has been rewritten using `xarray.apply_ufunc`, and is now dask-compatible. It also automatically determines the current energy axis (kinetic or binding).
  • Loading branch information
kmnhan authored Apr 22, 2024
2 parents 3304a18 + 156cef8 commit 4514a23
Show file tree
Hide file tree
Showing 52 changed files with 3,787 additions and 1,981 deletions.
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ qtpy
igor2>=0.5.6
ipywidgets
ipython
-e git+https://github.com/kmnhan/erlabpy.git#egg=erlab
-e .
57 changes: 56 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
# -- Imports -----------------------------------------------------------------

import importlib.metadata
import inspect
import os
import sys

import pybtex.plugin
import pybtex.style.formatting
Expand Down Expand Up @@ -37,7 +39,7 @@
"sphinx.ext.autosummary",
"sphinx.ext.napoleon",
# "sphinx_autodoc_typehints",
"sphinx.ext.viewcode",
"sphinx.ext.linkcode",
"sphinx.ext.mathjax",
"sphinx.ext.intersphinx",
"matplotlib.sphinxext.plot_directive",
Expand All @@ -61,6 +63,58 @@
# nitpicky = False
# nitpick_ignore = [("py:class", "numpy.float64")]

# -- Linkcode settings -------------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/extensions/linkcode.html


# based on numpy doc/source/conf.py
def linkcode_resolve(domain, info):
"""
Determine the URL corresponding to Python object
"""
if domain != "py":
return None

modname = info["module"]
fullname = info["fullname"]

submod = sys.modules.get(modname)
if submod is None:
return None

obj = submod
for part in fullname.split("."):
try:
obj = getattr(obj, part)
except AttributeError:
return None

try:
fn = inspect.getsourcefile(inspect.unwrap(obj))
except TypeError:
fn = None
if not fn:
return None

try:
source, lineno = inspect.getsourcelines(obj)
except OSError:
lineno = None

if lineno:
linespec = f"#L{lineno}-L{lineno + len(source) - 1}"
else:
linespec = ""

import erlab

fn = os.path.relpath(fn, start=os.path.dirname(erlab.__file__))

return (
f"https://github.com/kmnhan/erlabpy/blob/"
f"v{version}/src/erlab/{fn}{linespec}"
)


# -- Autosummary and autodoc settings ----------------------------------------

Expand Down Expand Up @@ -131,6 +185,7 @@
"iminuit": ("https://scikit-hep.org/iminuit/", None),
"cmasher": ("https://cmasher.readthedocs.io/", None),
"ipywidgets": ("https://ipywidgets.readthedocs.io/en/stable/", None),
"joblib": ("https://joblib.readthedocs.io/en/latest/", None),
}


Expand Down
16 changes: 12 additions & 4 deletions docs/source/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@ reflected in the package without having to reinstall it. Before installing:

.. hint::

| If using conda, replace :code:`mamba` with :code:`conda`.
| If on Apple silicon, replace :code:`environment.yml` with :code:`environment_apple.yml` to use `Accelerate <https://developer.apple.com/accelerate/>`_ instead of `OpenBLAS <https://en.wikipedia.org/wiki/OpenBLAS>`_.
If using conda, replace :code:`mamba` with :code:`conda`.

.. code-block:: sh
Expand Down Expand Up @@ -152,8 +151,7 @@ Updating the editable installation

.. hint::

| If using conda, replace :code:`mamba` with :code:`conda`.
| If on Apple silicon, replace :code:`environment.yml` with :code:`environment_apple.yml`.
If using conda, replace :code:`mamba` with :code:`conda`.

.. code-block:: bash
Expand Down Expand Up @@ -305,6 +303,16 @@ Code standards
super().__init__()
self.setupUi(self)

- Please try to add type annotations to your code. This will help with code completion
and static analysis.

- Although it would be great to enforce static type checking, our code base currently
does not pass the tests. It would require a large amount of work to get it to pass, so
we are not enforcing it at the moment, and it is unclear whether the extra effort is
worth it. See `this article
<https://typing.readthedocs.io/en/latest/source/typing_anti_pitch.html>`_ for some
reasons to avoid static type checking.

Documentation
=============

Expand Down
1 change: 0 additions & 1 deletion docs/source/erlab.parallel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@

.. autosummary::

is_notebook
joblib_progress
joblib_progress_qt
5 changes: 2 additions & 3 deletions docs/source/getting-started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ Getting Started
Installing
==========

The recommended way to install ERLabPy is via `conda
<https://docs.conda.io/en/latest/>`_. If you do not have conda installed, follow
the :ref:`installation instructions <Installing conda>`. Once you have a working
The recommended way to install ERLabPy is via conda. If you do not have conda installed,
follow the :ref:`installation instructions <Installing conda>`. Once you have a working
conda environment, you can install ERLabPy with the conda command line tool: ::

conda install -c conda-forge erlab
Expand Down
101 changes: 56 additions & 45 deletions docs/source/refs.bib
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
@article{dynes1978dynes,
author = {Dynes, R. C. and Narayanamurti, V. and Garno, J. P.},
title = {Direct Measurement of Quasiparticle-Lifetime Broadening in a Strong-Coupled Superconductor},
journal = {Phys. Rev. Lett.},
volume = {41},
number = {21},
pages = {1509-1512},
doi = {10.1103/PhysRevLett.41.1509},
year = {1978},
type = {Journal Article}
}

@article{he2017mingrad,
author = {He, Y. and Wang, Y. and Shen, Z.-X.},
title = {Visualizing dispersive features in 2D image via minimum gradient method},
journal = {Rev. Sci. Instrum.},
volume = {88},
number = {7},
pages = {073903},
doi = {10.1063/1.4993919},
year = {2017},
type = {Journal Article}
}

@article{hoyer2017xarray,
title = {xarray: {N-D} labeled arrays and datasets in {Python}},
author = {Hoyer, S. and J. Hamman},
journal = {J. Open Res. Softw.},
volume = {5},
number = {1},
year = {2017},
publisher = {Ubiquity Press},
doi = {10.5334/jors.148}
}

@article{ishida2018kconv,
author = {Ishida, Y. and Shin, S.},
title = {Functions to map photoelectron distributions in a variety of setups in angle-resolved photoemission spectroscopy},
Expand All @@ -10,16 +45,14 @@ @article{ishida2018kconv
type = {Journal Article}
}

@article{seah1979imfp,
author = {Seah, M. P. and Dench, W. A.},
title = {Quantitative electron spectroscopy of surfaces: A standard data base for electron inelastic mean free paths in solids},
journal = {Surf. Interface Anal.},
volume = {1},
number = {1},
pages = {2-11},
issn = {0142-2421},
doi = {10.1002/sia.740010103},
year = {1979},
@article{tusche2015spin,
author = {Tusche, Christian and Krasyuk, Alexander and Kirschner, Jürgen},
title = {Spin resolved bandstructure imaging with a high resolution momentum microscope},
journal = {Ultramicroscopy},
volume = {159},
pages = {520-529},
doi = {10.1016/j.ultramic.2015.03.020},
year = {2015},
type = {Journal Article}
}

Expand All @@ -39,6 +72,19 @@ @inproceedings{schirra2008polygon
type = {Conference Proceedings}
}

@article{seah1979imfp,
author = {Seah, M. P. and Dench, W. A.},
title = {Quantitative electron spectroscopy of surfaces: A standard data base for electron inelastic mean free paths in solids},
journal = {Surf. Interface Anal.},
volume = {1},
number = {1},
pages = {2-11},
issn = {0142-2421},
doi = {10.1002/sia.740010103},
year = {1979},
type = {Journal Article}
}

@article{zhang2011curvature,
author = {Zhang, P. and Richard, P. and Qian, T. and Xu, Y.-M. and Dai, X. and Ding, H.},
title = {A precise method for visualizing dispersive features in image plots},
Expand All @@ -50,38 +96,3 @@ @article{zhang2011curvature
year = {2011},
type = {Journal Article}
}

@article{he2017mingrad,
author = {He, Y. and Wang, Y. and Shen, Z.-X.},
title = {Visualizing dispersive features in 2D image via minimum gradient method},
journal = {Rev. Sci. Instrum.},
volume = {88},
number = {7},
pages = {073903},
doi = {10.1063/1.4993919},
year = {2017},
type = {Journal Article}
}

@article{hoyer2017xarray,
title = {xarray: {N-D} labeled arrays and datasets in {Python}},
author = {Hoyer, S. and J. Hamman},
journal = {J. Open Res. Softw.},
volume = {5},
number = {1},
year = {2017},
publisher = {Ubiquity Press},
doi = {10.5334/jors.148}
}

@article{dynes1978dynes,
author = {Dynes, R. C. and Narayanamurti, V. and Garno, J. P.},
title = {Direct Measurement of Quasiparticle-Lifetime Broadening in a Strong-Coupled Superconductor},
journal = {Phys. Rev. Lett.},
volume = {41},
number = {21},
pages = {1509-1512},
doi = {10.1103/PhysRevLett.41.1509},
year = {1978},
type = {Journal Article}
}
Loading

0 comments on commit 4514a23

Please sign in to comment.