Skip to content

Commit

Permalink
Updting precommit
Browse files Browse the repository at this point in the history
  • Loading branch information
Samreay committed Apr 17, 2024
1 parent f461e02 commit c13e31b
Show file tree
Hide file tree
Showing 16 changed files with 1,007 additions and 966 deletions.
20 changes: 10 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: check-added-large-files
args: ["--maxkb=5000"]
Expand All @@ -14,16 +14,16 @@ repos:
- --unsafe
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.14
rev: v0.3.7
hooks:
- id: ruff
args: ["--fix", "--no-unsafe-fixes"]
- id: ruff-format
- repo: local
hooks:
- id: tests
name: tests
language: system
types: [python]
pass_filenames: false
entry: poetry run pytest
# - repo: local
# hooks:
# - id: tests
# name: tests
# language: system
# types: [python]
# pass_filenames: false
# entry: poetry run pytest
1 change: 1 addition & 0 deletions docs/examples/advanced_examples/plot_0_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
the order of the parameters is not preserved in the dictionary.
"""

import numpy as np
import pandas as pd

Expand Down
1 change: 1 addition & 0 deletions docs/examples/advanced_examples/plot_1_blinding.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
or give it a string (or list of strings) detailing the specific parameters you want blinded!
"""

from chainconsumer import Chain, ChainConsumer, PlotConfig, make_sample

df = make_sample(num_dimensions=4, seed=1)
Expand Down
1 change: 1 addition & 0 deletions docs/examples/advanced_examples/plot_2_kde.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
increses the width of the marginal distributions.
"""

from chainconsumer import Chain, ChainConsumer, PlotConfig, make_sample

df = make_sample(num_dimensions=2, seed=3, num_points=1000)
Expand Down
1 change: 1 addition & 0 deletions docs/examples/advanced_examples/plot_3_divide_chains.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
In this toy example, all the chains are from the same random generator,
so they're on top of each other. Except MCMC chains to not be as perfect.
"""

from chainconsumer import Chain, ChainConsumer, PlotConfig, make_sample

df = make_sample(num_dimensions=2, seed=3, num_points=40000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Rather than having one example for each option, let's condense things.
"""

# %%
# Shade Gradient
# --------------
Expand Down
1 change: 1 addition & 0 deletions docs/examples/plot_0_contours.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
handle the defaults and display.
"""

from chainconsumer import Chain, ChainConfig, ChainConsumer, PlotConfig, Truth, make_sample

# Here's what you might start with
Expand Down
1 change: 1 addition & 0 deletions docs/examples/plot_1_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
To show you how they work, let's make some sample data that all
has the same average.
"""

from chainconsumer import Chain, ChainConfig, ChainConsumer, PlotConfig, Truth, make_sample

# Here's what you might start with
Expand Down
1 change: 1 addition & 0 deletions docs/examples/plot_2_textual_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Because typing those things out is a **massive pain in the ass.**
"""

from chainconsumer import Chain, ChainConsumer, Truth, make_sample

# Here's a sample dataset
Expand Down
1 change: 1 addition & 0 deletions docs/examples/plot_3_distributions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
To show you how they work, let's make some sample data that all
has the same average.
"""

from chainconsumer import Chain, ChainConsumer, Truth, make_sample

# Here's what you might start with
Expand Down
1 change: 1 addition & 0 deletions docs/examples/plot_4_walks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Want to see if your chain is behaving nicely? Use a walk!
"""

from chainconsumer import Chain, ChainConsumer, Truth, make_sample

# Here's a sample dataset
Expand Down
1 change: 1 addition & 0 deletions docs/examples/plot_6_custom_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
Here's an example, noting that there are also `plot_point`, `plot_surface` available
that I haven't explicitly shown.
"""

import matplotlib.pyplot as plt

from chainconsumer import Chain, Truth, make_sample
Expand Down
1,920 changes: 973 additions & 947 deletions poetry.lock

Large diffs are not rendered by default.

15 changes: 9 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ emcee = "^3.1.4"
arviz = ">=0.16.1, <1"

[tool.poetry.group.dev.dependencies]
pre-commit = ">=3.3.3"
ruff = ">=0.1.4, <1"
mypy = "^1.4.1"
pre-commit = ">=3.7.0"
ruff = ">=0.3.7, <1"
mypy = "^1.9.0"
pandas-stubs = "^2.1.1.230928"


Expand All @@ -48,17 +48,20 @@ mkdocs-gallery = ">=0.7.8"

[tool.ruff]
src = ["src"]
select = ["E", "F", "I", "N", "W", "D207", "D208", "D300", "UP", "YTT", "ASYNC", "DTZ", "G10", "G101", "G201", "G202", "INP001", "PIE", "T20", "SIM", "PTH", "PD", "PLE", "PLR", "PLW", "TRY", "NPY", "RUF"]
ignore = ["PD010", "PD901", "PLR2004", "UP017", "PLR0915", "TRY003", "INP001", "PLR0912", "PLR0913", "TRY300", "E712"]
line-length = 120
target-version = "py310"

[tool.ruff.lint]
select = ["E", "F", "I", "N", "W", "D207", "D208", "D300", "UP", "YTT", "ASYNC", "DTZ", "G10", "G101", "G201", "G202", "INP001", "PIE", "T20", "SIM", "PTH", "PD", "PLE", "PLR", "PLW", "TRY", "NPY", "RUF"]
ignore = ["PD010", "PD901", "PLR2004", "UP017", "PLR0915", "TRY003", "INP001", "PLR0912", "PLR0913", "TRY300", "E712"]


[tool.ruff.format]
indent-style = "space"
quote-style = "double"
line-ending = "auto"

[tool.ruff.extend-per-file-ignores]
[tool.ruff.lint.extend-per-file-ignores]
"test/***" = ["INP001"]
"__init__.py" = ["E402", "F401"]
"examples/***" = ["T201", "NPY002"]
Expand Down
6 changes: 3 additions & 3 deletions src/chainconsumer/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ class Bound(BetterBase):
def array(self) -> np.ndarray:
return np.array(
[
self.lower if self.lower is not None else np.NaN,
self.center if self.center is not None else np.NaN,
self.upper if self.upper is not None else np.NaN,
self.lower if self.lower is not None else np.nan,
self.center if self.center is not None else np.nan,
self.upper if self.upper is not None else np.nan,
]
)

Expand Down
1 change: 1 addition & 0 deletions src/chainconsumer/chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
There are also a few helper functions and objects in here, like the `MaxPosterior` class which
provides the log posterior and the coordinate at which it can be found for the chain."""

from __future__ import annotations

import logging
Expand Down

0 comments on commit c13e31b

Please sign in to comment.