Skip to content

Commit

Permalink
Merge branch 'develop' into feature/concurrentRegression
Browse files Browse the repository at this point in the history
  • Loading branch information
vnmabus authored Oct 20, 2023
2 parents ed03263 + fe6a369 commit 09db85e
Show file tree
Hide file tree
Showing 101 changed files with 2,724 additions and 673 deletions.
559 changes: 559 additions & 0 deletions .all-contributorsrc

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ jobs:
- uses: tsuyoshicho/action-mypy@v3
with:
github_token: ${{ secrets.github_token }}
# Change reviewdog reporter if you need [github-pr-check,github-check,github-pr-review].
reporter: github-pr-review
# Change reporter level if you need.
# GitHub Status Check won't become failure with warning.
level: warning
# The action will output fail if there are mypy errors
level: error
setup_command: pip install -r requirements.txt pytest mypy
mypy_flags: ''
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.8', '3.9']
python-version: ['3.9', '3.10']

steps:
- uses: actions/checkout@v2
Expand Down
98 changes: 98 additions & 0 deletions CONTRIBUTORS.md

Large diffs are not rendered by default.

14 changes: 0 additions & 14 deletions THANKS.txt

This file was deleted.

2 changes: 1 addition & 1 deletion binder/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-r ../readthedocs-requirements.txt
scikit-fda[docs]
jupytext
sphinx-gallery<=0.7.0
.
13 changes: 13 additions & 0 deletions docs/_static/switcher.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[
{
"name": "dev",
"version": "dev",
"url": "https://fda.readthedocs.io/en/latest/"
},
{
"name": "0.9 (stable)",
"version": "stable",
"url": "https://fda.readthedocs.io/en/stable/",
"preferred": true
}
]
4 changes: 4 additions & 0 deletions docs/_templates/autosummary/class.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@

.. autosummary::
{% for item in methods %}
{% if item != "__init__" %}
~{{ name }}.{{ item }}
{% endif %}
{%- endfor %}
{% endif %}

{% for item in methods %}
{% if item != "__init__" %}
.. automethod:: {{ item }}
{% endif %}
{%- endfor %}
{% endblock %}

Expand Down
25 changes: 21 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,16 @@
"Universidad Autónoma de Madrid"
)
github_url = "https://github.com/GAA-UAM/scikit-fda"
rtd_version = os.environ.get("READTHEDOCS_VERSION", "latest")
branch = "master" if rtd_version == "stable" else "develop"
rtd_version = os.environ.get("READTHEDOCS_VERSION")
rtd_version_type = os.environ.get("READTHEDOCS_VERSION_TYPE")

switcher_version = rtd_version
if switcher_version == "latest":
switcher_version = "dev"
elif rtd_version_type not in {"branch", "tag"}:
switcher_version = skfda.__version__

rtd_branch = os.environ.get(" READTHEDOCS_GIT_IDENTIFIER", "develop")
language = "en"

try:
Expand All @@ -72,6 +80,7 @@
# Sphinx extensions
extensions = [
"jupyter_sphinx",
"myst_parser",
"sphinx.ext.autodoc",
"sphinx.ext.autodoc.typehints",
"sphinx.ext.autosummary",
Expand Down Expand Up @@ -111,6 +120,14 @@
html_theme_options = {
"use_edit_page_button": True,
"github_url": github_url,
"switcher": {
"json_url": (
"https://fda.readthedocs.io/en/latest/_static/switcher.json"
),
"version_match": switcher_version,
},
"show_version_warning_banner": True,
"navbar_start": ["navbar-logo", "version-switcher"],
"icon_links": [
{
"name": "PyPI",
Expand Down Expand Up @@ -288,7 +305,7 @@ def linkcode_resolve(domain: str, info: Mapping[str, str]) -> str | None:
else:
linespec = ""

return f"{github_url}/tree/{branch}/skfda/{fn}{linespec}"
return f"{github_url}/tree/{rtd_branch}/skfda/{fn}{linespec}"

# -- Options for "sphinx.ext.mathjax" --

Expand Down Expand Up @@ -390,7 +407,7 @@ def __repr__(self) -> str:
"binder": {
"org": "GAA-UAM",
"repo": "scikit-fda",
"branch": branch,
"branch": rtd_branch,
"binderhub_url": "https://mybinder.org",
"dependencies": ["../binder/requirements.txt"],
"notebooks_dir": "../examples",
Expand Down
2 changes: 2 additions & 0 deletions docs/contributors.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
```{include} ../CONTRIBUTORS.md
```
6 changes: 3 additions & 3 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ Github you can find more information related to the development of the package.
:caption: More documentation

apilist
glossary
Glossary <glossary>
contributors

An exhaustive list of all the contents of the package can be found in the
:ref:`genindex`.
Expand Down Expand Up @@ -86,8 +87,7 @@ All contributions are welcome. You can help this project grow in multiple ways,
from creating an issue, reporting an improvement or a bug, to doing a
repository fork and creating a pull request to the development branch.
The people involved at some point in the development of the package can be
found in the `contributors file
<https://github.com/GAA-UAM/scikit-fda/blob/develop/THANKS.txt>`_.
found in the :doc:`contributors page <contributors>`.

.. Citation
--------
Expand Down
Binary file added docs/logos/logo_only/logo_only.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/modules/exploratory/stats.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ statistics can be used.

skfda.exploratory.stats.cov
skfda.exploratory.stats.var
skfda.exploratory.stats.std

15 changes: 15 additions & 0 deletions docs/refs.bib
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,21 @@ @article{pini++_2018_hotelling
keywords = {Functional data,High-dimensional data Hotelling’s,Hilbert space,Nonparametric inference,Permutation test}
}

@incollection{pintado+romo_2005_depthbased,
title = {Depth-Based Classification for Functional Data},
shorttitle = {Data {{Depth}}},
booktitle = {Data {{Depth}}: {{Robust Multivariate Analysis}}, {{Computational Geometry}} and {{Applications}}},
author = {Pintado, Sara and Romo, Juan},
year = {2005},
month = nov,
series = {{{DIMACS Series}} in {{Discrete Mathematics}} and {{Theoretical Computer Science}}},
volume = {72},
pages = {103--119},
publisher = {{American Mathematical Society}},
doi = {10.1090/dimacs/072/08},
isbn = {978-0-8218-3596-8}
}

@inbook{ramsay+silverman_2005_functionala,
title = {From Functional Data to Smooth Functions},
booktitle = {Functional Data Analysis},
Expand Down
81 changes: 33 additions & 48 deletions examples/full_examples/plot_aemet_unsupervised.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@

from typing import Any, Mapping, Tuple

import cartopy.crs as ccrs
import matplotlib.pyplot as plt
import numpy as np
import sklearn.cluster
from cartopy.io.img_tiles import GoogleTiles
from matplotlib.axes import Axes
from mpl_toolkits.basemap import Basemap
from matplotlib.figure import Figure

from skfda.datasets import fetch_aemet
from skfda.exploratory.depth import ModifiedBandDepth
Expand Down Expand Up @@ -68,8 +70,8 @@
##############################################################################
# We want to plot the cluster of each station in the map of Spain. We need to
# define first auxiliary variables and functions for plotting.
coords_spain = (-10, 34.98, 5, 44.8)
coords_canary = (-18.5, 27.5, -13, 29.5)
coords_spain = (-10, 5, 34.98, 44.8)
coords_canary = (-18.5, -13, 27.5, 29.5)

# It is easier to obtain the longitudes and latitudes from the data in
# a Pandas dataframe.
Expand All @@ -81,44 +83,39 @@

def create_map(
coords: Tuple[float, float, float, float],
ax: Axes,
) -> Basemap:
figsize: Tuple[float, float],
) -> Figure:
"""Create a map for a region of the world."""
basemap = Basemap(
*coords,
projection='merc',
resolution="h",
epsg=4326,
ax=ax,
fix_aspect=False,
)
basemap.arcgisimage(
service='World_Imagery',
xpixels=1000,
dpi=100,
)
tiler = GoogleTiles(style="satellite")
mercator = tiler.crs

return basemap
fig = plt.figure(figsize=figsize)
ax = fig.add_axes([0, 0, 1, 1], projection=mercator)
ax.set_extent(coords, crs=ccrs.PlateCarree())

ax.add_image(tiler, 8)
ax.set_adjustable('datalim')

return fig


def plot_cluster_points(
longitudes: np.typing.NDArray[np.floating[Any]],
latitudes: np.typing.NDArray[np.floating[Any]],
clusters: np.typing.NDArray[np.integer[Any]],
color_map: Mapping[int, str],
basemap: Basemap,
ax: Axes,
) -> None:
"""Plot the stations in a map with their cluster color."""
x, y = basemap(longitudes, latitudes)
for cluster in range(n_clusters):
selection = (clusters == cluster)
ax.scatter(
x[selection],
y[selection],
longitudes[selection],
latitudes[selection],
s=64,
color=color_map[cluster],
edgecolors='white',
transform=ccrs.Geodetic(),
)


Expand All @@ -144,29 +141,23 @@ def plot_cluster_points(
# We now plot the obtained clustering in the maps.

# Mainland
fig_spain = plt.figure(figsize=(8, 6))
ax_spain = fig_spain.add_axes([0, 0, 1, 1])
map_spain = create_map(coords_spain, ax=ax_spain)
fig_spain = create_map(coords_spain, figsize=(8, 6))
plot_cluster_points(
longitudes=station_longitudes,
latitudes=station_latitudes,
clusters=fda_clusters,
color_map=fda_color_map,
basemap=map_spain,
ax=ax_spain,
ax=fig_spain.axes[0],
)

# Canary Islands
fig_canary = plt.figure(figsize=(8, 3))
ax_canary = fig_canary.add_axes([0, 0, 1, 1])
map_canary = create_map(coords_canary, ax=ax_canary)
fig_canary = create_map(coords_canary, figsize=(8, 3))
plot_cluster_points(
longitudes=station_longitudes,
latitudes=station_latitudes,
clusters=fda_clusters,
color_map=fda_color_map,
basemap=map_canary,
ax=ax_canary,
ax=fig_canary.axes[0],
)
plt.show()

Expand Down Expand Up @@ -228,36 +219,30 @@ def plot_cluster_points(
# color map to match cluster colors with the previously obtained ones.

mv_color_map = {
0: "red",
1: "purple",
2: "yellow",
3: "green",
4: "orange",
0: "yellow",
1: "orange",
2: "red",
3: "purple",
4: "green",
}

# Mainland
fig_spain = plt.figure(figsize=(8, 6))
ax_spain = fig_spain.add_axes([0, 0, 1, 1])
map_spain = create_map(coords_spain, ax=ax_spain)
fig_spain = create_map(coords_spain, figsize=(8, 6))
plot_cluster_points(
longitudes=station_longitudes,
latitudes=station_latitudes,
clusters=mv_clusters,
color_map=mv_color_map,
basemap=map_spain,
ax=ax_spain,
ax=fig_spain.axes[0],
)

# Canary Islands
fig_canary = plt.figure(figsize=(8, 3))
ax_canary = fig_canary.add_axes([0, 0, 1, 1])
map_canary = create_map(coords_canary, ax=ax_canary)
fig_canary = create_map(coords_canary, figsize=(8, 3))
plot_cluster_points(
longitudes=station_longitudes,
latitudes=station_latitudes,
clusters=mv_clusters,
color_map=mv_color_map,
basemap=map_canary,
ax=ax_canary,
ax=fig_canary.axes[0],
)
plt.show()
Loading

0 comments on commit 09db85e

Please sign in to comment.