From e070c5fe084d181654e8090d6e5ee1faef873060 Mon Sep 17 00:00:00 2001 From: Paul Oliver Date: Thu, 29 Feb 2024 01:50:45 +0100 Subject: Updated plugins. Added fast-scroll command. --- plugins/grapher.py | 43 ++++++++++++++----------------------------- 1 file changed, 14 insertions(+), 29 deletions(-) (limited to 'plugins/grapher.py') diff --git a/plugins/grapher.py b/plugins/grapher.py index bd93205..b973653 100755 --- a/plugins/grapher.py +++ b/plugins/grapher.py @@ -1,50 +1,35 @@ #!/usr/bin/python ''' This script generates a data file that can be read by gnuplot or similar -software. Columns, representing different data fields, may be generated via -command line arguments. Current available columns include: +software. The first column represent the date (cycle * epoch) of the Salis +save file. The second column represents the number of organisms at that given +dat. -- current cycle: always present -- number of organisms: activate with '-o' flag +To run it, you may call it from within the ./bin/ directory (or wherever you +keep your auto-saved files) inside the SALIS main directory, such as: -To run it, simply call it from within the ./bin/ directory inside the SALIS -main directory, such as: +../plugins/grapher.py def.sim.*.auto -../plugins/grapher.py -o def.sim.*.auto - -Calling this will create a single DATA file including data from all files -matching the given pattern. This file may, in turn, be passed into gnuplot -for generating graphs. +Calling this will create a single DATA file (output.data) including data from +all files matching the given pattern. This file may, in turn, be passed into +gnuplot for generating graphs. ''' import os import sys from ctypes import * -current_arg = 1 -data_flags = [] - -while sys.argv[current_arg][0] == '-': - if sys.argv[current_arg] == '-o': - data_flags.append('organism_count') - print('organism count will be graphed') - else: - print('{} is not a valid flag'.format(sys.argv[current_arg])) - - current_arg += 1 - -files = sys.argv[current_arg:] oname = 'output.data' salis = CDLL('libsalis.so') -salis.s_getCycle.restype = c_uint -salis.s_getEpoch.restype = c_uint +salis.s_getCycle.restype = c_uint +salis.s_getEpoch.restype = c_uint salis.sp_getCount.restype = c_uint with open(oname, 'w') as output: - for f in files: - salis.s_load(bytes(f, 'utf-8')) + for fileName in sys.argv[1:]: + salis.s_load(bytes(fileName, 'utf-8')) cycle = salis.s_getCycle() epoch = salis.s_getEpoch() date = cycle + (epoch * (2 ** 32)) output.write('{} {}\n'.format(date, salis.sp_getCount())) - print('info of date {} added to output.data'.format(date)) + print('data of date {} added to \'output.data\''.format(date)) salis.s_quit() -- cgit v1.2.1