Skip to content
Open
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
12 changes: 12 additions & 0 deletions changelog/16.feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
+ include support for polynomial-decay (besides cosine-decay)
+ we added three new classes/functions to the API in the module `convergence`
+ `PolynomialDecaySplineHelper`
+ `PolynomialDecaySplineHelperDerivative`
+ `get_polynomial_decay_harmonised_spline`
+ whereby the function `get_polynomial_decay_harmonised_spline` is mainly meant as user-interface
This function can be used as value for the `get_harmonise_spline` parameter in `harmonise`.
The function takes the same arguments as `get_cosine_decay_harmonised_spline` and additionally a
`power` argument.
+ The `power` argument can be passed to the function using
`functools.partial(get_polynomial_decay_harmonised_spline, power=2)`
+ An example use-case is added to the `getting-started-tutorial`.
Comment on lines +1 to +12
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
+ include support for polynomial-decay (besides cosine-decay)
+ we added three new classes/functions to the API in the module `convergence`
+ `PolynomialDecaySplineHelper`
+ `PolynomialDecaySplineHelperDerivative`
+ `get_polynomial_decay_harmonised_spline`
+ whereby the function `get_polynomial_decay_harmonised_spline` is mainly meant as user-interface
This function can be used as value for the `get_harmonise_spline` parameter in `harmonise`.
The function takes the same arguments as `get_cosine_decay_harmonised_spline` and additionally a
`power` argument.
+ The `power` argument can be passed to the function using
`functools.partial(get_polynomial_decay_harmonised_spline, power=2)`
+ An example use-case is added to the `getting-started-tutorial`.
+ Included support for polynomial-decay (adds to the existing cosine-decay)
+ Added new features to [convergence][gradient_aware_harmonisation.convergence]
+ [PolynomialDecaySplineHelper][gradient_aware_harmonisation.convergence.PolynomialDecaySplineHelper]
+ [PolynomialDecaySplineHelperDerivative][gradient_aware_harmonisation.convergence.PolynomialDecaySplineHelperDerivative]
+ [get_polynomial_decay_harmonised_spline][gradient_aware_harmonisation.convergence.get_polynomial_decay_harmonised_spline]
+ The function [get_polynomial_decay_harmonised_spline][gradient_aware_harmonisation.convergence.get_polynomial_decay_harmonised_spline] is an adapter between the underlying classes and the interface required for the `get_harmonise_spline` parameter in [harmonise][gradient_aware_harmonisation.harmonise].
The function takes the same arguments as [get_cosine_decay_harmonised_spline][gradient_aware_harmonisation.convergence.get_cosine_decay_harmonised_spline] and an additional
`power` argument. The `power` argument can be 'pre-passed' to the function using [functools.partial](https://docs.python.org/3/library/functools.html#functools.partial) e.g. `harmonise(..., get_harmonise_spline=functools.partial(get_polynomial_decay_harmonised_spline, power=2)...)`
+ An example use-case is included in the [getting started tutorial][gradient-aware-harmonisation-getting-started].

Wow super thorough. I am normally much lazier than this when writing changelogs (especially given our current user base is us)

(nwtkia)

The CHANGELOG gets written in past tense. The reason is, when the user reads this, everything will have already been done.

I don't know why, but we use capitals for the start of each dot point.

(hwtatb)

The [][] syntax allows you to do cross-references, which means that readers of the CHANGELOG can click and be taken straight to the module/code that is being discussed.

1 change: 1 addition & 0 deletions changelog/17.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
+ fix computation of cosine decay derivative (we forgot a constant value in the formula)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
+ fix computation of cosine decay derivative (we forgot a constant value in the formula)
+ Fixed computation of cosine decay derivative (a constant factor was missing)

(nwtkia)

26 changes: 26 additions & 0 deletions docs/tutorials/tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,14 @@

# %%
# Imports
from functools import partial

import numpy as np

from gradient_aware_harmonisation import harmonise
from gradient_aware_harmonisation.convergence import (
get_polynomial_decay_harmonised_spline,
)
from gradient_aware_harmonisation.plotting import plotting
from gradient_aware_harmonisation.timeseries import Timeseries

Expand Down Expand Up @@ -96,6 +101,27 @@
convergence_time,
)

# %% [markdown]
# ### Use polynomial-decay

# %%
convergence_time = 8.0

harmonised_timeseries = harmonise(
target_timeseries=target_timeseries,
harmonisee_timeseries=harmonisee_timeseries,
harmonisation_time=harmonisation_time,
convergence_time=convergence_time,
get_harmonised_spline=partial(get_polynomial_decay_harmonised_spline, power=2.0),
)

plotting(
harmonisee_timeseries,
target_timeseries,
harmonised_timeseries,
harmonisation_time,
convergence_time,
)
# %% [markdown]
# ## Toy Example 2: Use timeseries data
# ### Read data
Expand Down
Loading