Distributions

class dendrotweaks.biophys.distributions.Distribution(function_name: str, **parameters: Dict[str, float])[source]

Bases: object

A callable class for creating and managing distribution functions.

Parameters:
  • function_name (str) – The name of the function to use.

  • **parameters – The parameters to use for the function.

function

The function to use for evaluation.

Type:

Callable

parameters

The parameters to use for the function.

Type:

dict

Examples

>>> func = Distribution('uniform', value=0)
>>> func(5)
0
static from_dict(data: Dict[str, any]) Distribution[source]

Creates a new Distribution from a dictionary.

Parameters:

data (dict) – The dictionary containing the function data.

Returns:

The new Distribution instance.

Return type:

Distribution

property function_name

Returns the name of the function.

Returns:

The name of the function.

Return type:

str

property degree

Returns the degree of the polynomial function (if applicable).

Returns:

The degree of the function.

Return type:

int

update_parameters(**new_params)[source]

Updates the parameters of the function.

Parameters:

**new_params – The new parameters to update the function with.

to_dict()[source]

Exports the function to a dictionary format.

Returns:

A dictionary representation of the function.

Return type:

dict