Skip to content

Commit

Permalink
Adapting post_proc script in this branch for single node operation fo…
Browse files Browse the repository at this point in the history
…r now.
  • Loading branch information
jonathanhhb committed Jun 17, 2024
1 parent 76f4754 commit 34ad49a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions jb/src/post_proc.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ def coi_mask(b, T, min_period, max_period):
def get_cases(node_id=0):
df = pd.read_csv('simulation_output.csv')

# Filter rows where Node is 507
df_filtered = df[df['Node'] == node_id]

# Calculate the week number based on Timestep
Expand All @@ -61,7 +60,7 @@ def log_transform(x, debug=1):
widths = np.logspace(np.log10(1), np.log10(MAX_PERIOD), int(MAX_PERIOD))
y = widths / 52

cases = get_cases(507)
cases = get_cases(0)
log_cases = pad_data(log_transform(cases))
cwt = signal.cwt(log_cases, wavelet, widths) # (M x N)
# Number of time steps in padded time series
Expand Down Expand Up @@ -181,15 +180,17 @@ def analyze():
average_new_infections_per_year = total_new_infections / num_years

# Filter the DataFrame to include only rows where Node is 507 (London)
df_london = df[df["Node"] == 507]
df_london = df[df["Node"] == 0]

# Calculate the total number of new infections in London
total_new_infections_london = df_london["New Infections"].sum()

# Calculate the average number of new infections in London per year
average_new_infections_per_year_london = total_new_infections_london / num_years

"""
ccs_bigcity_mean, ccs_median, sig_slope = analyze_ccs()
"""

# Create a DataFrame with the metric and its value
data = {
Expand All @@ -204,9 +205,9 @@ def analyze():
"value": [
average_new_infections_per_year,
average_new_infections_per_year_london,
ccs_bigcity_mean,
ccs_median,
sig_slope,
0,
0,
0,
get_wavelet_power_peak()
]
}
Expand Down

0 comments on commit 34ad49a

Please sign in to comment.