source: framspy/frams-test.py @ 1088

Last change on this file since 1088 was 1087, checked in by Maciej Komosinski, 4 years ago

Cosmetic

File size: 1.2 KB
Line 
1import sys
2import frams
3
4frams.init(*(sys.argv[1:]))  # pass whatever args we have, init() is the right place to deal with different scenarios:
5# frams.init() - should try to figure out everything (and might fail)
6# frams.init('path/to/lib') - load the library from the specified directory and configure Framsticks path as "data" inside this directory
7# frams.init('path/to/lib','-d/tmp/workdir/data') - as above, but set the working (writable) directory somewhere else (see also -D)
8# frams.init('path/to/lib','-Lframs-objects-alt.dll') - use specified library location and non-default file name
9
10print('Available objects:', dir(frams))
11print()
12
13
14def extValueDetails(v):
15        return '"' + str(v) + '"    frams type=' + str(v._type()) + '    frams class=' + str(v._class()) + '    python type=' + str(type(v._value()))
16
17
18v = frams.String.deserialize('[100,2.2,"abc",[null,[]],XYZ[9,8,7]]')
19print(extValueDetails(v))
20for e in v:
21        print(extValueDetails(e))
22
23g = frams.GenePools[0].add('X')
24g.name = "py!"
25g.data['custom'] = 123.456
26g.data['a'] = 'b'
27
28for more in range(5):
29        frams.GenePools[0].add(frams.GenMan.mutate(g.geno))
30
31for g in frams.GenePools[0]:
32        print(str(g.index) + '. "' + str(g.name) + '"  ' + str(g.genotype) + '  data=' + str(g.data))
Note: See TracBrowser for help on using the repository browser.