From f1e64b11d281d3d635065e7bb9c1718e05c48c2f Mon Sep 17 00:00:00 2001 From: jdc Date: Thu, 19 Dec 2024 08:42:25 -0500 Subject: [PATCH] - --- .../functions/nonstateful/timerfunctions.py | 21 ++++++++++--------- .../functions/stateful/integratorfunctions.py | 8 +++---- .../processing/integrator/timermechanism.py | 5 ++--- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/psyneulink/core/components/functions/nonstateful/timerfunctions.py b/psyneulink/core/components/functions/nonstateful/timerfunctions.py index a58bb4712c..fc1d3de199 100644 --- a/psyneulink/core/components/functions/nonstateful/timerfunctions.py +++ b/psyneulink/core/components/functions/nonstateful/timerfunctions.py @@ -36,7 +36,7 @@ * **AcceleratingTimer** - advances from initial ` to `final ` value by progressively larger amounts at an adjustable exponential `rate ` (see `interactive graph `_). - + * **DeceleratingTimer** - advances from initial ` to `final ` value by progressively smaller amounts at an adjustable exponential `rate ` (see `interactive graph `_). @@ -606,12 +606,12 @@ def derivative(self, input, output=None, context=None): duration = self._get_current_parameter_value(DURATION, context) rate = self._get_current_parameter_value(RATE, context) - return ((final - initial) * - (rate * (input / duration)^(rate - 1) - * ((1 / duration) - * (np.exp(np.power((input / duration),rate) - 1) - + (np.power((input / duration),rate)) - * np.exp(np.power((input / duration),rate) - 1) * rate * 1 / duration)))) + return ((final - initial) * + (rate * np.power((input / duration), (rate - 1)) + * ((1 / duration) + * (np.exp(np.power((input / duration), rate) - 1) + + (np.power((input / duration), rate)) + * np.exp(np.power((input / duration), rate) - 1) * rate * 1 / duration)))) # FIX: def _gen_llvm_transfer(self, builder, index, ctx, vi, vo, params, state, *, tags:frozenset): @@ -887,9 +887,10 @@ def derivative(self, input, output=None, context=None): rate = self._get_current_parameter_value(RATE, context) direction = 1 if final > initial else -1 - return direction * rate * (initial - final - direction) * np.log(direction * (final - initial + direction)) * \ - (input / duration)^(rate - 1) / (duration * np.exp(np.log(direction * (final - initial + direction)) * - np.power((input / duration),rate))) + return (direction * rate * (initial - final - direction) * np.log(direction * (final - initial + direction)) * \ + np.power((input / duration), (rate - 1)) + / (duration * np.exp(np.log(direction * (final - initial + direction)) * + np.power((input / duration), rate)))) # FIX: def _gen_llvm_transfer(self, builder, index, ctx, vi, vo, params, state, *, tags:frozenset): diff --git a/psyneulink/core/components/functions/stateful/integratorfunctions.py b/psyneulink/core/components/functions/stateful/integratorfunctions.py index 5c3257801b..bcd614ef68 100644 --- a/psyneulink/core/components/functions/stateful/integratorfunctions.py +++ b/psyneulink/core/components/functions/stateful/integratorfunctions.py @@ -46,11 +46,11 @@ from psyneulink.core.components.functions.stateful.statefulfunction import StatefulFunction from psyneulink.core.globals.context import ContextFlags, handle_external_context from psyneulink.core.globals.keywords import \ - (ACCUMULATOR_INTEGRATOR_FUNCTION, ADAPTIVE_INTEGRATOR_FUNCTION, ADDITIVE_PARAM, \ - DECAY, DEFAULT_VARIABLE, DRIFT_DIFFUSION_INTEGRATOR_FUNCTION, DRIFT_ON_A_SPHERE_INTEGRATOR_FUNCTION, \ - DUAL_ADAPTIVE_INTEGRATOR_FUNCTION, FITZHUGHNAGUMO_INTEGRATOR_FUNCTION, FUNCTION, \ + (ACCUMULATOR_INTEGRATOR_FUNCTION, ADAPTIVE_INTEGRATOR_FUNCTION, ADDITIVE_PARAM, + DECAY, DEFAULT_VARIABLE, DRIFT_DIFFUSION_INTEGRATOR_FUNCTION, DRIFT_ON_A_SPHERE_INTEGRATOR_FUNCTION, + DUAL_ADAPTIVE_INTEGRATOR_FUNCTION, FITZHUGHNAGUMO_INTEGRATOR_FUNCTION, FUNCTION, INCREMENT, INITIALIZER, INPUT_PORTS, INTEGRATOR_FUNCTION, INTEGRATOR_FUNCTION_TYPE, - INTERACTIVE_ACTIVATION_INTEGRATOR_FUNCTION, LEAKY_COMPETING_INTEGRATOR_FUNCTION, \ + INTERACTIVE_ACTIVATION_INTEGRATOR_FUNCTION, LEAKY_COMPETING_INTEGRATOR_FUNCTION, MODEL_SPEC_ID_MDF_VARIABLE, MULTIPLICATIVE_PARAM, NOISE, OFFSET, OPERATION, ORNSTEIN_UHLENBECK_INTEGRATOR_FUNCTION, OUTPUT_PORTS, PREVIOUS_VALUE, PRODUCT, RATE, REST, SCALE, SIMPLE_INTEGRATOR_FUNCTION, SUM, TIME_STEP_SIZE, THRESHOLD, VARIABLE) diff --git a/psyneulink/library/components/mechanisms/processing/integrator/timermechanism.py b/psyneulink/library/components/mechanisms/processing/integrator/timermechanism.py index 26a6048261..de44b333d8 100644 --- a/psyneulink/library/components/mechanisms/processing/integrator/timermechanism.py +++ b/psyneulink/library/components/mechanisms/processing/integrator/timermechanism.py @@ -48,7 +48,7 @@ *TIMER_MECHANISM* as its **mech_spec** argument. It can be created with or without a source of input. By default, a TimerMechanisms increments linearly, starting at 0, incrementing by 0.01 each time it is executed, and stopping when it reaches 1. However, the shape, starting, ending and rate of increment can all be configured. The shape of the timer's -progression is specified by it **trajectory** argument, which must be a `TimerFunction` or an appropriately configured +progression is specified by it **trajectory** argument, which must be a `TimerFunction` or an appropriately configured `UserDefinedFunction` (see `below ` for details); the starting and ending `values ` of the timer are specified by its **start** and **end** arguments, respectively, and the ammount it progresses each time the Mechanimsm is executed (in the absence of input) is specified by its **increment** argument. @@ -196,7 +196,7 @@ class TimerMechanism(IntegratorMechanism): start : scalar, list or array : default 0 specifies the starting `value ` of the timer; if a list or array, the length must be - the same as specified for **default_variable** or **input_shapes** (see `TimerMechanism_Execution` for + the same as specified for **default_variable** or **input_shapes** (see `TimerMechanism_Execution` for additional details). increment : scalar, list or array : default 1 @@ -410,4 +410,3 @@ def _execute(self, variable=None, context=None, runtime_params=None, **kwargs): def reset(self, *args, force=False, context=None, **kwargs): super().reset(*args, force=force, context=context, **kwargs) self.finished = False -