Skip to content

Commit

Permalink
Precommit rework (wright-group#978)
Browse files Browse the repository at this point in the history
* Update pre commit config

* plot_colorbar docstring formatting

* Rm trailing whitespace from mostly rst and yml files

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
ksunden and pre-commit-ci[bot] authored Nov 5, 2020
1 parent 2ae5564 commit f5f6396
Show file tree
Hide file tree
Showing 50 changed files with 228 additions and 216 deletions.
6 changes: 3 additions & 3 deletions .github/PULL_REQUEST_TEMPLATE
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ please describe your changes here :smiley:
## Checklist

- [ ] added tests, if applicable
- [ ] updated documentation, if applicable
- [ ] updated documentation, if applicable
- [ ] updated CHANGELOG.md
- [ ] tests pass
- [ ] tests pass

2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
queries: +security-and-quality

Expand Down
23 changes: 16 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
repos:
- repo: https://github.com/psf/black
rev: master
- repo: https://github.com/psf/black
rev: 20.8b1 # Replace by any tag/version: https://github.com/psf/black/tags
hooks:
- id: black
name: black
language: system
args: [--line-length=99, --safe]
entry: black
- id: black
language_version: python3 # Should be a command that runs python3.6+
args: ["--line-length", "99"]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.3.0
hooks:
- id: trailing-whitespace
exclude: datasets|.data$
- id: no-commit-to-branch
args: [-b master]

default_language_version:
python: python3
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ python:
version: 3.6
pip_install: true
extra_requirements: [docs]

formats:
- epub
- pdf
50 changes: 25 additions & 25 deletions .zenodo.json
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
{
"license": {"id": "MIT"},
"title": "WrightTools",
"upload_type": "software",
"license": {"id": "MIT"},
"title": "WrightTools",
"upload_type": "software",
"creators": [
{
"orcid": "0000-0002-3845-824X",
"affiliation": "University of Wisconsin–Madison",
"orcid": "0000-0002-3845-824X",
"affiliation": "University of Wisconsin–Madison",
"name": "Blaise J. Thompson"
},
},
{
"orcid": "0000-0001-6167-8059",
"affiliation": "University of Wisconsin–Madison",
"orcid": "0000-0001-6167-8059",
"affiliation": "University of Wisconsin–Madison",
"name": "Kyle F. Sunden"
},
},
{
"orcid": "0000-0002-8922-8049",
"affiliation": "University of Wisconsin–Madison",
"orcid": "0000-0002-8922-8049",
"affiliation": "University of Wisconsin–Madison",
"name": "Darien J. Morrow"
},
},
{
"orcid": "0000-0003-4602-2961",
"affiliation": "University of Wisconsin–Madison",
"orcid": "0000-0003-4602-2961",
"affiliation": "University of Wisconsin–Madison",
"name": "Daniel D. Kohler"
},
},
{
"orcid": "0000-0002-9453-3590",
"affiliation": "University of Wisconsin–Madison",
"orcid": "0000-0002-9453-3590",
"affiliation": "University of Wisconsin–Madison",
"name": "Nathan Andrew Neff-Mallon"
},
},
{
"affiliation": "University of Wisconsin–Madison",
"affiliation": "University of Wisconsin–Madison",
"name": "Kyle J. Czech"
},
},
{
"orcid": "0000-0001-6718-8341",
"affiliation": "University of Wisconsin–Madison",
"orcid": "0000-0001-6718-8341",
"affiliation": "University of Wisconsin–Madison",
"name": "Emily M. Kaufman"
},
},
{
"name": "Thomas Parker"
},
},
{
"name": "Rachel Swedin"
}
],
],
"access_right": "open"
}
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
## [3.2.0]

### Added
- new method: moment - Take the Nth moment of a channel along an axis
- new method: moment - Take the Nth moment of a channel along an axis
- new method: trim - Use statistical test in channels to remove outlier points
- Support for remote files in `from_` functions

Expand Down Expand Up @@ -154,7 +154,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
### Added
- Plotting functions like plot, pcolor, and contour now will plot channels e.g. 2D channels within a 3D data object
- Quick plotting methods now have lines and labels for constants
- π release
- π release

## [3.1.3]

Expand Down Expand Up @@ -273,5 +273,5 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
[2.13.8]: https://github.com/wright-group/WrightTools/compare/2.13.7...2.13.8
[2.13.7]: https://github.com/wright-group/WrightTools/compare/2.13.6...2.13.7
[2.13.6]: https://github.com/wright-group/WrightTools/compare/2.13.5...2.13.6
[2.13.5]: https://github.com/wright-group/WrightTools/releases/tag/2.13.5
[2.13.5]: https://github.com/wright-group/WrightTools/releases/tag/2.13.5

16 changes: 8 additions & 8 deletions WrightTools/artists/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def corner_text(
-------
text
The matplotlib text object.
Other Parameters
----------------
**kwargs : matplotlib.text.Text properties.
Expand Down Expand Up @@ -623,22 +623,22 @@ def plot_colorbar(
Colorbar orientation. Default is vertical.
ticklocation : {'auto', 'left', 'right', 'top', 'bottom'} (optional)
Tick location. Default is auto.
extend : {neither’, ‘both’, ‘min’, ‘max} (optional)
If not neither, make pointed end(s) for out-of- range values.
extend : {'neither', 'both', 'min', 'max'} (optional)
If not 'neither', make pointed end(s) for out-of- range values.
These are set for a given colormap using the colormap set_under and set_over methods.
extendfrac : {None, auto, length, lengths} (optional)
extendfrac : {None, 'auto', length, lengths} (optional)
If set to None, both the minimum and maximum triangular colorbar extensions
have a length of 5% of the interior colorbar length (this is the default setting).
If set to auto, makes the triangular colorbar extensions the same lengths
If set to 'auto', makes the triangular colorbar extensions the same lengths
as the interior boxes
(when spacing is set to uniform) or the same lengths as the respective adjacent
interior boxes (when spacing is set to proportional).
(when spacing is set to 'uniform') or the same lengths as the respective adjacent
interior boxes (when spacing is set to 'proportional').
If a scalar, indicates the length of both the minimum and maximum triangular
colorbar extensions as a fraction of the interior colorbar length.
A two-element sequence of fractions may also be given, indicating the lengths
of the minimum and maximum colorbar extensions respectively as a fraction
of the interior colorbar length.
extendrect : bool (optional)
extendrect : bool (optional)
If False the minimum and maximum colorbar extensions will be triangular (the default).
If True the extensions will be rectangular.
Expand Down
2 changes: 1 addition & 1 deletion WrightTools/artists/_interact.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def norm(arr, signed, ignore_zero=True):


def interact2D(data, xaxis=0, yaxis=1, channel=0, local=False, verbose=True):
""" Interactive 2D plot of the dataset.
"""Interactive 2D plot of the dataset.
Side plots show x and y projections of the slice (shaded gray).
Left clicks on the main axes draw 1D slices on side plots at the coordinates selected.
Right clicks remove the 1D slices.
Expand Down
8 changes: 4 additions & 4 deletions WrightTools/data/_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ def moment(self, axis, channel=0, moment=1, *, resultant=None):
resultant : tuple of int
The resultant shape after the moment operation.
By default, it is intuited by the axis along which the moment is being taken.
This default only works if that axis is 1D, so resultant is required if a
This default only works if that axis is 1D, so resultant is required if a
multidimensional axis is passed as the first argument.
The requirement of monotonicity applies on a per pixel basis.
Expand Down Expand Up @@ -1325,7 +1325,7 @@ def print_tree(self, *, verbose=True):

def prune(self, keep_channels=True, *, verbose=True):
"""Remove unused variables and (optionally) channels from the Data object.
Unused variables are those that are not included in either axes or constants.
Unused channels are those not specified in keep_channels, or the first channel.
Expand Down Expand Up @@ -1848,7 +1848,7 @@ def create_constant(self, expression, *, verbose=True):
Expression for the new constant.
verbose : boolean (optional)
Toggle talkback. Default is True
See Also
--------
set_constants
Expand Down Expand Up @@ -1878,7 +1878,7 @@ def remove_constant(self, constant, *, verbose=True):
Expression for the new constant.
verbose : boolean (optional)
Toggle talkback. Default is True
See Also
--------
set_constants
Expand Down
2 changes: 1 addition & 1 deletion WrightTools/data/_join.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ def combine(data, out, item_name, new_idx, transpose, slice_):
print(" channels:")
for channel in out.channels:
percent_nan = np.around(
100. * (np.isnan(channel[:]).sum() / float(channel.size)), decimals=2
100.0 * (np.isnan(channel[:]).sum() / float(channel.size)), decimals=2
)
print(
" {0} : {1} to {2} ({3}% NaN)".format(
Expand Down
4 changes: 2 additions & 2 deletions WrightTools/diagrams/delay.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def label_sectors(
labelbottom="off",
)

ax.set_aspect(1.)
ax.set_aspect(1.0)

plt.savefig("TRIEE_delay_space.png", transparent=True)

Expand Down Expand Up @@ -160,6 +160,6 @@ def label_sectors(
labelbottom="off",
)

ax.set_aspect(1.)
ax.set_aspect(1.0)

plt.savefig("TRIEE_delay_space_as_collected.png", transparent=True)
12 changes: 6 additions & 6 deletions WrightTools/kit/_lineshapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def gaussian(x, x0, FWHM, norm="height"):
Type of normalization.
height specifies that the maximum value is 1.
area specifies that the lineshape integrates to 1.
Default is height.
Default is height.
Returns
-------
Expand Down Expand Up @@ -63,7 +63,7 @@ def lorentzian_complex(x, x0, G, norm="height_imag"):
Type of normalization.
height_imag specifies that the maximum value of the imaginary component is 1.
area_int specifies that the square magnitude of the lineshape integrates to 1.
Default is height_imag.
Default is height_imag.
Returns
-------
Expand Down Expand Up @@ -92,7 +92,7 @@ def lorentzian_real(x, x0, G, norm="height"):
Type of normalization.
height specifies that the maximum value is 1.
area specifies that the lineshape integrates to 1.
Default is height.
Default is height.
Returns
-------
Expand All @@ -108,10 +108,10 @@ def lorentzian_real(x, x0, G, norm="height"):

def voigt(x, x0, FWHM, G):
"""Calculate an unnormalized Voigt lineshape using Scipy's Faddeeva function
`Link to Voigt article on Wikipedia`__
__ https://en.wikipedia.org/wiki/Voigt_profile
__ https://en.wikipedia.org/wiki/Voigt_profile
Parameters
----------
Expand All @@ -122,7 +122,7 @@ def voigt(x, x0, FWHM, G):
FHWM : array_like or number
Full-width-at-half-maximum of Gaussian part of lineshape.
G : array_like or number
Half-width-at-half-maximum of Lorentzian part of lineshape.
Half-width-at-half-maximum of Lorentzian part of lineshape.
Returns
-------
Expand Down
4 changes: 2 additions & 2 deletions docs/api/WrightTools.artists.Axes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ WrightTools.artists.Axes
.. autoclass:: Axes
:show-inheritance:


.. rubric:: Methods

.. autosummary::
:toctree: WrightTools.artists.Axes

~Axes.add_sideplot
~Axes.contour
~Axes.contourf
Expand Down
10 changes: 5 additions & 5 deletions docs/api/WrightTools.artists.GridSpec.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ WrightTools.artists.GridSpec
.. autoclass:: GridSpec
:show-inheritance:












16 changes: 8 additions & 8 deletions docs/api/WrightTools.collection.Collection.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ WrightTools.collection.Collection
.. autoclass:: Collection
:show-inheritance:


.. automethod:: __init__


.. rubric:: Methods

.. autosummary::
Expand All @@ -22,15 +22,15 @@ WrightTools.collection.Collection
~Collection.flush
~Collection.print_tree
~Collection.save







.. rubric:: Attributes

.. autosummary::
:toctree: WrightTools.collection.Collection

~Collection.attrs
~Collection.class_name
~Collection.created
Expand All @@ -40,5 +40,5 @@ WrightTools.collection.Collection
~Collection.name
~Collection.natural_name
~Collection.parent


Loading

0 comments on commit f5f6396

Please sign in to comment.