• Github
Table of Contents
0.13.0.0
  • Welcome to PsyNeuLink
  • Basics and Primer
  • Quick Reference
  • Core
  • Library
  • Contributors Guide
  • Docs >
  • Time
Shortcuts

Time¶

Note

This documentation is mirrored from the graph-scheduler package and often refers to nodes, edges , and graphs. In PsyNeuLink terms, nodes are Mechanisms or Compositions, edges are Projections, and graphs are Compositions. The one exception is during learning, in which Projections may be assigned for execution as nodes to ensure that MappingProjections are updated in the proper order.

Note

This documentation was modified from the original due to environment-specific TimeScale renamings. If there is any confusion, please see the original documentation at https://www.github.com/kmantel/graph-scheduler

Overview¶

Schedulers maintain Clock objects to track time. The current time in relation to a Scheduler is stored in Clock.time or Clock.simple_time

class psyneulink.core.scheduling.time.TimeScale(value)¶

Represents divisions of time used by the Scheduler and Conditions.

The values of TimeScale are defined as follows (in order of increasingly coarse granularity):

TIME_STEP¶

the nuclear unit of time, corresponding to the execution of all nodes allowed to execute from a single consideration set of a Scheduler, and which are considered to have executed simultaneously.

PASS¶

a full iteration through all of the consideration sets in a Scheduler's consideration_queue, consisting of one or more TIME_STEPs, over which every node specified to a Scheduler is considered for execution at least once.

TRIAL¶

an open-ended unit of time consisting of all actions that occurs within the scope of a single call to run (a single input to a Composition.)

RUN¶

the scope of a batch of one or more TRIALs. In PsyNeuLink, this is the scope of a call to the run method of a Composition, consisting of one or more TRIALs.

LIFE¶

the scope of time since the creation of an object.

classmethod get_parent(time_scale)¶
Returns

the TimeScale one level wider in scope than time_scale

Return type

TimeScale

classmethod get_child(time_scale)¶
Returns

the TimeScale one level smaller in scope than time_scale

Return type

TimeScale

class psyneulink.core.scheduling.time.Time(consideration_set_execution=0, pass_=0, environment_state_update=0, environment_sequence=0, life=0, absolute=<Quantity(0, 'millisecond')>, absolute_interval=<Quantity(1, 'millisecond')>, absolute_time_unit_scale=TimeScale.CONSIDERATION_SET_EXECUTION, absolute_enabled=False, **alias_time_values)¶

Represents an instance of time, having values for each TimeScale

life¶

the TimeScale.LIFE value

Type

int : 0

environment_sequence¶

the TimeScale.RUN value

Type

int : 0

environment_state_update¶

the TimeScale.TRIAL value

Type

int : 0

pass_¶

the TimeScale.PASS value

Type

int : 0

consideration_set_execution¶

the TimeScale.TIME_STEP value

Type

int : 0

absolute¶

the absolute time value

Type

pint.Quantity : 0ms

absolute_interval¶

the interval between units of absolute time

Type

pint.Quantity : 1ms

absolute_time_unit_scale¶

the TimeScale that corresponds to an interval of absolute time

Type

TimeScale : TimeScale.TIME_STEP

absolute_enabled¶

whether absolute time is used for this Time object

Type

bool : False

_get_by_time_scale(time_scale)¶
Parameters

time_scale (TimeScale) –

Returns

this Time’s value of a TimeScale by the TimeScale enum, rather than by attribute

Return type

int

_set_by_time_scale(time_scale, value)¶
Parameters

time_scale (TimeScale) –

Sets this Time’s value of a time_scale by the TimeScale enum, rather than by attribute

_increment_by_time_scale(time_scale)¶

Increments the value of time_scale in this Time by one

_reset_by_time_scale(time_scale)¶

Resets all the times for the time scale scope up to time_scale e.g. _reset_by_time_scale(TimeScale.ENVIRONMENT_STATE_UPDATE) will set the values for TimeScale.PASS and TimeScale.CONSIDERATION_SET_EXECUTION to 0

class psyneulink.core.scheduling.time.TimeHistoryTree(time_scale=TimeScale.LIFE, max_depth=TimeScale.ENVIRONMENT_STATE_UPDATE, index=0, parent=None, enable_current_time=True)¶

A tree object that stores a history of time that has occurred at various TimeScales, typically used in conjunction with a Clock

time_scale¶

the TimeScale unit this tree/node represents

Type

TimeScale : TimeScale.LIFE

child_time_scale¶

the TimeScale unit for this tree’s children

Type

TimeScale : TimeScale.RUN

children¶

an ordered list of this tree’s children

Type

list[TimeHistoryTree]

max_depth¶

the finest grain TimeScale that should be created as a subtree Setting this value lower allows for more precise measurements (by default, you cannot query the number of TimeScale.TIME_STEPs in a certain TimeScale.PASS), but this may use a large amount of memory in large simulations

Type

TimeScale : TimeScale.TRIAL

index¶

the index this tree has in its parent’s children list

Type

int

parent¶

the parent node of this tree, if it exists. None represents no parent (i.e. root node)

Type

TimeHistoryTree : None

previous_time¶

a Time object that represents the last time that has occurred in the tree

Type

Time

current_time¶

a Time object that represents the current time in the tree

Type

Time

total_times¶

stores the total number of units of TimeScales that have occurred over this tree’s scope. Only contains entries for TimeScales of finer grain than time_scale

Type

dict{TimeScale: int}

Parameters

enable_current_time (bool : True) – sets this tree to maintain a Time object. If this tree is not a root (i.e. time_scale is TimeScale.LIFE)

increment_time(time_scale)¶

Increases this tree’s current_time by one time_scale

Parameters

time_scale (TimeScale) – the unit of time to increment

get_total_times_relative(query_time_scale, base_indices=None)¶
Parameters
  • query_time_scale (TimeScale) – the TimeScale of units to be returned

  • base_indices (dict{TimeScale: int}) –

    a dictionary specifying what scope of time query_time_scale is over. e.g.

    base_indices = {TimeScale.ENVIRONMENT_SEQUENCE: 1, TimeScale.ENVIRONMENT_STATE_UPDATE: 5}

    gives the number of query_time_scales that have occurred in the 5th ENVIRONMENT_STATE_UPDATE of the 1st ENVIRONMENT_SEQUENCE. If an entry for a TimeScale is not specified but is coarser than query_time_scale, the latest value for that entry will be used

Returns

the number of units of query_time_scale that have occurred within the scope of time specified by base_indices

Return type

int


© Copyright 2016, Jonathan D. Cohen.

Built with Sphinx using a theme provided by Read the Docs.
  • Time
    • Overview
  • Github