allensdk.brain_observatory.session_api_utils module

class allensdk.brain_observatory.session_api_utils.ParamsMixin(ignore: set = {'api'})[source]

Bases: object

This mixin adds parameter management functionality to the class it is mixed into.

This mixin expects that the class it is mixed into will have an __init__ with type annotated parameters. It also expects for the class to have semi-private attributes of the __init__ type annotated parameters.

Example:

SomeClassWhereParamManagementIsDesired(ParamsMixin):

# Managed params should be typed (with simple types if possible)! def __init__(self, param_to_ignore, a_param_1: int, a_param_2: float,

b_param_1: list):

# Parameters can be ignored by the mixin super().__init__(ignore={‘param_to_ignore’})

# Pay attention to the naming scheme! self._a_param_1 = a_param_1 self._a_param_2 = a_param_2 self._b_param_1 = b_param_1

After being mixed in, methods like ‘get_params’, ‘set_params’, ‘needs_data_refresh’, and ‘clear_updated_params’ will be available.

clear_updated_params(self, data_params: set)[source]

This method clears ‘updated params’ whose data have been updated

get_params(self) → Dict[str, Any][source]

Get managed params and their values

needs_data_refresh(self, data_params: set) → bool[source]

Check if specific params have been updated via set_params()

set_params(self, **params)[source]

Set managed params

allensdk.brain_observatory.session_api_utils.is_equal(a: Any, b: Any) → bool[source]

Function to deal with checking if two variables of possibly mixed types have the same value.