This repository has been archived by the owner on Jul 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 47
Module specification
Joseph Lemaitre edited this page Mar 20, 2020
·
17 revisions
(still writing, more too come..)
The python code will call you're R scripts, setting some variable in the environment:
-
from_python
: truthy boolean, test for this to know if your code is run automatically. -
ti_str, tf_str
model start and end as a string -
foldername
the folder that contains everything related to the setup. You'll have to loadgeodata.csv
from there. Include the/
at the end.
if (!from_python) { # or whatever values you use to test.
ti_str <- '2020-01-31'
tf_str <- '2020-08-31'
foldername <- 'west-coast/'
}
# write code here that uses what is above and can load more files.
The code is run from the root folder of the repository.
(and status if the current R
implementation respect the specification.
- From R: dataframe named
mobility
with columns:from, to, amount
. Relationships not specified will be set to zero. You can set different value for A -> B and B -> A (if you only specified A -> B, we'll assume B -> A = 0). - From file: matrix to be imported with numpy as it is. Dimension:
(nnodes, nnnodes)
(may have a third dimension if time varying). First index is from, second is to, diagonal is zero (mobility[ori, dest]
) - From python: numpy matrix as file.
- From file: geodata.csv : specification of the spatial nodes, with at least column for the zero based index, the geoid or name, the population.
- From R: dataframe named
importation
with columndate, to, amount
where date is a string,to
contains a geoid and amount contains an integer.