riccardoscalco/Pykov

Dictionary changes size

Closed this issue · 0 comments

I've seen this here and there in my Organ Donor code.

2_track_contents.txt will become a markov object and a new music object
The Kemeny constant of the track contents transition table is 36.8458389735
A phrase of kemeny length from this transition table is: ['rest', '76', 'rest', '86', 'rest', '52', '76', 'rest', '86', 'rest', '88', 'rest', '52', 'rest', '59', '52', 'rest', '79', 'rest', '81', 'rest', '79', 'rest', '92', 'rest', '59', '61', 'rest', '76', 'rest', '67', 'rest', '57', 'rest', '81', 'rest', '52']
2_track_notes.txt will become a markov object and a new music object
2_rest_durations.txt will become a markov object and a new music object
if there aren't any rests to give a transition table, don't try to write one.
2_note_durations.txt will become a markov object and a new music object
/Library/Python/2.7/site-packages/scipy-0.14.0.dev_7cefb25-py2.7-macosx-10.9-intel.egg/scipy/sparse/compressed.py:686: SparseEfficiencyWarning: Changing the sparsity structure of a csc_matrix is expensive. lil_matrix is more efficient.
SparseEfficiencyWarning)
The Kemeny constant of the note durations transition table is
Traceback (most recent call last):
File "organelle.py", line 1445, in
composer()
File "organelle.py", line 1126, in composer
print "The Kemeny constant of the note durations transition table is", R.kemeny_constant()
File "/Library/Python/2.7/site-packages/pykov.py", line 1402, in kemeny_constant
Z = self.fundamental_matrix()
File "/Library/Python/2.7/site-packages/pykov.py", line 1379, in fundamental_matrix
p = self.steady()._toarray(el2pos)
File "/Library/Python/2.7/site-packages/pykov.py", line 1093, in steady
res.normalize()
File "/Library/Python/2.7/site-packages/pykov.py", line 269, in normalize
for k in self.iterkeys():
RuntimeError: dictionary changed size during iteration

What should I check first?