-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1) Added tool to generate synthetic suitability data. 2) Added code t…
…o load and use that data. 3) Added code to run script to generate code if not found. 4) Added manifest.py file to be central store of paths to input and output datafiles.
- Loading branch information
Jonathan Bloedow
committed
Sep 21, 2024
1 parent
59a804c
commit ed93d2e
Showing
5 changed files
with
48 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
include idmlaser_cholera/USA-pyramid-2023.csv | ||
include src/idmlaser_cholera/mods/libtx.so | ||
include src/idmlaser_cholera/mods/libages.so | ||
include src/idmlaser_cholera/tools/make_suitability_random_data.py | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
psi_data="synthetic_psi_data.csv" |
Empty file.
34 changes: 34 additions & 0 deletions
34
src/idmlaser_cholera/tools/make_suitability_random_data.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import numpy as np | ||
import pandas as pd | ||
|
||
# Define the dimensions of the CSV | ||
rows = 419 # Number of nodes | ||
columns = 365 * 5 # Time steps (5 years with 365 steps per year) | ||
|
||
# Generate random amplitude (between 0.1 and 0.9) for each row | ||
amplitudes = np.random.uniform(0.1, 0.9, size=(rows, 1)) | ||
|
||
# Generate random phase offsets (between 0 and 2*pi for a full cycle) for each row | ||
phase_offsets = np.random.uniform(0, 2 * np.pi, size=(rows, 1)) | ||
|
||
# Create a time vector representing the time steps for the sin wave (columns represent days) | ||
time_vector = np.arange(columns) | ||
|
||
# Generate sinusoidal data for each row | ||
# Formula: value = amplitude * sin(2 * pi * time / period + phase) + 0.5 (to shift range to 0 to 1) | ||
sin_data = amplitudes * np.sin(2 * np.pi * time_vector / 365 + phase_offsets) + 0.5 | ||
|
||
# Clip the data to ensure it stays between 0 and 1 | ||
sin_data_clipped = np.clip(sin_data, 0, 1) | ||
|
||
# Create a DataFrame from the sinusoidal values | ||
df = pd.DataFrame(sin_data_clipped) | ||
|
||
# Define the filename for the CSV | ||
csv_filename = "synthetic_psi_data.csv" | ||
|
||
# Save the DataFrame to a CSV file | ||
df.to_csv(csv_filename, index=False) | ||
|
||
csv_filename | ||
|