Skip to content

Commit

Permalink
Add datetime to report
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander G. Zimmerman authored and agzimmerman committed May 3, 2020
1 parent 35dd941 commit 73fd223
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions sapphire/output.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Helper functions for simulation output"""
import typing
import datetime
import csv
from collections import OrderedDict
import matplotlib
Expand Down Expand Up @@ -193,9 +194,11 @@ def report(sim, write_header = True):

ordered_dict[key] = ordered_dict[key].__float__()

ordered_dict["datetime"] = str(datetime.datetime.now())

with sim.output_directory_path.joinpath(
"report").with_suffix(".csv").open("a+") as csv_file:
"report").with_suffix(".csv").open("a+") as csv_file:

writer = csv.DictWriter(csv_file, fieldnames = ordered_dict.keys())

if write_header:
Expand Down

0 comments on commit 73fd223

Please sign in to comment.