Skip to content

Commit

Permalink
Adding support for granularity parameter to agent log.
Browse files Browse the repository at this point in the history
  • Loading branch information
djgroen committed Nov 3, 2023
1 parent ed9799d commit da77d02
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 12 additions & 3 deletions flee/Diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,24 @@ def write_agents_par(
if a.location is None: #Do not write agent logs for agents that are removed from the simulation.
continue

loc_name = a.location.name
x = a.location.x
y = a.location.y

if SimulationSettings.log_levels["granularity"] == "region":
loc_name = location.region
x = 0.0
y = 0.0

print(
"{},{}-{},{},{},{},{},{},{},{},{},{}".format(
time,
rank,
k,
a.home_location.name,
a.location.name,
a.location.x,
a.location.y,
loc_name,
x,
y,
a.travelling,
a.distance_travelled,
a.places_travelled,
Expand Down
2 changes: 1 addition & 1 deletion flee/SimulationSettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def ReadFromYML(ymlfile: str):
SimulationSettings.log_levels["conflict"] = int(fetchss(dpll,"conflict",0))
SimulationSettings.log_levels["idp_totals"] = int(fetchss(dpll,"idp_totals",0))

SimulationSettings.log_levels["spatial_granularity"] = fetchss(dpll,"spatial_granularity","location")
SimulationSettings.log_levels["granularity"] = fetchss(dpll,"granularity","location")
# location, admin3 or admin2


Expand Down

0 comments on commit da77d02

Please sign in to comment.