| 5557 | |
| 5558 | |
| 5559 | def convert_h5(rm_h5, convert_cmd, *step_funcs): |
| 5560 | def convert(fname): |
| 5561 | if mp.my_rank() == 0: |
| 5562 | cmd = convert_cmd.split() |
| 5563 | cmd.append(fname) |
| 5564 | ret = subprocess.call(cmd) |
| 5565 | if ret == 0 and rm_h5: |
| 5566 | os.remove(fname) |
| 5567 | |
| 5568 | def _convert_h5(sim, todo): |
| 5569 | hooksave = sim.output_h5_hook |
| 5570 | sim.output_h5_hook = convert |
| 5571 | |
| 5572 | for f in step_funcs: |
| 5573 | _eval_step_func(sim, f, todo) |
| 5574 | |
| 5575 | sim.output_h5_hook = hooksave |
| 5576 | |
| 5577 | return _convert_h5 |
| 5578 | |
| 5579 | |
| 5580 | def output_png(compnt, options, rm_h5=True): |