Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.8', '3.10', '3.11', '3.12']
python-version: ['3.10', '3.11', '3.12', '3.13']
defaults:
run:
shell: bash
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: '3.8'
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install poetry
Expand Down
119 changes: 50 additions & 69 deletions docs/_static/custom.css
Original file line number Diff line number Diff line change
@@ -1,70 +1,51 @@

:root {
/* Use softer blue from bootstrap's default info color */
--pst-color-primary: 0, 108, 133;
--pst-color-active-navigation: 0, 108, 133;
--pst-color-navbar-link: 255, 255, 255;
--pst-color-navbar-link-hover: 200, 255, 255;
--pst-color-navbar-link-active: 255, 255, 255;
}

.navbar-light .navbar-nav>.active>.nav-link {
font-weight: 800;
color: rgba(var(--pst-color-navbar-link-active),1);
}

dt:target, span.highlighted {
background-color: rgba(var(--pst-color-primary),1);
}

.sig {
color: #ffffff;
padding-left: 10px;
background-color: rgba(var(--pst-color-primary),1);
}

.sig-name {
color: #ffffff;
}


nav.bg-light {
background-color: rgba(var(--pst-color-primary),1) !important;
}


.container-xl{max-width: 1400px }

.btn-block {
text-align: left;
font-weight: 600;
color: rgba(var(--pst-color-primary),1);
border-color: rgba(var(--pst-color-primary),1);
}


.btn-block[href^="case_studies/index.html"] {
html {
/* Use softer blue from bootstrap's default info color */
--pst-color-primary: 0, 108, 133;
--pst-color-active-navigation: 0, 108, 133;
--pst-color-navbar-link: 255, 255, 255;
--pst-color-navbar-link-hover: 200, 255, 255;
--pst-color-navbar-link-active: 255, 255, 255;
--pst-color-on-background: #006d85;

}

h1 {
--pst-color-heading: #006d85;
}

h2 {
--pst-color-heading: #006d85;
}

h3 {
--pst-color-heading: #006d85;
}

.sd-btn{
border-color: #006d85;
width: 100%;
text-align: left;
font-weight: 600;
color: #ffffff;
background-color:rgba(var(--pst-color-primary),1);
border-color: rgba(var(--pst-color-primary),1);
}

.btn-block[href^="case_studies/index.html"]:hover {
text-align: left;
font-weight: 600;
color:rgba(var(--pst-color-primary),1);
background-color:#ffffff;
border-color: rgba(var(--pst-color-primary),1);
}

.btn-block:hover {
color:#ffffff;
background-color:rgba(var(--pst-color-primary),1);
border-color: rgba(var(--pst-color-primary),1);
}

code {
font-size: 95% !important;
}
}

p .sd-btn:hover{
background-color: #006d85;
color: #ffffff
}

.bd-header {
--pst-color-text-muted: #ffffff;
--pst-color-on-background: #006d85;
}
.bd-header ul.navbar-nav > li.nav-item.current > .nav-link{
color:#c8ffff;
--pst-color-secondary:#c8ffff;
}

.bd-header ul.navbar-nav > li.nav-item > .nav-link:hover{
color:#c8ffff;
--pst-color-secondary:#c8ffff;
}

.search-button-field{
color: #5c5c5c
}
54 changes: 23 additions & 31 deletions docs/case_studies/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,53 +4,45 @@
Case Studies
===================

.. panels::
.. grid:: 1 2 2 2
:gutter: 4

**Interval manipulation**
.. grid-item-card:: Interval manipulation

This tutorial introduces the use of :mod:`staircase` for manipulating intervals. The ideas demonstrated form the basis for `the piso package <https://piso.readthedocs.io>`_.
This tutorial introduces the use of :mod:`staircase` for manipulating intervals. The ideas demonstrated form the basis for `the piso package <https://piso.readthedocs.io>`_.

.. link-button:: intervals
:type: ref
:text:
:classes: stretched-link

---
.. button-ref:: casestudies.intervals
:ref-type: ref
:class: stretched-link

**Queue analysis**
.. grid-item-card:: Queue analysis

This case study illustrates the use of :mod:`staircase` for queue analysis, including the exploration of the queue size distribution.
This case study illustrates the use of :mod:`staircase` for queue analysis, including the exploration of the queue size distribution.

.. link-button:: queues
:type: ref
:text:
:classes: stretched-link
.. button-ref:: casestudies.queues
:ref-type: ref
:class: stretched-link

---

**Asset utilisation**
.. grid-item-card:: Asset utilisationn

This case study demonstrates the use of :mod:`staircase` for quick calculation of asset utilisation over various time periods.
This case study demonstrates the use of :mod:`staircase` for quick calculation of asset utilisation over various time periods.

.. link-button:: utilisation
:type: ref
:text:
:classes: stretched-link
.. button-ref:: casestudies.utilisation
:ref-type: ref
:class: stretched-link

.. grid-item-card:: Data leakage

---
This case study shows how :mod:`staircase` can be used to simplify feature engineering, for machine learning models, while avoiding *data leakage*.

**Data leakage**
.. button-ref:: casestudies.dataleakage
:ref-type: ref
:class: stretched-link

This case study shows how :mod:`staircase` can be used to simplify feature engineering, for machine learning models, while avoiding *data leakage*.

.. link-button:: dataleakage
:type: ref
:text:
:classes: stretched-link


.. toctree::
.. toctree::
:hidden:
:maxdepth: 1

Expand Down
6 changes: 3 additions & 3 deletions docs/case_studies/utilisation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ We begin by importing the asset data into a :class:`pandas.DataFrame` instance.
import pandas as pd
import staircase as sc

data = pd.read_csv(asset_data, parse_dates=['start', 'end'], dayfirst=True)
data = pd.read_csv(asset_data, parse_dates=['start', 'end'])
data

For the analysis we would like a :class:`staircase.Stairs` object for each asset. Each Stairs object will represent a step function which has a value of zero, when the asset is not in use, and a value of one when the asset is in use. We can pandas' groupby process (`"split-apply-combine" <https://pandas.pydata.org/docs/user_guide/groupby.html>`_) with the :class:`staircase.Stairs` constructor method to get a :class:`pandas.Series`, indexed by asset name, with :class:`staircase.Stairs` values:

.. ipython:: python

asset_use = data.groupby("asset").apply(sc.Stairs, start="start", end="end")
asset_use = data.groupby("asset")[["start", "end"]].apply(sc.Stairs, start="start", end="end")
asset_use

Note that since we want to examine 2020 we clip the step function at the year endpoints, making the functions undefined for any time outside of 2020 (see :ref:`user_guide.gotchas` for why this is a good idea). :meth:`pandas.Series.apply` is used here, rather than looping, for efficiency.

.. ipython:: python

asset_use = asset_use.apply(sc.Stairs.clip, (pd.Timestamp("2020"), pd.Timestamp("2021")))
asset_use = asset_use.apply(sc.Stairs.clip, args=(pd.Timestamp("2020"), pd.Timestamp("2021")))

We can access an individual :class:`staircase.Stairs` object with the corresponding asset name. For example, to plot the step function corresponding to asset Z, for the first day:

Expand Down
16 changes: 12 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@
# "sphinx.ext.linkcode",
"numpydoc", # handle NumPy documentation formatted docstrings]
"nbsphinx",
"sphinx_panels",
"sphinx_design",
]

source_suffix = [".rst", ".ipynb"]
source_suffix = [".rst"]

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]
Expand All @@ -98,7 +98,7 @@

# sphinx-panels shouldn't add bootstrap css since the pydata-sphinx-theme
# already loads it
panels_add_bootstrap_css = False
# panels_add_bootstrap_css = False

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = "sphinx"
Expand Down Expand Up @@ -343,11 +343,14 @@ def get_items(self, names):
# html_theme_path = guzzle_sphinx_theme.html_theme_path()

html_theme_options = {
"google_analytics_id": "UA-27880019-2",
# "google_analytics_id": "UA-27880019-2",
"github_url": "https://github.com/staircase-dev/staircase",
"navbar_end": ["navbar-icon-links"],
}


html_show_sourcelink = False

html_logo = "img/staircase-wide-inverse.svg"
html_favicon = "img/favicon.ico"

Expand All @@ -360,6 +363,11 @@ def get_items(self, names):
"custom.css",
]

html_context = {
# ...
"default_mode": "light"
}


def setup(app):
# app.add_css_file("custom.css")
Expand Down
77 changes: 43 additions & 34 deletions docs/getting_started/intro_tutorials/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,54 @@ Introductory tutorials
=======================


.. link-button:: 00_stepfunction
:type: ref
:text: What is a step function?
:classes: btn-outline-primary btn-block

.. link-button:: 01_domains
:type: ref
:text: What domains and range are possible?
:classes: btn-outline-primary btn-block

.. link-button:: 02_creating
:type: ref
:text: How do I create my step function?
:classes: btn-outline-primary btn-block
.. button-ref:: intro_tutorials.stepfunction
:ref-type: ref
:class: btn-outline-primary btn-block

What is a step function?

.. button-ref:: intro_tutorials.domains
:ref-type: ref
:class: btn-outline-primary btn-block

What domains and range are possible?

.. button-ref:: intro_tutorials.creating
:ref-type: ref
:class: btn-outline-primary btn-block

.. link-button:: 03_plotting
:type: ref
:text: What does my step function look like?
:classes: btn-outline-primary btn-block
How do I create my step function?

.. button-ref:: intro_tutorials.plotting
:ref-type: ref
:class: btn-outline-primary btn-block

.. link-button:: 04_combining
:type: ref
:text: How do I combine step functions?
:classes: btn-outline-primary btn-block
What does my step function look like?

.. button-ref:: intro_tutorials.combining
:ref-type: ref
:class: btn-outline-primary btn-block

.. link-button:: 05_comparing
:type: ref
:text: How can I compare my step function?
:classes: btn-outline-primary btn-block
How do I combine step functions?

.. button-ref:: intro_tutorials.comparing
:ref-type: ref
:class: btn-outline-primary btn-block

.. link-button:: 06_stats
:type: ref
:text: What statistical properties are available?
:classes: btn-outline-primary btn-block
How can I compare my step function?

.. button-ref:: intro_tutorials.stats
:ref-type: ref
:class: btn-outline-primary btn-block

.. link-button:: 07_next
:type: ref
:text: What next?
:classes: btn-outline-primary btn-block
What statistical properties are available?

.. button-ref:: intro_tutorials.next
:ref-type: ref
:class: btn-outline-primary btn-block

What next?


.. toctree::
:maxdepth: 1
Expand Down
Loading
Loading