source: framspy/frams-test.py @ 1083

Last change on this file since 1083 was 1083, checked in by Maciej Komosinski, 3 years ago

Allowed to override the default name of frams-objects.dll/so

File size: 1.0 KB
RevLine 
[1081]1import sys
[1078]2import frams
3
[1083]4frams_path = sys.argv[1] # set to the directory where Framsticks binaries and libraries exist
5frams.init(frams_path, sys.argv[2] if len(sys.argv) > 2 else None, "-Ddata")  # "-D"+os.path.join(framspath,"data")) # not possible (maybe python windows issue) because of the need for os.chdir(). So we assume "data" is where the dll/so is
[1078]6
7print('Available objects:', dir(frams))
8print()
9
10
11def extValueDetails(v):
12        return '"' + str(v) + '"    frams type=' + str(v._type()) + '    frams class=' + str(v._class()) + '    python type=' + str(type(v._value()))
13
14
15v = frams.String.deserialize('[100,2.2,"abc",[null,[]],XYZ[9,8,7]]')
16print(extValueDetails(v))
17for e in v:
18        print(extValueDetails(e))
19
20g = frams.GenePools[0].add('X')
21g.name = "py!"
22g.data['custom'] = 123.456
23g.data['a'] = 'b'
24
25for more in range(5):
26        frams.GenePools[0].add(frams.GenMan.mutate(g.geno))
27
28for g in frams.GenePools[0]:
29        print(str(g.index) + '. "' + str(g.name) + '"  ' + str(g.genotype) + '  data=' + str(g.data))
Note: See TracBrowser for help on using the repository browser.