gradient_aware_harmonisation.utils#
Utility functions
Classes:
| Name | Description |
|---|---|
GetHarmonisedSplineLike |
A callable which can generate a final, harmonised spline |
Functions:
| Name | Description |
|---|---|
add_constant_to_spline |
Add a constant value to a spline |
harmonise_splines |
Harmonise spline |
GetHarmonisedSplineLike #
Bases: Protocol
A callable which can generate a final, harmonised spline
The harmonised spline is generated based on a harmonised spline that doesn't consider convergence and a spline to which the final, harmonised spline should converge.
Methods:
| Name | Description |
|---|---|
__call__ |
Generate the harmonised spline |
Source code in src/gradient_aware_harmonisation/utils.py
__call__ #
__call__(
harmonisation_time: Union[int, float],
convergence_time: Union[int, float],
harmonised_spline_no_convergence: Spline,
convergence_spline: Spline,
) -> Spline
Generate the harmonised spline
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
harmonisation_time
|
Union[int, float]
|
Harmonisation time This is the time at and before which
the solution should be equal to |
required |
convergence_time
|
Union[int, float]
|
Convergence time This is the time at and after which
the solution should be equal to |
required |
harmonised_spline_no_convergence
|
Spline
|
Harmonised spline that does not consider convergence |
required |
convergence_spline
|
Spline
|
The spline to which the result should converge |
required |
Returns:
| Type | Description |
|---|---|
Spline
|
Harmonised spline |
Source code in src/gradient_aware_harmonisation/utils.py
add_constant_to_spline #
Add a constant value to a spline
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_spline
|
Spline
|
Input spline |
required |
constant
|
float | int
|
Constant to add |
required |
Returns:
| Type | Description |
|---|---|
Spline
|
Spline plus the given constant |
Source code in src/gradient_aware_harmonisation/utils.py
harmonise_splines #
harmonise_splines(
harmonisee: Spline,
target: Spline,
harmonisation_time: Union[int, float],
converge_to: Spline,
convergence_time: Union[int, float],
get_harmonised_spline: GetHarmonisedSplineLike = get_cosine_decay_harmonised_spline,
) -> Spline
Harmonise spline
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
harmonisee
|
Spline
|
Spline that we want to harmonise |
required |
target
|
Spline
|
Spline to which we harmonise |
required |
harmonisation_time
|
Union[int, float]
|
Time point at which harmonisee should be matched to the target |
required |
converge_to
|
Spline
|
The spline to which the result should converge. If not supplied, we use `harmonisee'. i.e. we converge back to the spline we are harmonising. |
required |
convergence_time
|
Union[int, float]
|
Time point at which the harmonised data should converge to the convergence spline |
required |
get_harmonised_spline
|
GetHarmonisedSplineLike
|
The method to use to converge back to the convergence spline. |
get_cosine_decay_harmonised_spline
|
Returns:
| Type | Description |
|---|---|
Spline
|
harmonised spline |