You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a script to generate a transition system. Cristi has access to it in another repo. But dumper has issues saving the TS. I assume there is an issue with the formatting in the graph somehow.
import lomap as lm
from RandomizedCaTLExperiments import generateRandomGridTS_seed
b = generateRandomGridTS_seed('test_ts',[5,5],0.1,['A','B','C'],[0.1,0.2,0.7],[1,2],seed=1)
b.save('test_b.yaml')
If I change model.py to include this definition
def save(self, filename):
'''Save the model to file in YAML format.'''
Dumper.ignore_aliases = lambda *args : True
with open(filename, 'w') as fout:
dump(self, fout, Dumper=Dumper)
then I can use save without any issues.
Hrere is the long error message I obtain:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/kevin/iitchs/catl_planning/RandomizedCaTLExperiments.py", line 116, in generateRandomGridTS_seed
tsModel.save(tsname)
File "/home/kevin/iitchs/catl_planning/lomap/lomap/classes/model.py", line 114, in save
dump(self, fout, Dumper=Dumper)
File "/usr/lib/python2.7/dist-packages/yaml/__init__.py", line 202, in dump
return dump_all([data], stream, Dumper=Dumper, **kwds)
File "/usr/lib/python2.7/dist-packages/yaml/__init__.py", line 190, in dump_all
dumper.represent(data)
File "/usr/lib/python2.7/dist-packages/yaml/representer.py", line 28, in represent
node = self.represent_data(data)
File "/usr/lib/python2.7/dist-packages/yaml/representer.py", line 57, in represent_data
node = self.yaml_representers[data_types[0]](self, data)
File "/home/kevin/iitchs/catl_planning/lomap/lomap/classes/__init__.py", line 39, in model_representer
'edges' : map(list, model.g.edges(data=True))
File "/usr/lib/python2.7/dist-packages/yaml/representer.py", line 123, in represent_mapping
node_value = self.represent_data(item_value)
File "/usr/lib/python2.7/dist-packages/yaml/representer.py", line 57, in represent_data
node = self.yaml_representers[data_types[0]](self, data)
File "/usr/lib/python2.7/dist-packages/yaml/representer.py", line 223, in represent_dict
return self.represent_mapping(u'tag:yaml.org,2002:map', data)
File "/usr/lib/python2.7/dist-packages/yaml/representer.py", line 123, in represent_mapping
node_value = self.represent_data(item_value)
File "/usr/lib/python2.7/dist-packages/yaml/representer.py", line 57, in represent_data
node = self.yaml_representers[data_types[0]](self, data)
File "/usr/lib/python2.7/dist-packages/yaml/representer.py", line 215, in represent_list
return self.represent_sequence(u'tag:yaml.org,2002:seq', data)
File "/usr/lib/python2.7/dist-packages/yaml/representer.py", line 101, in represent_sequence
node_item = self.represent_data(item)
File "/usr/lib/python2.7/dist-packages/yaml/representer.py", line 57, in represent_data
node = self.yaml_representers[data_types[0]](self, data)
File "/usr/lib/python2.7/dist-packages/yaml/representer.py", line 215, in represent_list
return self.represent_sequence(u'tag:yaml.org,2002:seq', data)
File "/usr/lib/python2.7/dist-packages/yaml/representer.py", line 101, in represent_sequence
node_item = self.represent_data(item)
File "/usr/lib/python2.7/dist-packages/yaml/representer.py", line 57, in represent_data
node = self.yaml_representers[data_types[0]](self, data)
File "/usr/lib/python2.7/dist-packages/yaml/representer.py", line 223, in represent_dict
return self.represent_mapping(u'tag:yaml.org,2002:map', data)
File "/usr/lib/python2.7/dist-packages/yaml/representer.py", line 123, in represent_mapping
node_value = self.represent_data(item_value)
File "/usr/lib/python2.7/dist-packages/yaml/representer.py", line 61, in represent_data
node = self.yaml_multi_representers[data_type](self, data)
File "/usr/lib/python2.7/dist-packages/yaml/representer.py", line 437, in represent_object
return self.represent_sequence(tag+function_name, args)
File "/usr/lib/python2.7/dist-packages/yaml/representer.py", line 101, in represent_sequence
node_item = self.represent_data(item)
File "/usr/lib/python2.7/dist-packages/yaml/representer.py", line 41, in represent_data
if self.ignore_aliases(data):
File "/usr/lib/python2.7/dist-packages/yaml/representer.py", line 142, in ignore_aliases
if data in [None, ()]:
TypeError: data type not understood
The text was updated successfully, but these errors were encountered:
I was not able to reproduce the error. What version of pyyaml, numpy, and networkx are you using. The issue might be because of numpy arrays, in your case the edge weights (which are scalar numpy arrays).
It is still an issue. The input arguments to generateRandomGridTS have changed, so you can call it as b = generateRandomGridTS_seed('test_ts',[5,5],['A','B','C'],[1,2],1,seed=1).
But I can modify my copy of lomap to make it work if need be.
I have a script to generate a transition system. Cristi has access to it in another repo. But dumper has issues saving the TS. I assume there is an issue with the formatting in the graph somehow.
If I change model.py to include this definition
then I can use save without any issues.
Hrere is the long error message I obtain:
The text was updated successfully, but these errors were encountered: