SampleBuffer

class Dock2D.Utility.SampleBuffer.SampleBuffer(num_examples, max_pos=1)
__init__(num_examples, max_pos=1)

Initialize a sample buffer (dictionary of lists) used to store and retrieve values per example, across epochs.

Parameters
  • num_examples – determines the size of the sample buffer

  • max_pos – limits the size of the array at a given sample buffer index

__len__(i)

Overloaded to get length of values at dictionary key.

Parameters

i – key index

Returns

length of values at key index

get_alpha(index, samples_per_example=1, device='cuda')

Retrieve the lastest rotation alpha for a specific interaction by example index.

Parameters
  • index – position index in the data stream

  • samples_per_example – number of times to sample rotation per example

  • devicecpu or cuda

Returns

stack of alpha samples

get_free_energies_indices(index, samples_per_example=1, device='cuda')

Retrieve the unique previously visited rotation indices for a specific interaction by example index. All rotations visited have an associated free energy used in Monte Carlo free energy sufrace sampling

Parameters
  • index – position index in the data stream

  • samples_per_example – number of times to sample rotation per example

  • devicecpu or cuda

Returns

stack of unique rotation indices

push_alpha(samples, index)

Push sampled alpha from the model to specific sample index.

Parameters
  • samples – sample(s) to push to buffer

  • index – position index in the data stream

push_free_energies_indices(samples, index)

Push accumulated rotation indices visited from the model to specific sample index. All rotations visited have an associated free energy used in Monte Carlo free energy sufrace sampling

Parameters
  • samples – sample(s) to push to buffer

  • index – position index in the data stream