Scamp_extensions.process package

Hi,

I’m trying to work with the l_systems and MarkovChain classes in scamp. Does someone have examples using these classes?

Thank you!

Eric

I’ve been meaning to put together some examples for how to use these.
I’ll try to come up with some and get back to you!

Hi Marc,

thank you! Looking forward to look at these examples,

Eric

Hi, trying to use these extensions (Markov) with this code:

from scamp import*
from scamp_extensions.process import markov, l_systems

modello = markov.MarkovModel([61, 62, 63, 64, 65])
analisi = modello.generate(5, 1)

print(type(analisi))
print(analisi)

error messages are the following: any idea?

Traceback (most recent call last):
File “/Users/ericmaestri/Dropbox/ConservatorioGenova/Anno04/ComposizioneInformatica/Corso20-21/compinf09/MaestriMarkov01.py”, line 2, in
from scamp_extensions.process import markov, l_systems
File “/Users/ericmaestri/Library/Python/3.7/lib/python/site-packages/scamp_extensions/process/init.py”, line 22, in
from .l_systems import LSystem
File “/Users/ericmaestri/Library/Python/3.7/lib/python/site-packages/scamp_extensions/process/l_systems.py”, line 26, in
class LSystem:
File “/Users/ericmaestri/Library/Python/3.7/lib/python/site-packages/scamp_extensions/process/l_systems.py”, line 50, in LSystem
def get_generation(self, n: int) → str:
File “/Applications/Thonny.app/Contents/Frameworks/Python.framework/Versions/3.7/lib/python3.7/functools.py”, line 490, in lru_cache
raise TypeError(‘Expected maxsize to be an integer or None’)
TypeError: Expected maxsize to be an integer or None

thank you!

Eric

Hi Eric! Sorry I’ve been slow in responding to this. What you’ve run into is a very slight typo-style bug in the LSystems module, which caused a crash for python version 3.7 and lower. I’ve fixed it, and put up a post-release. If you pip3 install --upgrade scamp_extensions, it should be fixed.

After that, the rest of your markov code should work fine. I still owe you an example or two though, sorry for the delay!

Dear Marc,

thank you!
Looking forward for the examples!

Eric

Hi,

sorry. Same problem…

Are you sure you’re using the post-release? Try running pip install scamp-extensions==0.3.2.post1. It could be it doesn’t upgrade without explicitly doing this.

Yes it is.

Hmm… can you click through to the l_systems.py file and copy and paste its contents to here? The bug was with the decorator @lru_cache, which should say @lru_cache()