Skip to content

Commit

Permalink
πŸš‡πŸš€ Ready 0.7.0 release (#153)
Browse files Browse the repository at this point in the history
* πŸš€ Raised version from 0.6.0 to 0.7.0

* πŸ—‘οΈβŒ Removed pyglotaran_extras.io.boilerplate import setup_case_study
* πŸ—‘οΈβŒ Removed pyglotaran_extras.plotting.data
* πŸ—‘οΈ Changed figure_only deprecation to warn if used
* πŸš§πŸ“š Added changes since 0.6.0 to changelog
* πŸ”§ Add zenodo config

Note for new users:
This package complements the `pyglotaran` package found here: https://github.com/glotaran/pyglotaran
  • Loading branch information
s-weigand authored Apr 15, 2023
1 parent 68c5a12 commit fc97adf
Show file tree
Hide file tree
Showing 10 changed files with 73 additions and 89 deletions.
31 changes: 31 additions & 0 deletions .zenodo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"title": "Convenience plotting functions for pyglotaran",
"creators": [
{
"name": "Joris Snellenburg",
"affiliation": "Vrije Universiteit Amsterdam",
"orcid": "0000-0002-1428-0221"
},
{
"name": "Sebastian Weigand",
"affiliation": "Technical University Berlin"
},
{
"name": "Ivo H.M. van Stokkum",
"affiliation": "Vrije Universiteit Amsterdam",
"orcid": "0000-0002-6143-2021"
}
],
"keywords": [
"global analysis",
"target analysis",
"time-resolved spectroscopy",
"biophysics",
"glotaran",
"python",
"plotting"
],
"access_right": "open",
"license": "MIT",
"upload_type": "software"
}
17 changes: 17 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,25 @@

## 0.7.0 (Unreleased)

- πŸ‘Œ Fix typo in internal function name (#94)
- ✨ Add IRF dispersion center plotting (#95)
- πŸ‘Œ Improve typing (#96)
- πŸ‘Œ Shift time axis by IRF location (#99)
- πŸ©ΉπŸš‡ Fix 'Test pyglotaran dev' CI step (#117)
- πŸ‘Œ Add option to deactivate data/residual plotting in overview plots (#118)
- ✨ Add coherent artifact plot functionality (#123)
- ✨ Add a-matrix inspection function (#124)
- ✨ Add show_zero_line option to plot_overview and plot_fitted_traces (#128)
- 🩹 Fix SVD vector labels always starting from zero (#133)
- πŸ‘Œ Make result input for plot_coherent_artifact more generic (#134)
- ✨ Add plot_doas function that only plots DOAS related information (#135)
- ✨ Shift irf derivatives in plot_coherent_artifact by irf position (#136)
- πŸ‘Œ Convert plot style Enums to StrEnums for ease of use (#144)
- 🩹 Fix heading in show_a_matrixes for multiple a-matrixes per dataset (#148)
- πŸ‘Œ Add legend_format_string argument to plot_doas (#150)
- πŸ‘Œ Make plot_data_overview able to plot single trace data (#137)
- πŸ‘Œ Improve plot_doas default legend_format_string (#151)
- 🩹⌨️ Fix figsize typing (#152)
- πŸ©ΉπŸ“š Fix search in docs (#157)

(changes-0_6_0)=
Expand Down
2 changes: 1 addition & 1 deletion pyglotaran_extras/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@
"select_plot_wavelengths",
]

__version__ = "0.6.0"
__version__ = "0.7.0"
11 changes: 5 additions & 6 deletions pyglotaran_extras/deprecation/deprecation_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
from warnings import warn

FIG_ONLY_WARNING = (
"In the future plot functions which create figures, will return a tuple "
"of Figure AND the Axes. Please set ``figure_only=False`` and adjust your code.\n"
"This usage will be an error in version: 0.7.0."
"The ``figure_only`` argument was deprecated please remove it from the function call.\n"
"This usage will be an error in version: 0.8.0."
)


Expand Down Expand Up @@ -40,7 +39,7 @@ def pyglotaran_extras_version() -> str:
from pyglotaran_extras.
This way all of the deprecation functionality can be used even in
``pyglotaran_extras.__init__.py`` without moving the import below the definition of
``__version__`` or causeing a circular import issue.
``__version__`` or causing a circular import issue.
Returns
-------
Expand Down Expand Up @@ -81,8 +80,8 @@ def parse_version(version_str: str) -> tuple[int, int, int]:
return tuple(
map(int, (*split_version[:2], split_version[2].partition("rc")[0]))
) # type:ignore[return-value]
except ValueError:
raise ValueError(error_message)
except ValueError as error:
raise ValueError(error_message) from error


def check_overdue(deprecated_qual_name_usage: str, to_be_removed_in_version: str) -> None:
Expand Down
12 changes: 0 additions & 12 deletions pyglotaran_extras/io/boilerplate.py

This file was deleted.

13 changes: 0 additions & 13 deletions pyglotaran_extras/plotting/data.py

This file was deleted.

46 changes: 19 additions & 27 deletions pyglotaran_extras/plotting/plot_overview.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ def plot_overview(
main_irf_nr: int = 0,
figsize: tuple[float, float] = (18, 16),
cycler: Cycler | None = PlotStyle().cycler,
figure_only: bool = True,
figure_only: bool | None = None,
nr_of_data_svd_vectors: int = 4,
nr_of_residual_svd_vectors: int = 2,
show_data_svd_legend: bool = True,
show_residual_svd_legend: bool = True,
show_irf_dispersion_center: bool = True,
show_zero_line: bool = True,
) -> Figure | tuple[Figure, Axes]:
) -> tuple[Figure, Axes]:
"""Plot overview of the optimization result.
Parameters
Expand Down Expand Up @@ -79,10 +79,8 @@ def plot_overview(
Size of the figure (N, M) in inches. Defaults to (18, 16).
cycler : Cycler | None
Plot style cycler to use. Defaults to PlotStyle().cycler.
figure_only: bool
Whether or not to only return the figure.
This is a deprecation helper argument to transition to a consistent return value
consisting of the :class:`Figure` and the :class:`Axes`. Defaults to True.
figure_only: bool | None
Deprecated please remove this argument for you function calls. Defaults to None.
nr_of_data_svd_vectors: int
Number of data SVD vector to plot. Defaults to 4.
nr_of_residual_svd_vectors: int
Expand All @@ -100,15 +98,15 @@ def plot_overview(
Returns
-------
Figure|tuple[Figure, Axes]
If ``figure_only`` is True, Figure object which contains the plots (deprecated).
If ``figure_only`` is False, Figure object which contains the plots and the Axes.
tuple[Figure, Axes]
"""
res = load_data(result, _stacklevel=3)

if res.coords["time"].values.size == 1:
fig, axes = plot_guidance(res)
return fig if figure_only is True else (fig, axes)
if figure_only is not None:
warn(PyglotaranExtrasApiDeprecationWarning(FIG_ONLY_WARNING), stacklevel=2)
return fig, axes
# Plot dimensions
M = 4
N = 3
Expand Down Expand Up @@ -153,18 +151,17 @@ def plot_overview(
show_irf_dispersion_center=show_irf_dispersion_center,
irf_location=irf_location,
)
if figure_only is False:
return fig, axes
warn(PyglotaranExtrasApiDeprecationWarning(FIG_ONLY_WARNING), stacklevel=2)
return fig
if figure_only is not None:
warn(PyglotaranExtrasApiDeprecationWarning(FIG_ONLY_WARNING), stacklevel=2)
return fig, axes


def plot_simple_overview(
result: DatasetConvertible | Result,
title: str | None = None,
figsize: tuple[float, float] = (12, 6),
cycler: Cycler | None = PlotStyle().cycler,
figure_only: bool = True,
figure_only: bool | None = None,
show_irf_dispersion_center: bool = True,
show_data: bool | None = False,
) -> Figure | tuple[Figure, Axes]:
Expand All @@ -180,10 +177,8 @@ def plot_simple_overview(
Size of the figure (N, M) in inches. Defaults to (18, 16).
cycler : Cycler | None
Plot style cycler to use. Defaults to PlotStyle().cycler.
figure_only: bool
Whether or not to only return the figure.
This is a deprecation helper argument to transition to a consistent return value
consisting of the :class:`Figure` and the :class:`Axes`. Defaults to True.
figure_only: bool | None
Deprecated please remove this argument for you function calls. Defaults to None.
show_irf_dispersion_center: bool
Whether to show the the IRF dispersion center as overlay on the residual/data plot.
Defaults to True.
Expand All @@ -193,9 +188,7 @@ def plot_simple_overview(
Returns
-------
Figure|tuple[Figure, Axes]
If ``figure_only`` is True, Figure object which contains the plots (deprecated).
If ``figure_only`` is False, Figure object which contains the plots and the Axes.
tuple[Figure, Axes]
"""
res = load_data(result, _stacklevel=3)

Expand Down Expand Up @@ -228,10 +221,9 @@ def plot_simple_overview(
irf_location=irf_location,
)

if figure_only is not True:
return fig, axes
warn(PyglotaranExtrasApiDeprecationWarning(FIG_ONLY_WARNING), stacklevel=2)
return fig
if figure_only is not None:
warn(PyglotaranExtrasApiDeprecationWarning(FIG_ONLY_WARNING), stacklevel=2)
return fig, axes


if __name__ == "__main__":
Expand All @@ -241,7 +233,7 @@ def plot_simple_overview(
res = load_data(result_path)
print(res)

fig, axes = plot_overview(res, figure_only=False)
fig, axes = plot_overview(res)
if len(sys.argv) > 2:
fig.savefig(sys.argv[2], bbox_inches="tight")
print(f"Saved figure to: {sys.argv[2]}")
Expand Down
Empty file.
15 changes: 0 additions & 15 deletions tests/deprecation/modules/test_io_boilerplate.py

This file was deleted.

15 changes: 0 additions & 15 deletions tests/deprecation/modules/test_plotting_data.py

This file was deleted.

0 comments on commit fc97adf

Please sign in to comment.