Skip to content

Commit

Permalink
sim: add 'discard_last_n_outputs' parameter to 'simulate'
Browse files Browse the repository at this point in the history
  • Loading branch information
gasparka committed Aug 3, 2018
1 parent d489af7 commit 3900f1b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pyha/simulation/simulation_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def get_ran_gate_simulation():


def simulate(model, *args, simulations=None, conversion_path=None, input_types=None, input_callback=None,
output_callback=None):
output_callback=None, discard_last_n_outputs=None):
"""
Run simulations on model.
Expand Down Expand Up @@ -333,6 +333,10 @@ def types_from_pyha_to_python(pyha_types):
out['GATE'] = process_outputs(delay_compensate, ret, output_callback)
logger.info(f'OK!')

if discard_last_n_outputs:
for key, value in out.items():
out[key] = value[:-discard_last_n_outputs]

logger.info('Simulations completed!')
return out

Expand Down

0 comments on commit 3900f1b

Please sign in to comment.