using new formatters via --out and --out-no-stat

This commit is contained in:
Ozbolt Menegatti 2019-06-10 10:50:51 +02:00
parent 432dc87a5f
commit b819d9953f

15
wani.py
View File

@ -1217,7 +1217,12 @@ class Writer:
@staticmethod
def make_output_writer(args, colocation_ids, word_renderer):
params = Writer.other_params(args)
return Writer(args.output, OutFormatter(colocation_ids, word_renderer), params)
return Writer(args.out, OutFormatter(colocation_ids, word_renderer), params)
@staticmethod
def make_output_no_stat_writer(args, colocation_ids, word_renderer):
params = Writer.other_params(args)
return Writer(args.out_no_stat, OutNoStatFormatter(colocation_ids, word_renderer), params)
@staticmethod
def make_all_writer(args, colocation_ids, word_renderer):
@ -1496,11 +1501,13 @@ def main(structures_file, args):
colocation_ids.determine_colocation_dispersions()
# figure out representations!
if args.output:
if args.out or args.out_no_stat:
colocation_ids.set_representations(word_renderer)
Writer.make_output_writer(args, colocation_ids, word_renderer).write_out(
structures, colocation_ids)
Writer.make_output_no_stat_writer(args, colocation_ids, word_renderer).write_out(
structures, colocation_ids)
Writer.make_all_writer(args, colocation_ids, word_renderer).write_out(
structures, colocation_ids)
Writer.make_stats_writer(args, colocation_ids, word_renderer).write_out(
@ -1513,8 +1520,10 @@ if __name__ == '__main__':
help='Structures definitions in xml file')
parser.add_argument('input',
help='input xml file in `ssj500k form`, can list more than one', nargs='+')
parser.add_argument('--output',
parser.add_argument('--out',
help='Output file (if none given, then output to stdout)')
parser.add_argument('--out-no-stat',
help='Output file, but without statistical columns')
parser.add_argument('--all',
help='Additional output file, writes more data')
parser.add_argument('--stats',