Skip to content

Commit 7d85e12

Browse files
committed
update documentation
1 parent b0555b6 commit 7d85e12

File tree

5 files changed

+111
-161
lines changed

5 files changed

+111
-161
lines changed

.github/workflows/cleanup.yml

Lines changed: 0 additions & 70 deletions
This file was deleted.

README.md

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ A technical memorandum describing DEMOS is available [here](./DEMOS_Technical_Me
1616
## Usage
1717

1818
### Docker Compose (recommended)
19-
The latest docker image for demos is stored in `ghcr.io/nrel/demos:latest`. The input data and configuration file are fed to the container through volumes. Alternatively, we provide a `docker-compose` workflow that can be used.
19+
The latest docker image for demos is stored in `ghcr.io/NatLabRockies/demos:latest`. The input data and configuration file are fed to the container through volumes ([more info about Docker volumes](https://docs.docker.com/engine/storage/volumes/)). We provide a `docker-compose` workflow that can be used to make the process of mounting volumes easier.
2020

2121
#### Prepare the configuration file and data folder
2222

23+
Run the following command in the Terminal App (MacOS) or Command Prompt/PowerShell (Windows):
24+
2325
```bash
2426
# Create a directory where to run DEMOS from
2527
mkdir demos
@@ -28,43 +30,36 @@ cd demos
2830
# Create the configuration folder and retrieve an example configuration
2931
mkdir configuration
3032
cd configuration
31-
curl -L -o demos_config.toml https://raw.githubusercontent.com/nrel/DEMOS/main/configuration/demos_config_sfbay.toml
33+
curl -L -o demos_config.toml https://raw.githubusercontent.com/NatLabRockies/DEMOS/main/configuration/demos_config_sfbay.toml
3234

3335
# Create the data folder for the output to be stored
3436
cd ..
3537
mkdir data
3638
# Populate the data folder
3739

3840
# Finally, retrieve the docker-compose.yml file
39-
curl -L -o docker-compose.yml https://raw.githubusercontent.com/nrel/DEMOS/main/docker-compose.yml
41+
curl -L -o docker-compose.yml https://raw.githubusercontent.com/NatLabRockies/DEMOS/main/docker-compose.yml
4042
```
4143

42-
Now you can run docker as follows:
44+
Make sure you have [Docker](https://docs.docker.com/desktop/) and [Docker Compose](https://docs.docker.com/compose/install/) installed. Now you can run docker as follows:
45+
4346
```bash
4447
docker compose up
4548
```
4649
#### IMPORTANT for MacOS and Windows users
47-
> Docker imposes a global limit on how much RAM containers can allocate. DEMOS easily surpases those limits, so in order to run DEMOS in Docker, users need to access the Docker Desktop GUI and `Preferences → Resources → Memory → Increase it (at least 16-20gb)`
50+
> Docker imposes a global limit on how much RAM containers can allocate. DEMOS easily surpases those limits, so in order to run DEMOS in Docker, users need to access the Docker Desktop GUI and `Preferences → Resources → Memory → Increase it (at least 16-20gb)`. The amount of memory required to run DEMOS will primarily depend on the size of the input data.
4851
4952
Documentation for custom data requirements, configuration and overall functionality of demos can be found [in the Docs](https://nrel.github.io/DEMOS/).
5053

5154
## Other ways to run DEMOS
5255

53-
If you need to change either the data or configuration path:
54-
```bash
55-
DEMOS_CONFIG_PATH=<path-to-config> DEMOS_DATA_DIR=<path-to-data-dir> docker compose up
56-
```
57-
58-
Alternatively, if you prefer not to use docker compose, you can specify the ccreation of volumes to your data and configuration as follows:
59-
```bash
60-
docker run --volume <path-to-config>:/demos/config.toml:ro --volume <path-to-data-dir>:/demos/data --platform=linux/amd64 ghcr.io/nrel/demos:latest
61-
```
62-
6356
### Running from Source
6457

58+
If you prefer to create your own Python environment and run the Python code directly (for debugging or enhancing DEMOS capabilities), you can do so following these instructions:
59+
6560
1. Clone this repository
6661
```
67-
git clone https://github.com/NREL/DEMOS_NREL.git
62+
git clone https://github.com/NatLabRockies/DEMOS.git
6863
```
6964

7065
1. Create a virtual environment.

docs/source/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ DEMOS documentation
1313
pages/intro.md
1414
api/modules
1515
pages/configuration
16+
pages/advanced_configuration.md
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Advanced Options for DEMOS
2+
3+
## Configuration of calibration procedures
4+
5+
Certain modules support calibration of the simulation output to observed values. Specific calibration parameters can be set for each module that supports it. If no configuration is provided, calibration is not performed.
6+
7+
Calibration configuration is defined at `module-level-config.calibration_procedure` (`module-level-config` is defined differently for every module. The options are displayed [here](../api/configuration_module.rst) and in each module's documentation).
8+
9+
For example, in the mortality module configuration we find the following:
10+
11+
```toml
12+
[mortality_module_config.calibration_procedure]
13+
procedure_type = "rmse_error"
14+
tolerance_type = "absolute"
15+
tolerance = 1000
16+
max_iter = 1000
17+
[mortality_module_config.calibration_procedure.observed_values_table]
18+
file_type = "csv"
19+
table_name = "observed_fatalities_data"
20+
filepath = "../data/sf_bay_example/observed_calibration_values/mortalities_over_time_obs.csv"
21+
index_col = "year"
22+
```
23+
24+
This section of the configuration file does a couple of things:
25+
- Sets the procedure type to `rmse_error` (currently the only available option)
26+
- Sets the Tolerance type to `absolute`. This means that DEMOS will continue to optimize the output until the absolute difference between the current value predicted and the observed is smaller than this tolerance. An alternative value for this parameter is `relative`, which changes the logic to interpret the tolerance value as relative.
27+
- Sets the tolerance level. If `tolerance_type` is `absolute`, this is an absolute value. Otherwise, this is a percentage
28+
- Sets the maximum number of iterations
29+
- Identifies which data to use for validation by assigning a value to `mortality_module_config.calibration_procedure.observed_values_table`. This has the same format as any other table loade d in the `tables` section of the configuration.
30+
31+
If for example you would like to skip calibration on the mortality module, just delete or comment out all these lines corresponding to `mortality_module_config.calibration_procedure`.
32+
33+
---
34+
35+
Additionally, some modules (namely `employment` and `household_reorganization`) implement simultaneous calibration.
36+
37+
**If you want to use simultaneous calibration for the `employment` module**
38+
39+
```toml
40+
[employment_module_config.simultaneous_calibration_config]
41+
tolerance = 100
42+
max_iter = 2
43+
learning_rate = 2
44+
momentum_weight = 0.3
45+
```
46+
47+
Due to the complexity and nuances of simultaneous calibration, the required tables of observed values (`observed_entering_workforce` and `observed_exiting_workforce`) are hard-coded, and an error will be raised if they are not loaded.
48+
49+
<!-- **If you instead want to use simple calibration**
50+
51+
We need to define the following:
52+
```toml
53+
[employment_module_config.enter_model_calibration_procedure]
54+
procedure_type = "rmse_error"
55+
observed_values_table = "observed_entering_workforce"
56+
tolerance_type = "relative"
57+
tolerance = 0.01
58+
max_iter = 1000
59+
60+
[employment_module_config.exit_model_calibration_procedure]
61+
procedure_type = "rmse_error"
62+
observed_values_table = "observed_exiting_workforce"
63+
tolerance_type = "relative"
64+
tolerance = 0.01
65+
max_iter = 1000
66+
```
67+
68+
This will allow DEMOS to execute calibration on each of the two modules in the employment module.
69+
70+
**If you want to skip calibration, just delete these entrances from the configuration file.**-->
71+
72+
<!-- See the example config for more options, including output tables, calibration, and module selection. -->
73+
74+
## Selection of modules to run
75+
76+
The `modules` parameter in the configuration file accepts a list of strings identifying the modules. By default all are included, but if you'd like to only run a selection of them you can change it. For instance to run only `aging` and `education`:
77+
```
78+
modules = [
79+
"aging",
80+
"education",
81+
]
82+
```

0 commit comments

Comments
 (0)