Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Sep 9, 2024
1 parent 70a5700 commit 52f3820
Show file tree
Hide file tree
Showing 15 changed files with 64 additions and 65 deletions.
23 changes: 9 additions & 14 deletions docs/bayesian_fitting.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"outputs": [],
"source": [
"# If necessary, install pymc\n",
"# %pip install pymc"
"# %pip install pymc\n",
"from __future__ import annotations"
]
},
{
Expand All @@ -27,25 +28,19 @@
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"from scipy.interpolate import interp1d, UnivariateSpline\n",
"from scipy.integrate import cumulative_trapezoid\n",
"from scipy.misc import derivative\n",
"import pandas as pd\n",
"import arviz as az\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import pymc as pm\n",
"import arviz as az\n",
"import seaborn as sns\n",
"from pymc.distributions.dist_math import SplineWrapper\n",
"from scipy.integrate import cumulative_trapezoid\n",
"from scipy.interpolate import UnivariateSpline, interp1d\n",
"from scipy.misc import derivative\n",
"\n",
"import bluebonnet as bb\n",
"from bluebonnet.flow import (\n",
" IdealReservoir,\n",
" FlowProperties,\n",
" SinglePhaseReservoir,\n",
" RelPermParams,\n",
")\n",
"from bluebonnet.forecast import Bounds, ForecasterOnePhase\n",
"from pymc.distributions.dist_math import SplineWrapper"
")"
]
},
{
Expand Down
13 changes: 4 additions & 9 deletions docs/flow.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,23 @@
"metadata": {},
"outputs": [],
"source": [
"from __future__ import annotations\n",
"\n",
"%load_ext autoreload\n",
"%autoreload 2\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import scipy as sp\n",
"from scipy.interpolate import interp1d\n",
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"\n",
"from bluebonnet.flow import (\n",
" IdealReservoir,\n",
" FlowProperties,\n",
" FlowPropertiesTwoPhase,\n",
" IdealReservoir,\n",
" SinglePhaseReservoir,\n",
" RelPermParams,\n",
" relative_permeabilities,\n",
")\n",
"from bluebonnet.fluids.fluid import Fluid, pseudopressure\n",
"from bluebonnet.plotting import (\n",
" plot_pseudopressure,\n",
" plot_recovery_factor,\n",
" plot_recovery_rate,\n",
")\n",
"\n",
"plt.style.use(\"ggplot\")"
Expand Down
9 changes: 5 additions & 4 deletions docs/fluids.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,17 @@
"metadata": {},
"outputs": [],
"source": [
"import bluebonnet as bb\n",
"from __future__ import annotations\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"from bluebonnet.fluids.fluid import Fluid\n",
"from bluebonnet.fluids.gas import (\n",
" make_nonhydrocarbon_properties,\n",
" pseudocritical_point_Sutton,\n",
")\n",
"\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"\n",
"plt.style.use(\"ggplot\")"
]
},
Expand Down
17 changes: 8 additions & 9 deletions docs/forecast.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@
},
"outputs": [],
"source": [
"from __future__ import annotations\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"from scipy.interpolate import interp1d\n",
"from scipy.integrate import cumulative_trapezoid\n",
"from scipy.misc import derivative\n",
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"from scipy.integrate import cumulative_trapezoid\n",
"from scipy.interpolate import interp1d\n",
"\n",
"import bluebonnet as bb\n",
"from bluebonnet.flow import (\n",
" IdealReservoir,\n",
" FlowProperties,\n",
" SinglePhaseReservoir,\n",
" IdealReservoir,\n",
" RelPermParams,\n",
" SinglePhaseReservoir,\n",
")\n",
"from bluebonnet.forecast import Bounds, ForecasterOnePhase"
"from bluebonnet.forecast import ForecasterOnePhase"
]
},
{
Expand Down Expand Up @@ -372,7 +372,6 @@
"source": [
"from bluebonnet.flow import (\n",
" FlowPropertiesTwoPhase,\n",
" RelPermParams,\n",
" relative_permeabilities,\n",
")\n",
"\n",
Expand Down
7 changes: 4 additions & 3 deletions docs/forecast_varying.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,19 @@
"metadata": {},
"outputs": [],
"source": [
"from __future__ import annotations\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"from scipy import interpolate\n",
"\n",
"from bluebonnet.flow import FlowProperties, SinglePhaseReservoir\n",
"from bluebonnet.fluids import build_pvt_gas\n",
"from bluebonnet.forecast.forecast_pressure import (\n",
" fit_production_pressure,\n",
" plot_production_comparison,\n",
")\n",
"from bluebonnet import plotting"
")"
]
},
{
Expand Down
5 changes: 4 additions & 1 deletion docs/getting_started.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"from __future__ import annotations\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"from scipy.interpolate import interp1d\n",
"\n",
"from bluebonnet.flow import IdealReservoir\n",
"from bluebonnet.forecast import Bounds, ForecasterOnePhase\n",
"from bluebonnet.plotting import (\n",
Expand Down
18 changes: 7 additions & 11 deletions docs/oil_flow.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,23 @@
"metadata": {},
"outputs": [],
"source": [
"from __future__ import annotations\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import scipy as sp\n",
"from scipy.interpolate import interp1d\n",
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"from scipy.interpolate import interp1d\n",
"\n",
"from bluebonnet.flow import (\n",
" IdealReservoir,\n",
" FlowProperties,\n",
" FlowPropertiesTwoPhase,\n",
" SinglePhaseReservoir,\n",
" RelPermParams,\n",
" SinglePhaseReservoir,\n",
" relative_permeabilities,\n",
")\n",
"from bluebonnet.fluids.fluid import Fluid, pseudopressure\n",
"from bluebonnet.fluids.fluid import pseudopressure\n",
"from bluebonnet.plotting import (\n",
" plot_pseudopressure,\n",
" plot_recovery_factor,\n",
" plot_recovery_rate,\n",
")\n",
"\n",
"plt.style.use(\"ggplot\")"
Expand All @@ -63,9 +61,7 @@
"id": "53c603c9-a5df-485d-93f5-ffc307095a16",
"metadata": {},
"outputs": [],
"source": [
"from bluebonnet.flow.flowproperties import FlowPropertiesSimple"
]
"source": []
},
{
"cell_type": "code",
Expand Down
9 changes: 5 additions & 4 deletions tests/flow/test_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
import numpy as np
import pandas as pd
import pytest
from scipy.interpolate import interp1d

from bluebonnet.flow.flowproperties import (
FlowPropertiesTwoPhase,
RelPermParams,
relative_permeabilities,
relative_permeabilities_twophase,
rescale_pseudopressure,
)
from scipy.interpolate import interp1d

pr = 8_000.0
Sw = 0.1
Expand All @@ -36,7 +37,7 @@
pvt_oil = pd.read_csv("tests/data/pvt_oil.csv").rename(columns=columns_renamer_oil)


@pytest.fixture()
@pytest.fixture
def relperm_params():
return RelPermParams(
n_o=1,
Expand All @@ -51,7 +52,7 @@ def relperm_params():
)


@pytest.fixture()
@pytest.fixture
def saturations_test():
return pd.DataFrame(
{
Expand All @@ -62,7 +63,7 @@ def saturations_test():
)


@pytest.fixture()
@pytest.fixture
def df_pvt():
# get pvt tables
pvt_oil = pd.read_csv("tests/data/pvt_oil.csv")
Expand Down
4 changes: 3 additions & 1 deletion tests/flow/test_reservoir.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
import numpy as np
import pandas as pd
import pytest
from scipy.optimize import curve_fit

from bluebonnet.flow import (
FlowProperties,
IdealReservoir,
MultiPhaseReservoir,
SinglePhaseReservoir,
)
from scipy.optimize import curve_fit

nx = (30,)
nt = (1200,)
Expand Down Expand Up @@ -110,6 +111,7 @@ def test_rf_late_asymptotes(self, nx, pf, pi, fluid, Reservoir, nt):
reservoir.simulate(time)
if False:
import matplotlib.pyplot as plt

from bluebonnet.plotting import plot_pseudopressure, plot_recovery_factor

fig, ax = plt.subplots()
Expand Down
3 changes: 2 additions & 1 deletion tests/fluids/test_fluid.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

import numpy as np
import pytest

from bluebonnet.fluids import Fluid


@pytest.fixture()
@pytest.fixture
def fluid_instance(oil_properties):
fluid = Fluid(
oil_properties.temperature,
Expand Down
1 change: 1 addition & 0 deletions tests/fluids/test_gas.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import numpy as np
import pytest

from bluebonnet.fluids import gas

TEMPERATURE_STANDARD = 60.0
Expand Down
1 change: 1 addition & 0 deletions tests/fluids/test_oil.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import math

import pytest

from bluebonnet.fluids import oil

TEMPERATURE_STANDARD = 60.0
Expand Down
1 change: 1 addition & 0 deletions tests/fluids/test_water.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from __future__ import annotations

import pytest

from bluebonnet.fluids import water

TEMPERATURE_STANDARD = 60.0
Expand Down
9 changes: 5 additions & 4 deletions tests/forecast/test_forecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
import numpy as np
import pandas as pd
import pytest
from lmfit import Parameters

from bluebonnet.flow import FlowProperties, IdealReservoir, SinglePhaseReservoir
from bluebonnet.forecast import (
Bounds,
ForecasterOnePhase,
fit_production_pressure,
plot_production_comparison,
)
from lmfit import Parameters

t_end = 6.0
nx = 40
Expand All @@ -22,7 +23,7 @@
time_scaled = np.linspace(0, np.sqrt(t_end), nt) ** 2


@pytest.fixture()
@pytest.fixture
def rf_curve():
"""Return function for recovery factor from an ideal reservoir."""
reservoir = IdealReservoir(nx, pf, pi, None)
Expand All @@ -31,7 +32,7 @@ def rf_curve():
return reservoir.recovery_factor_interpolator()


@pytest.fixture()
@pytest.fixture
def pressure_varying_prod():
"""Necessary data for a pressure-varying system."""
tau_in = 180.0
Expand Down Expand Up @@ -90,7 +91,7 @@ def test_fit_production_pressure(pressure_varying_prod):
assert result.params["M"].value > 1e3, "is M increasing from the initial guess?"


@pytest.mark.mpl_image_compare()
@pytest.mark.mpl_image_compare
def test_fit_plot(pressure_varying_prod):
prod, pvt_table = pressure_varying_prod
params = Parameters()
Expand Down
Loading

0 comments on commit 52f3820

Please sign in to comment.