Skip to content

Commit

Permalink
Merge pull request #72 from SMTG-Bham/bug-fix
Browse files Browse the repository at this point in the history
update from JOSS review 1
kbspooner authored Feb 23, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents 92e4e5e + 62959bf commit 5828797
Showing 33 changed files with 574 additions and 258 deletions.
24 changes: 12 additions & 12 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.. image:: figures/tp-logo-header.png
:alt: The ThermoParser logo, which looks like "TP"
:target: https://smtg-ucl.github.io/ThermoParser/
:target: https://smtg-bham.github.io/ThermoParser/
:align: center

.. code-block::
@@ -17,9 +17,9 @@
|____________________________________:_______________________/____________:_____/
.. image:: https://app.travis-ci.com/SMTG-UCL/ThermoParser.svg?branch=master
.. image:: https://travis-ci.com/smtg-bham/ThermoParser.svg?branch=master
:alt: The travis-ci badge
:target: https://app.travis-ci.com/SMTG-UCL/ThermoParser
:target: https://travis-ci.com/smtg-bham/ThermoParser

ThermoParser is a toolkit used to simplify the analysis of data
produced by specialist materials science codes, centred around
@@ -35,9 +35,9 @@ Click on the image to go to the `gallery`_!

.. image:: figures/wideband.png
:alt: A phonon dispersion where widened bands show phonon scattering
:target: https://smtg-ucl.github.io/ThermoParser/gallery.html
:target: https://smtg-bham.github.io/ThermoParser/gallery.html

.. _gallery: https://smtg-ucl.github.io/ThermoParser/gallery.html
.. _gallery: https://smtg-bham.github.io/ThermoParser/gallery.html

Installation
------------
@@ -46,7 +46,7 @@ ThermoParser can easily be installed with git and pip:

.. code-block:: bash
git clone https://github.com/SMTG-UCL/ThermoParser.git
git clone https://github.com/smtg-bham/ThermoParser.git
cd ThermoParser
pip install .
@@ -66,7 +66,7 @@ longer process is required:
2. ``python3 -m pip install cython numpy``
3. ``brew info hdf5`` to retrieve the path to your hdf5 install
4. ``HDF5_DIR=YOUR_HDF5_PATH --no-build-isolation h5py``
5. ``git clone https://github.com/SMTG-UCL/ThermoParser.git``
5. ``git clone https://github.com/smtg-bham/ThermoParser.git``
6. ``cd ThermoParser``
7. ``pip install --user -e .``

@@ -107,8 +107,8 @@ The best way to get a feel for ThermoParser is to see it in action:
Take a look at our `examples`_ and `tutorials`_. Currently supported
codes are:

.. _examples: https://github.com/smtg-ucl/ThermoParser/tree/master/examples
.. _tutorials: https://smtg-ucl.github.io/ThermoParser/tutorials.html
.. _examples: https://github.com/smtg-bham/ThermoParser/tree/master/examples
.. _tutorials: https://smtg-bham.github.io/ThermoParser/tutorials.html

* Phononic properties:

@@ -156,10 +156,10 @@ appropriate `examples`_, further `documentation`_ and `tests`_ are greatly
appreciated. Documentation uses the `sphinx`_ package, and can be built from
the ``docs`` directory with ``sphinx-build -b html src/ .``.

.. _issue tracker: https://github.com/smtg-ucl/ThermoParser/issues
.. _issue tracker: https://github.com/smtg-bham/ThermoParser/issues
.. _fork and pull: https://guides.github.com/activities/forking
.. _documentation: https://smtg-ucl.github.io/ThermoParser/
.. _tests: https://github.com/smtg-ucl/ThermoParser/tree/master/tests
.. _documentation: https://smtg-bham.github.io/ThermoParser/
.. _tests: https://github.com/smtg-bham/ThermoParser/tree/master/tests

Testing
-------
2 changes: 1 addition & 1 deletion citation.cff
Original file line number Diff line number Diff line change
@@ -16,4 +16,4 @@ authors:
title: "ThermoParser: Streamlined Analysis of Thermoelectric Properties"
version: 3.0.0
date-released: 2023-08-16
url: "https://github.com/SMTG-UCL/ThermoParser"
url: "https://github.com/smtg-bham/ThermoParser"
12 changes: 6 additions & 6 deletions examples/01-python-foundations/README.rst
Original file line number Diff line number Diff line change
@@ -88,10 +88,10 @@ ThermoParser has extensive docs. Docstrings are available throughout
the code itself, if you are using IPython or Jupyter and you can access
them by typing the command name followed by two question marks, and
IDEs normally have options too. If you are on the master branch,
they can also be found `here <https://smtg-ucl.github.io/ThermoParser/>`_.
they can also be found `here <https://smtg-bham.github.io/ThermoParser/>`_.

.. _Tutorial-03: https://smtg-ucl.github.io/ThermoParser/tutorial-03.html
.. _Tutorial-05: https://smtg-ucl.github.io/ThermoParser/tutorial-05.html
.. _Axes: https://smtg-ucl.github.io/ThermoParser/tp.axes.html
.. _Load: https://smtg-ucl.github.io/ThermoParser/tp.data.html#module-tp.data.load
.. _Plot: https://smtg-ucl.github.io/ThermoParser/tp.plot.html
.. _Tutorial-03: https://smtg-bham.github.io/ThermoParser/tutorial-03.html
.. _Tutorial-05: https://smtg-bham.github.io/ThermoParser/tutorial-05.html
.. _Axes: https://smtg-bham.github.io/ThermoParser/tp.axes.html
.. _Load: https://smtg-bham.github.io/ThermoParser/tp.data.html#module-tp.data.load
.. _Plot: https://smtg-bham.github.io/ThermoParser/tp.plot.html
4 changes: 2 additions & 2 deletions examples/02-individual-customisation/README.rst
Original file line number Diff line number Diff line change
@@ -77,5 +77,5 @@ midpoint you specify, and ``uniform`` calculates the midpoint position
based on the relative compositions of the colours, which is used for
heatmaps.

.. _Tutorial-01: https://smtg-ucl.github.io/ThermoParser/tutorial-01.html
.. _colourmap generators: https://smtg-ucl.github.io/ThermoParser/tp.plot.html#module-tp.plot.colour
.. _Tutorial-01: https://smtg-bham.github.io/ThermoParser/tutorial-01.html
.. _colourmap generators: https://smtg-bham.github.io/ThermoParser/tp.plot.html#module-tp.plot.colour
2 changes: 1 addition & 1 deletion examples/02-individual-customisation/tutorial-02.py
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@
# You can ignore down to line 20!
from os import path
if not path.isfile(kfile) or (path.getsize(kfile) < 1024*1024*100):
raise Exception('File not found, please use get-data.sh')
raise Exception('File not found, please use get-data.sh in the folder above.')
# Stop ignoring!

# Axes
2 changes: 1 addition & 1 deletion examples/03-compound-axes/README.rst
Original file line number Diff line number Diff line change
@@ -65,4 +65,4 @@ and ``labels`` arguments, so in order to specify your own, you must set
``tp.axes.legend.consolidate`` may also be useful for non-ThermoParser
endaevors, as will be discussed in `Tutorial-05`_.

.. _Tutorial-05: https://smtg-ucl.github.io/ThermoParser/tutorial-05.html
.. _Tutorial-05: https://smtg-bham.github.io/ThermoParser/tutorial-05.html
2 changes: 1 addition & 1 deletion examples/04-layered-plots/README.rst
Original file line number Diff line number Diff line change
@@ -70,4 +70,4 @@ which removes the ticks and tick labels and the y axis label, while all
the default labels can be accessed with ``settings.labels``. These will
be covered more in `Tutorial-05`_.

.. _Tutorial-05: https://smtg-ucl.github.io/ThermoParser/tutorial-05.html
.. _Tutorial-05: https://smtg-bham.github.io/ThermoParser/tutorial-05.html
110 changes: 55 additions & 55 deletions examples/04-layered-plots/tutorial-04.py
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
#!/usr/bin/env python3

import tp

scs = '222 333 444 555'.split()
pfiles = ['../data/basno3/band-{}.yaml'.format(s) for s in scs]
kfile = '../data/basno3/kappa-m363636.hdf5'
dfile = '../data/basno3/projected_dos.dat'
poscar = '../data/basno3/POSCAR'

direction = 'avg'
temperature = 300
waterfall = 'mean_free_path'
quantities = ['waterfall', waterfall]

colour = 'winter_r'
colours = {'Ba': '#ffcf06',
'Sn': '#59c605',
'O': '#00b1f7'}
cmap = 'viridis'

# You can ignore down to line 23!
from os import path
if not path.isfile(kfile) or (path.getsize(kfile) < 1024*1024*100):
raise Exception('File not found, please use get-data.sh')
# Stop ignoring!

# Axes
fig, ax, add_legend = tp.axes.small.two_h()

# Load
dispersions = [tp.data.load.phonopy_dispersion(f) for f in pfiles]
kappa = tp.data.load.phono3py(kfile, quantities=quantities)
dos = tp.data.load.phonopy_dos(dfile, poscar=poscar)

# Plot
tp.plot.phonons.add_multi(ax[0], dispersions, colour=colour, label=scs)
tp.plot.frequency.format_waterfall(ax[1], kappa, waterfall, direction=direction,
temperature=temperature, invert=True)
tp.plot.frequency.add_dos(ax[1], dos, colour=colours, scale=True, main=False,
alpha=0.6, line=False, invert=True)
tp.plot.frequency.add_waterfall(ax[1], kappa, waterfall, colour=cmap,
direction=direction, temperature=temperature,
invert=True)

# Formatting

tp.plot.utilities.set_locators(ax[1], x='log', y='linear')
axlabels = tp.settings.labels()
ax[1].set_xlabel(axlabels['mean_free_path'])
ax[1].set_ylabel(axlabels['frequency'])
add_legend()

# Save
fig.savefig('tutorial-04.png')
#!/usr/bin/env python3

import tp

scs = '222 333 444 555'.split()
pfiles = ['../data/basno3/band-{}.yaml'.format(s) for s in scs]
kfile = '../data/basno3/kappa-m363636.hdf5'
dfile = '../data/basno3/projected_dos.dat'
poscar = '../data/basno3/POSCAR'

direction = 'avg'
temperature = 300
waterfall = 'mean_free_path'
quantities = ['waterfall', waterfall]

colour = 'winter_r'
colours = {'Ba': '#ffcf06',
'Sn': '#59c605',
'O': '#00b1f7'}
cmap = 'viridis'

# You can ignore down to line 23!
from os import path
if not path.isfile(kfile) or (path.getsize(kfile) < 1024*1024*100):
raise Exception('File not found, please use get-data.sh in the folder above.')
# Stop ignoring!

# Axes
fig, ax, add_legend = tp.axes.small.two_h()

# Load
dispersions = [tp.data.load.phonopy_dispersion(f) for f in pfiles]
kappa = tp.data.load.phono3py(kfile, quantities=quantities)
dos = tp.data.load.phonopy_dos(dfile, poscar=poscar)

# Plot
tp.plot.phonons.add_multi(ax[0], dispersions, colour=colour, label=scs)
tp.plot.frequency.format_waterfall(ax[1], kappa, waterfall, direction=direction,
temperature=temperature, invert=True)
tp.plot.frequency.add_dos(ax[1], dos, colour=colours, scale=True, main=False,
alpha=0.6, line=False, invert=True)
tp.plot.frequency.add_waterfall(ax[1], kappa, waterfall, colour=cmap,
direction=direction, temperature=temperature,
invert=True)

# Formatting

tp.plot.utilities.set_locators(ax[1], x='log', y='linear')
axlabels = tp.settings.labels()
ax[1].set_xlabel(axlabels['mean_free_path'])
ax[1].set_ylabel(axlabels['frequency'])
add_legend()

# Save
fig.savefig('tutorial-04.png')
114 changes: 57 additions & 57 deletions examples/05-helper-functions/tutorial-05.py
Original file line number Diff line number Diff line change
@@ -1,57 +1,57 @@
#!/usr/bin/env python3

import tp
from matplotlib.gridspec import GridSpec
import matplotlib.pyplot as plt

afile = '../data/basno3/transport_75x75x75.json'
kfile = '../data/basno3/kappa-m363636.hdf5'

doping = [-1e18, -1e19, -1e20, -1e21]
direction = 'avg'
quantities = ['conductivity', 'seebeck']
scale = ['log', 'linear', 'linear']

from os import path
if not path.isfile(kfile) or (path.getsize(kfile) < 1024*1024*100):
raise Exception('File not found, please use get-data.sh')

# Axes
plt.style.use('tp')
fig = plt.figure(figsize=(27/2.54, 8.3/2.54))
grid = GridSpec(1, 14)
ax = [fig.add_subplot(grid[0, :4]),
fig.add_subplot(grid[0, 5:9]),
fig.add_subplot(grid[0, 10:])]
plt.subplots_adjust(left=0.06, right=0.98,
bottom=0.12, top=0.95)

# Load
adata = tp.data.load.amset(afile)
kdata = tp.data.load.phono3py(kfile)

# Plot
for i, q in enumerate(quantities):
for d in doping:
data = tp.data.utilities.resolve(adata, q, direction=direction, doping=d)
ax[i].plot(data['temperature'], data[q],
label="{:.2e}".format(data['meta']['doping']))

q = 'lattice_thermal_conductivity'
data = tp.data.utilities.resolve(kdata, q, direction=direction)
ax[2].plot(data['temperature'], data[q])

# Formatting
axlabels = tp.settings.labels()
for i, q in enumerate([*quantities, q]):
ax[i].set_xlabel(axlabels['temperature'])
ax[i].set_ylabel(axlabels[q])
tp.plot.utilities.set_locators(ax[i], x='linear', y=scale[i])

handles, labels = tp.axes.legend.consolidate(ax)
ax[2].legend(loc='best', title=axlabels['doping'], handles=handles,
labels=labels)
tp.axes.legend.alphabetise(ax, preset='roman', suffix=')', x=-0.12)

# Save
fig.savefig('tutorial-05.png')
#!/usr/bin/env python3

import tp
from matplotlib.gridspec import GridSpec
import matplotlib.pyplot as plt

afile = '../data/basno3/transport_75x75x75.json'
kfile = '../data/basno3/kappa-m363636.hdf5'

doping = [-1e18, -1e19, -1e20, -1e21]
direction = 'avg'
quantities = ['conductivity', 'seebeck']
scale = ['log', 'linear', 'linear']

from os import path
if not path.isfile(kfile) or (path.getsize(kfile) < 1024*1024*100):
raise Exception('File not found, please use get-data.sh in the folder above.')

# Axes
plt.style.use('tp')
fig = plt.figure(figsize=(27/2.54, 8.3/2.54))
grid = GridSpec(1, 14)
ax = [fig.add_subplot(grid[0, :4]),
fig.add_subplot(grid[0, 5:9]),
fig.add_subplot(grid[0, 10:])]
plt.subplots_adjust(left=0.06, right=0.98,
bottom=0.12, top=0.95)

# Load
adata = tp.data.load.amset(afile)
kdata = tp.data.load.phono3py(kfile)

# Plot
for i, q in enumerate(quantities):
for d in doping:
data = tp.data.utilities.resolve(adata, q, direction=direction, doping=d)
ax[i].plot(data['temperature'], data[q],
label="{:.2e}".format(data['meta']['doping']))

q = 'lattice_thermal_conductivity'
data = tp.data.utilities.resolve(kdata, q, direction=direction)
ax[2].plot(data['temperature'], data[q])

# Formatting
axlabels = tp.settings.labels()
for i, q in enumerate([*quantities, q]):
ax[i].set_xlabel(axlabels['temperature'])
ax[i].set_ylabel(axlabels[q])
tp.plot.utilities.set_locators(ax[i], x='linear', y=scale[i])

handles, labels = tp.axes.legend.consolidate(ax)
ax[2].legend(loc='best', title=axlabels['doping'], handles=handles,
labels=labels)
tp.axes.legend.alphabetise(ax, preset='roman', suffix=')', x=-0.12)

# Save
fig.savefig('tutorial-05.png')
2 changes: 1 addition & 1 deletion examples/06-package-customisation/README.rst
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@ dictionaries like the locators. The aliases are listed as:
If you add unit conversions, remember to update the units and labels
too! An example has been provided for converting from
S m\ :sup:`-1` to S cm\ :sup:`-1` `here <https://github.com/SMTG-UCL/ThermoParser/blob/master/examples/06-package-customisation/tprc.yaml>`_.
S m\ :sup:`-1` to S cm\ :sup:`-1` `here <https://github.com/smtg-bham/ThermoParser/blob/master/examples/06-package-customisation/tprc.yaml>`_.
There are six labels dictionaries. ``long_``, ``medium_`` and
``short_labels`` contain the actual labels of those lengths, while
``labels``, ``inverted_labels`` and ``large_labels`` point to which of
Loading

0 comments on commit 5828797

Please sign in to comment.