SLF data reader
SLF data reader reads files whose extension is .slf
.
[1]:
import tempfile
from pprint import pprint
from galactic.io.data.core import PopulationFactory
data = """\
[Lattice]
2
3
[Objects]
1 2
[Attributes]
a b c
[Relation]
0 1 0
1 1 0
"""
with tempfile.NamedTemporaryFile(mode="w+t", suffix=".slf") as file:
file.write(data)
file.seek(0)
population = PopulationFactory.create(file)
pprint({key: sorted(value) for key, value in population.items()})
{'1': ['b'], '2': ['a', 'b']}