First step is going to be pulling out:
@ruffus.transform(split_polynomials_list, ruffus.suffix(".poly"), ".roots") | |
def roots_for_poly_chunks(input_filename, output_filename): | |
polys = open(input_filename, "rb").readlines() | |
with open(output_filename, "wb") as fp: | |
for line in polys: | |
roots = numpy.roots([1] + [int(x) for x in line.strip().split()]) | |
for root in roots: | |
if root.real >= 0 and root.imag >= 0: | |
if not INNER_ONLY or abs(root) <= 1: | |
fp.write("{} {}\n".format(root.real, root.imag)) |
Into a stand alone script and then replace the internals of that function with a SAGA execution of that new script.