htmd.adaptive.util module#

htmd.adaptive.util.getEpochSimIdx(data, epoch)#

Return the simulation indexes in a MetricData object for a given epoch.

Parameters:
  • data (MetricData) – Projected simulation data whose simlist is searched.

  • epoch (int) – The epoch number to select.

Returns:

idx – Integer array of simulation indexes in data.simlist that belong to the requested epoch.

Return type:

ndarray

htmd.adaptive.util.getEpochTrajectoryDictionary(simlist)#

Build a mapping from epoch number to simulation indexes.

Parameters:

simlist (list) – A simulation list created using the simlist function.

Returns:

simepochs – A dictionary mapping epoch number (int) to a list of simulation indexes from simlist belonging to that epoch.

Return type:

dict

htmd.adaptive.util.getParentSimIdxFrame(data, trajidx)#

Find the parent simulation index and frame for a given trajectory.

For a simulation that was spawned from a parent trajectory, returns the index of the parent simulation within data.simlist and the frame index within that parent simulation.

Parameters:
  • data (MetricData) – Projected simulation data containing the simlist to search.

  • trajidx (int) – Index of the simulation in data.simlist for which to find the parent.

Return type:

tuple

Returns:

  • parentidx (int) – Index of the parent simulation in data.simlist.

  • frameidx (int) – Frame index within the parent simulation corresponding to the spawn point.

htmd.adaptive.util.updatingMean(oldmean, oldcount, newdata)#

Compute a running mean incorporating new observations.

Parameters:
  • oldmean (float) – The previously accumulated mean value.

  • oldcount (int) – The number of observations that produced oldmean.

  • newdata (ndarray) – Array of new observations to incorporate.

Returns:

mean – Updated mean over all observations (old and new combined).

Return type:

float