From 54ae399f80594d250695eb85fbd5b9419324298d Mon Sep 17 00:00:00 2001 From: David Minton Date: Fri, 25 Jun 2021 10:08:00 -0400 Subject: [PATCH] Renaming package swiftestio to swiftest in anticipation of making the python side of things much more capable (and more Rebound-like) --- .../swiftestio/{swiftestio.py => swiftest.py} | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) rename python/swiftestio/{swiftestio.py => swiftest.py} (97%) diff --git a/python/swiftestio/swiftestio.py b/python/swiftestio/swiftest.py similarity index 97% rename from python/swiftestio/swiftestio.py rename to python/swiftestio/swiftest.py index a627cde60..db1ce2612 100644 --- a/python/swiftestio/swiftestio.py +++ b/python/swiftestio/swiftest.py @@ -168,6 +168,7 @@ def read_swifter_param(param_file_name): 'GR' : 'NO', 'C2' : "-1.0", } + # Read param.in file print(f'Reading Swifter file {param_file_name}') @@ -277,6 +278,22 @@ def read_swift_param(param_file_name): return param +def write_param(param, param_file_name): + outfile = open(param_file_name, 'w') + codename = param['VERSION'].split()[1] + if codename == "Swifter" or codename == "Swiftest": + for key,val in param.items(): + print(f"{key:<16} {val}",file=outfile) + elif codename == "Swift": + print(param['T0'],param['TSTOP'],param['DT'], file=outfile) + print(param['DTOUT'], param['DTDUMP'], file=outfile) + print(param['L1'],param['L2'],param['L3'],param['L4'],param['L5'],param['L6'], file=outfile) + print(param['RMIN'],param['RMAX'],param['RMAXU'],param['QMIN'],param['LCLOSE'], file=outfile) + print(param['BINARY_OUTPUTFILE'], file=outfile) + print(param['STATUS_FLAG_FOR_OPEN_STATEMENTS'], file=outfile) + outfile.close() + return + def swifter_stream(f, param): """ Reads in a Swifter bin.dat file and returns a single frame of data as a datastream @@ -987,4 +1004,4 @@ def swifter2swiftest(swifter_param, outparam): workingdir = '/Users/daminton/git/swiftest/examples/swift_conversion/' param_file_name = workingdir + 'param.in' param = read_swift_param(param_file_name) - param['BIN_OUT'] = workingdir + param['BIN_OUT'] \ No newline at end of file + write_param(param,"test.in") \ No newline at end of file