comparison ebcsgen_pctl_parameter_synthesis.py @ 2:3bb6c1e9252e draft default tip

planemo upload for repository https://github.com/sybila/galaxytools/tree/master/tools/ebcsgen commit 4719a69f514aed27d90c7017f052463b0b43cbb0
author sybila
date Sat, 15 Oct 2022 09:23:30 +0000
parents cf609f659b21
children
comparison
equal deleted inserted replaced
1:f280183d1289 2:3bb6c1e9252e
3 from eBCSgen.Analysis.PCTL import PCTL 3 from eBCSgen.Analysis.PCTL import PCTL
4 from eBCSgen.Errors.FormulaParsingError import FormulaParsingError 4 from eBCSgen.Errors.FormulaParsingError import FormulaParsingError
5 from eBCSgen.Errors.InvalidInputError import InvalidInputError 5 from eBCSgen.Errors.InvalidInputError import InvalidInputError
6 from eBCSgen.Parsing.ParseBCSL import load_TS_from_json 6 from eBCSgen.Parsing.ParseBCSL import load_TS_from_json
7 from eBCSgen.Parsing.ParsePCTLformula import PCTLparser 7 from eBCSgen.Parsing.ParsePCTLformula import PCTLparser
8
9
10 class FakeFile:
11 def __init__(self, content):
12 self.content = content.decode("utf-8")
13
14 def read(self):
15 return self.content
8 16
9 17
10 args_parser = argparse.ArgumentParser(description='Parameter synthesis') 18 args_parser = argparse.ArgumentParser(description='Parameter synthesis')
11 19
12 args_parser._action_groups.pop() 20 args_parser._action_groups.pop()
41 raise InvalidInputError("Intervals undefined for parameters: {}.".format(", ".join(undefined))) 49 raise InvalidInputError("Intervals undefined for parameters: {}.".format(", ".join(undefined)))
42 50
43 formula = PCTLparser().parse(args.formula) 51 formula = PCTLparser().parse(args.formula)
44 if formula.success: 52 if formula.success:
45 result = PCTL.parameter_synthesis(ts, formula, region) 53 result = PCTL.parameter_synthesis(ts, formula, region)
46 f = open(args.output, "w") 54 if "?" not in args.formula:
47 f.write(result.decode("utf-8")) 55 result = FakeFile(result)
48 f.close() 56 df = PCTL.process_output(result)
57 df.to_csv(args.output, index=False)
58 else:
59 with open(args.output, "w") as f:
60 f.write(result.decode("utf-8"))
49 else: 61 else:
50 raise FormulaParsingError(formula.data, args.formula) 62 raise FormulaParsingError(formula.data, args.formula)