Coder Social home page Coder Social logo

ramp-ua's People

Contributors

ciupava avatar cshenton avatar hsalat avatar jabrams23 avatar masher92 avatar nickmalleson avatar nnelissen avatar rory-improbable avatar sparrow0hawk avatar spoonerf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ramp-ua's Issues

Add commuting

Assign 'virtual' commuting locations for each individual based on occupation. I.e. all accountants go to one virtual account office etc.

Not reading parameter file (`-npf` argument) causes crash

python microsim/microsim_model.py -npf

Causes:

Not reading a parameters file
Traceback (most recent call last):
  File "microsim/microsim_model.py", line 1619, in <module>
    run_script()
  File "/Users/nick/opt/anaconda3/envs/ramp-ua/lib/python3.7/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/Users/nick/opt/anaconda3/envs/ramp-ua/lib/python3.7/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/Users/nick/opt/anaconda3/envs/ramp-ua/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/nick/opt/anaconda3/envs/ramp-ua/lib/python3.7/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "microsim/microsim_model.py", line 1552, in run_script
    print(f"Running model with the following parameters:\n"
UnboundLocalError: local variable 'calibration_params' referenced before assignment

Implement commuting behaviour

Occupation / Industry will be provided by Karyn. Then check individual's occupations and assign all individuals who do the same occupation to the same 'Location' (i.e. similar to them all going to the same Retail venue).

Check parameters in `Microsim.__init__()`

Currently in microsim_model.run_script() there are checks that the parameter combinations make sense. DO these in a function and also check the relevant ones in the Microsim constructor in case someone calls the constructor directly (rather than going through run_script.

Check add_home_flows

Test it, but especially it uses 'HID' which I don't think uniquely identifies a house any more

Microsim model run error on Windows

Problem and stacktrace

Testing out the microsim/microsim_model.py from master branch (commit d2d00af) on Windows leads to a rpy2 error.

$ python microsim/microsim_model.py
Traceback (most recent call last):
File "microsim/microsim_model.py", line 15, in
from r_interface import RInterface
File "C:\Users\medacola\Code\forks\RAMP-UA\microsim\r_interface.py", line 3, in
import rpy2.rinterface
File "C:\Users\medacola\AppData\Local\Continuum\anaconda3\envs\ramp-ua\lib\site-packages\rpy2\rinterface.py", line 6, in
from rpy2.rinterface_lib import openrlib
File "C:\Users\medacola\AppData\Local\Continuum\anaconda3\envs\ramp-ua\lib\site-packages\rpy2\rinterface_lib\openrlib.py", line 44, in
rlib = _dlopen_rlib(R_HOME)
File "C:\Users\medacola\AppData\Local\Continuum\anaconda3\envs\ramp-ua\lib\site-packages\rpy2\rinterface_lib\openrlib.py", line 37, in _dlopen_rlib
rlib = ffi.dlopen(lib_path)
OSError: cannot load library 'C:\Users\medacola\AppData\Local\Continuum\anaconda3\envs\ramp-ua\lib\R\bin\x64\R.dll': error 0x7e

This look like it can't see R installed within the conda environment.

Steps to reproduce

On windows 10 via git-bash:

conda activate ramp-ua
cd RAMP-UA
python microsim/microsim_model.py

I've previously created the conda environment using the environment.yml and pulled in data using git lfs checkout.

Document problem with janitor library

It's an R library we need. But can't be installed with the rest through conda install r-janitor. So needs to be installed manually using R install.packages('janotor')

Sensitivity analysis

Comprehensive assessment of sensitiviy to different parameters throughout the model

Correct all tests

After the extensive changes to the code most of the tests don't work now. I think the problems are:

1 - the test_microsim object gets manipulated by a number of different functions which will interferre with each other. maybe need to copy it first?

2 - some of the fields (e.g. PID, HID) are not longer present int he dataframe, and some of the individuals will have changed (e.g. not the same people in the same houses any more

AssertionError in covid_run.R on Windows

Issue and stacktrace

$ python microsim/microsim_model.py
C:\Users\medacola\AppData\Local\Continuum\anaconda3\envs\ramp-ua\lib\site-packages\rpy2\robjects\pandas2ri.py:17: FutureWarning: pandas.core.index is deprecated and will be removed i
n a future version.  The public classes are available in the top-level namespace.
  from pandas.core.index import Index as PandasIndex
Reading parameters file: ./model_parameters/default.yml. Any other command-line arguments are being ignored
Running model with the following parameters:
        Parameters file: ./model_parameters/default.yml
        Number of iterations: 10
        Data dir: devon_data
        Outputting results?: True
        Debug mode?: False
        Number of repetitions: 1
        Lockdown from file? : True
        Calibration parameters: {'hazard_multiplier_presymptomatic': 1.0, 'hazard_multiplier_asymptomatic': 1.0, 'hazard_multiplier_symptomatic': 1.0, 'risk_multiplier': 1.0}

Reading time use and health data ...
microsim/microsim_model.py:440: UserWarning: There are 6 / 695308 non-unique individuals.
  warnings.warn(f"There are {len(tuh)-len(set(unique_individuals))} / {len(tuh)} non-unique individuals.")
microsim/microsim_model.py:489: UserWarning: 32 people > 18y/o go to school, but they are not being assigned to a primary or secondary school (so their schooling is ignored at the mo
ment
  warnings.warn(f"{len(adults_in_school)} people > 18y/o go to school, but they are not being assigned to a "
microsim/microsim_model.py:500: UserWarning: There are 0 households with more than 10 people in them. This covers 0 people. These households are being removed.
  warnings.warn(f"There are {len(large_house_idx)} households with more than 10 people in them. This covers "
... finished reading TU&H data. There are 695308 individuals in 346343 houses over 107 MSOAs
Reading retail flow data for Devon...
... read 106990.0 flows from 107 areas.
Assigning individual flows for Retail: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████| 107/107 [00:05<00:00, 20.01it/s]
Reading school flow data for Devon...
... finished reading school flows.
Assigning individual flows for PrimarySchool: 100%|████████████████████████████████████████████████████████████████████████████████████████████████| 107/107 [00:05<00:00, 18.29it/s]
Assigning individual flows for SecondarySchool: 100%|██████████████████████████████████████████████████████████████████████████████████████████████| 107/107 [00:07<00:00, 14.87it/s]
Assigning work venues ...
C:\Users\medacola\AppData\Local\Continuum\anaconda3\envs\ramp-ua\lib\site-packages\rpy2\robjects\pandas2ri.py:17: FutureWarning: pandas.core.index is deprecated and will be removed i
n a future version.  The public classes are available in the top-level namespace.
  from pandas.core.index import Index as PandasIndex
C:\Users\medacola\AppData\Local\Continuum\anaconda3\envs\ramp-ua\lib\site-packages\rpy2\robjects\pandas2ri.py:17: FutureWarning: pandas.core.index is deprecated and will be removed i
n a future version.  The public classes are available in the top-level namespace.
  from pandas.core.index import Index as PandasIndex
C:\Users\medacola\AppData\Local\Continuum\anaconda3\envs\ramp-ua\lib\site-packages\rpy2\robjects\pandas2ri.py:17: FutureWarning: pandas.core.index is deprecated and will be removed i
n a future version.  The public classes are available in the top-level namespace.
  from pandas.core.index import Index as PandasIndex
C:\Users\medacola\AppData\Local\Continuum\anaconda3\envs\ramp-ua\lib\site-packages\rpy2\robjects\pandas2ri.py:17: FutureWarning: pandas.core.index is deprecated and will be removed i
n a future version.  The public classes are available in the top-level namespace.
  from pandas.core.index import Index as PandasIndex
Rounding all durations: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 5/5 [00:02<00:00,  1.72it/s]
Reading time activity multiplier data...
 ... finished initialisation.
Saving initial models for analysis ...
Initialising R interface. Loading R scripts in C:\Users\medacola\Code\forks\RAMP-UA\R\py_int.
package is up-to-date devel version

Attaching package: 'dplyr'

The following objects are masked from 'package:stats':

    filter, lag

The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union


Iteration: 1

        Applying regular (google mobility) multiplier 0.9305173110479441
        Updating danger associated with visiting each venue
                Home activity
                Retail activity
                PrimarySchool activity
                SecondarySchool activity
                Work activity
        Calculating new disease status...[1] "R timestep: 1"
[1] "First day seeded"
[1] "0 individuals with risk above  5"
[1] "betas calculated"
[1] "probabilities calculated"
[1] "cases assigned"
[1] "PHE cases 10"
[1] "model cases 0"
[1] "Adjusted PHE cases 10"
[1] "w is 0"
[1] "infection and recovery lengths assigned"
[1] "individuals removed"
[1] "updating infection lengths"
Traceback (most recent call last):
  File "microsim/microsim_model.py", line 1619, in <module>
  File "C:\Users\medacola\AppData\Local\Continuum\anaconda3\envs\ramp-ua\lib\site-packages\click\core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\medacola\AppData\Local\Continuum\anaconda3\envs\ramp-ua\lib\site-packages\click\core.py", line 782, in main
    rv = self.invoke(ctx)
  File "C:\Users\medacola\AppData\Local\Continuum\anaconda3\envs\ramp-ua\lib\site-packages\click\core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\medacola\AppData\Local\Continuum\anaconda3\envs\ramp-ua\lib\site-packages\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "microsim/microsim_model.py", line 1595, in run_script
  File "microsim/microsim_model.py", line 1452, in run
  File "microsim/microsim_model.py", line 1433, in step
  File "microsim/microsim_model.py", line 1306, in calculate_new_disease_status
  File "C:\Users\medacola\Code\forks\RAMP-UA\microsim\r_interface.py", line 62, in calculate_disease_status
    assert len(r_df) == len(individuals)
AssertionError

Steps to reproduce

Windows 10, within ramp-ua conda environment, calling microsim/microsim_model.py

Make different flows for different individuals / households

At the moment all indivduals in an area share the same flows. These need to be broken down by individual characteristics. E.g. children of correct age go to primary/seconary school (adults will have no flows to secondary schools). I think we will need two activity locations, primary schools and secondary schools (at the moment just have 'schools')

Check new comments in `Microsim.__init__()`

I added a big explanation about how to add activies. Could you read through the stuff in Microsim.__init_() to see if it makes sense? If someone else was to help us with the code, do you think the process is clear enough?

Infectivity multiplier for locations

Create a multiplier for locations that increases/decreases the infectiveness of the place. E.g. we could make PrimarySchool locations less infective.

Implement `(deep)copy` properly

At the moment there is a Microsim._make_a_copy function that resets the random seed and then calls copy.deepcopy. Implement this properly by overridding __deepcopy__

Check venues, flows, durations

Check that the dummy data have been read in correctly. E.g. check the number of individuals is
accurate, that they link to households correctly, that they have the right flows to the right
destinations and the right durations etc.

Do this in test_microsim()

Test the model with dummy data

There are some dummy data avialbale that can test the model. See test_microsim() and test_step(test_microsim) in test_microsimulation_model.py. Now need to write some tests/checks to make sure that population that is created and stepped correctly

Failed to install 'unknown package' from GitHub

Sorry that my first message back is about a bug! Any idea what might be causing this? I have pulled the latest of master after merging pull request #76 and have updated my R libraries

Saving initial models for analysis ... 
Initialising R interface. Loading R scripts in /Users/nick/gp/RAMP-UA/R/py_int.
R[write to console]: Error: Failed to install 'unknown package' from GitHub:
  HTTP error 404.
  No commit found for the ref no_ff

  Did you spell the repo owner (`Urban-Analytics`) and repo name (`rampuaR`) correctly?
  - If spelling is correct, check that you have the required permissions to access the repo.

	Error trying to start R: Error: Failed to install 'unknown package' from GitHub:
  HTTP error 404.
  No commit found for the ref no_ff

  Did you spell the repo owner (`Urban-Analytics`) and repo name (`rampuaR`) correctly?
  - If spelling is correct, check that you have the required permissions to access the repo.
. Libraries probably need installing. Look in the file'R/py_int/covid_run.R' to see which libraries are needed.
Traceback (most recent call last):
  File "microsim/microsim_model.py", line 1619, in <module>
    run_script()
  File "/Users/nick/anaconda3/envs/ramp-ua/lib/python3.7/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/Users/nick/anaconda3/envs/ramp-ua/lib/python3.7/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/Users/nick/anaconda3/envs/ramp-ua/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/nick/anaconda3/envs/ramp-ua/lib/python3.7/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "microsim/microsim_model.py", line 1595, in run_script
    m.run(iterations)
  File "microsim/microsim_model.py", line 1447, in run
    self.r_int = RInterface(self.r_script_dir)
  File "/Users/nick/gp/RAMP-UA/microsim/r_interface.py", line 35, in __init__
    raise e
  File "/Users/nick/gp/RAMP-UA/microsim/r_interface.py", line 27, in __init__
    R.source("covid_run.R")
  File "/Users/nick/anaconda3/envs/ramp-ua/lib/python3.7/site-packages/rpy2/robjects/functions.py", line 198, in __call__
    .__call__(*args, **kwargs))
  File "/Users/nick/anaconda3/envs/ramp-ua/lib/python3.7/site-packages/rpy2/robjects/functions.py", line 125, in __call__
    res = super(Function, self).__call__(*new_args, **new_kwargs)
  File "/Users/nick/anaconda3/envs/ramp-ua/lib/python3.7/site-packages/rpy2/rinterface_lib/conversion.py", line 44, in _
    cdata = function(*args, **kwargs)
  File "/Users/nick/anaconda3/envs/ramp-ua/lib/python3.7/site-packages/rpy2/rinterface.py", line 621, in __call__
    raise embedded.RRuntimeError(_rinterface._geterrmessage())
rpy2.rinterface_lib.embedded.RRuntimeError: Error: Failed to install 'unknown package' from GitHub:
  HTTP error 404.
  No commit found for the ref no_ff

  Did you spell the repo owner (`Urban-Analytics`) and repo name (`rampuaR`) correctly?
  - If spelling is correct, check that you have the required permissions to access the repo.

Tidy up of R/py_int and adding some tests or moving things to functions or rampuaR

The R/py_int directory has alot going on in it and from as far as I can tell the most important bits are output/ and covid_run.R.

It'd be great if we could do the following:

  • - go through files listed below that exist in that directory and determine if they're in the right place/can de removed/moved
  • - break up run_status as much as possible into smaller functions with tests so we can better try and isolate problems

Files to decide on:

  • covid_run_py.R
  • .Rhistory (unless this has something super important in there we should remove this)
  • covid_status_functions.R - is this now in rampuaR?
  • devon_cases.RDS - if this is essential we should move it to a data directory
  • gam_fitted_PHE_cases.RDS - same as above
  • google_mobility_all_LAD.R - is this now in rampuaR?
  • initialize_and_helper_functions.R - is this now in rampuaR?
  • lockdown_multiplier.R - is this now in rampuaR?
  • msoa_danger_fn.csv - same as RDS files above
  • plotting_new_cases.R - is this now in rampuaR?

Thoughts welcome!

Implement pre- and post-lockdown stages

Edit step() so that the model runs for 2 weeks in 'pre-lockdown' mode then for 2 weeks in 'post-lockdown' mode. After lockdown then use mobility data to esimate changes in time use (see #15)

test_analysis.py file in tests/

In the PR #56 I moved the file test_analysis.py into the tests/ directory.

This is the consistent cause of the test suite failing so i'm going to create an issue on this to keep track of what we're doing about it.

I've tagged in @nickmalleson and @nnelissen as i'd like your input on whether this file is a test file (and so we can update it to pass) or if its an artefact of when you were informally testing stuff (and so it can be removed from the repo).

Update test data

I'm attempting to troubleshoot #79 but have found a discrepancy in the working devon data and dummy data. New devon data appears to include an extra age column.

Could we update the dummy data file here to include this column to help me troubleshoot.

I'm not sure how it was created but if its just a simple subsetting operation I'm happy to do it but want to check with @nickmalleson first.

Microsim model error: multiple repetitions?

@Sparrow0hawk When running more than 1 set (I think parameter repetitions), seems to want to re-use existing directory from previous repetition? Full error below:

Iteration 3 took 118.96s
Model finished running (iterations: 4)
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/home/natalie/anaconda3/envs/ramp-ua/lib/python3.7/multiprocessing/pool.py", line 121, in worker
result = (True, func(*args, **kwds))
File "/home/natalie/anaconda3/envs/ramp-ua/lib/python3.7/multiprocessing/pool.py", line 47, in starmapstar
return list(itertools.starmap(args[0], args[1]))
File "microsim/microsim_model.py", line 1658, in _run_multicore
return m.run(iter)
File "microsim/microsim_model.py", line 1497, in run
self._init_output()
File "microsim/microsim_model.py", line 1129, in _init_output
self.output_dir = Microsim._find_new_directory(os.path.join(self.DATA_DIR, "output"))
File "microsim/microsim_model.py", line 299, in _find_new_directory
raise e
File "microsim/microsim_model.py", line 296, in _find_new_directory
os.mkdir(results_subdir)
FileExistsError: [Errno 17] File exists: '/home/natalie/Documents/RAMP-UA/devon_data/output/2'
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "microsim/microsim_model.py", line 1662, in
run_script()
File "/home/natalie/anaconda3/envs/ramp-ua/lib/python3.7/site-packages/click/core.py", line 829, in call
return self.main(*args, **kwargs)
File "/home/natalie/anaconda3/envs/ramp-ua/lib/python3.7/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/home/natalie/anaconda3/envs/ramp-ua/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/natalie/anaconda3/envs/ramp-ua/lib/python3.7/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "microsim/microsim_model.py", line 1650, in run_script
pool.starmap(_run_multicore, zip(models, iters))
File "/home/natalie/anaconda3/envs/ramp-ua/lib/python3.7/multiprocessing/pool.py", line 276, in starmap
return self._map_async(func, iterable, starmapstar, chunksize).get()
File "/home/natalie/anaconda3/envs/ramp-ua/lib/python3.7/multiprocessing/pool.py", line 657, in get
raise self._value
File "/home/natalie/anaconda3/envs/ramp-ua/lib/python3.7/multiprocessing/pool.py", line 121, in worker
result = (True, func(*args, **kwds))
File "/home/natalie/anaconda3/envs/ramp-ua/lib/python3.7/multiprocessing/pool.py", line 47, in starmapstar
return list(itertools.starmap(args[0], args[1]))
File "microsim/microsim_model.py", line 1658, in _run_multicore
return m.run(iter)
File "microsim/microsim_model.py", line 1497, in run
self._init_output()
File "microsim/microsim_model.py", line 1129, in _init_output
self.output_dir = Microsim._find_new_directory(os.path.join(self.DATA_DIR, "output"))
File "microsim/microsim_model.py", line 299, in _find_new_directory
raise e
File "microsim/microsim_model.py", line 296, in _find_new_directory
os.mkdir(results_subdir)
FileExistsError: [Errno 17] File exists: '/home/natalie/Documents/RAMP-UA/devon_data/output/2'

Formalise column names for locations

At the moment I have hard coded columns like 'x_Flows', 'x_Venues', (where x = 'Retail', 'School', etc.). Define these strings formally somewhere e.g. in the ColumnNames class.

Multiple output writing

At the moment the model writes the pickle files after every step. See microsim_model.py around line 1421. Is this necessary? Could it just do it at the end?

Include time-activity data

Karyn provided national time-used data for the different activities. In lieu of more comprehensive time-use data, use these national numbers.

Calculate location danger properly

  • Implement danger emparted onto locations properly. Should be a function of disease status, proprtion of flows to loction, proportion of time spent doing activity. See update_venue_danger

Normalise flows

When individuals are assigned to locations the flows should be normalised so that, for each individual, they sum to 1

Calibrate / validate across multiple data sets

Rather than just calibrating against total cases, we should also look at distributions by age, over space, by workplace, etc. We might be able to get the absolute numbers of cases right, but need to make sure the right people are being infected in the right places as well.

Add Home locations (same as Retail,School, etc)

Already have household data from the microsim. Turn this into a 'Location' dataset in a simliar way to Retail. Note: all flows will be 100% to one Location (where ID == HID)

retail_name = "Retail" # How to refer to this in data frame columns etc.
        stores, stores_flows = Microsim.read_retail_flows_data(self.study_msoas)  # (list of shops and a flow matrix)
        Microsim.check_sim_flows(stores, stores_flows)
  # Assign Retail
        self.individuals = Microsim.add_individual_flows(retail_name, self.individuals, stores_flows)
        self.activity_locations[retail_name] = ActivityLocation(retail_name, stores, stores_flows)

Separate primary and secondary school durations

Need to separate primary and secondary school duration. At the moment everyone is given the same duration, 'pschool', which means that children will be assigned a PrimarySchool duration and seconary school duration, regardless of their age.

I think the only way round this is to make two new columns - 'pschool_primary' and 'pschool_seconary', and set these to either 'pschool' or 0 depending on the age of the child.

See the commenrs around # Assign Schools in `Microsim.init().

Microsim test failure on Windows : test_random

Problem and stacktrace

Tests start to run but now fail on test_random. Something i'll create a new issue for.

def test_random():
"""
Checks that random classes are produce different (or the same!) numbers when they should do
:return:
"""
m1 = Microsim(**microsim_args, read_data=False)
m2 = Microsim(**microsim_args, random_seed=2.0, read_data=False)
m3 = Microsim(**microsim_args, random_seed=2.0, read_data=False)

    # Genrate a random number from each model. The second two numbers should be the same
    r1, r2, r3 = [_get_rand(x) for x in [m1, m2, m3]]

    assert r1 != r2
    assert r2 == r3

    # Check that this still happens even if they are executed in pools.
    # Create a large number of microsims and check that all random numbers are unique
    pool = multiprocessing.Pool()
    m = [Microsim(**microsim_args, read_data=False) for _ in range(10000)]
    r = pool.map(_get_rand, m)
  assert len(r) == len(set(r))

E assert 10000 == 409
E + where 10000 = len([0.008873069293537483, 0.008873069293537483, 0.008873069293537483, 0.008873069293537483, 0.008873069293537483, 0.008873069293537483, ...])
E + and 409 = len({0.0004759783146218721, 0.0010528736536226102, 0.008873069293537483, 0.009529687314436819, 0.011380324399635655, 0.012347288919539401, ...})
E + where {0.0004759783146218721, 0.0010528736536226102, 0.008873069293537483, 0.009529687314436819, 0.011380324399635655, 0.012347288919539401, ...} = set([0.008873069293537483, 0.008873069293537483, 0.008873069293537483, 0.008873069293537483, 0.008873069293537483, 0.008873069293537483, ...])

Steps to reproduce

On Windows 10 with git bash:

conda activate ramp-ua
pytest

Reproduced within GitHub actions Windows test runner (https://github.com/Urban-Analytics/RAMP-UA/actions/runs/189880378)

Save and reload state

Allow to save the current state of the model (e.g. the individuals dataframe, locations dataframes, etc) and reload. Should make it possible to speed things up (don't need to reload and analyse raw text files) and good practice for repeatability.

Add specific multipliers for different dangers

Thought I'd try creating an issue rather than emailing. @nnelissen & @Sparrow0hawk I've included you mostly for info.

@spoonerf & @jabrams23 I've added hazards multipliers that people give to the shops etc. once they have the disease, and also included a risk multiplier (we could have more of these in the future to model the impacts of some people being more likely to contract the disease than others).

In the default.yml file there is now:

microsim_calibration:
  # These multiply the amount of hazard that individuals pass on to shops etc:
  hazard_multiplier_presymptomatic: 1.0
  hazard_multiplier_asymptomatic: 1.0
  hazard_multiplier_symptomatic: 1.0
  # This multiplies the risk received as individuals visit shops etc.
  risk_multiplier: 1.0

The changes are on my branch (dev_NM): f967e1c

I've checked that the parameters get read in properly, which is fine, but I haven't been able to test it though because I am getting a problem with the libraries; see #69

If these multipliers aren't urgent then I can sort them out when I get back from holiday in 10 days. But if you want them sooner could you try running my branch to see if they work? Let me know if they don't and I can probably have a look at it while I'm off.

Error in c("rampuaR", ) : argument 2 is empty

Hi both,

I'm getting this error, any ideas? I think I'm missing a package, but am not sure which one. I have noticed that the following new packages have been added to environment.yml:

  • r-data.table
  • r-mixdist
  • r-mgcv
  • r-RecordLinkage
  • r-tidyselect
    and have installed them all without any issues but get the following:
R[write to console]: Error in c("rampuaR", ) : argument 2 is empty

	Error trying to start R: Error in c("rampuaR", ) : argument 2 is empty
. Libraries probably need installing. Look in the file'R/py_int/covid_run.R' to see which libraries are needed.
Traceback (most recent call last):
  File "microsim/microsim_model.py", line 1619, in <module>
    run_script()
  File "/Users/nick/opt/anaconda3/envs/ramp-ua/lib/python3.7/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/Users/nick/opt/anaconda3/envs/ramp-ua/lib/python3.7/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/Users/nick/opt/anaconda3/envs/ramp-ua/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/nick/opt/anaconda3/envs/ramp-ua/lib/python3.7/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "microsim/microsim_model.py", line 1595, in run_script
    m.run(iterations)
  File "microsim/microsim_model.py", line 1447, in run
    self.r_int = RInterface(self.r_script_dir)
  File "/Users/nick/research_not_syncd/git_projects/RAMP-UA/microsim/r_interface.py", line 35, in __init__
    raise e
  File "/Users/nick/research_not_syncd/git_projects/RAMP-UA/microsim/r_interface.py", line 27, in __init__
    R.source("covid_run.R")
  File "/Users/nick/opt/anaconda3/envs/ramp-ua/lib/python3.7/site-packages/rpy2/robjects/functions.py", line 198, in __call__
    .__call__(*args, **kwargs))
  File "/Users/nick/opt/anaconda3/envs/ramp-ua/lib/python3.7/site-packages/rpy2/robjects/functions.py", line 125, in __call__
    res = super(Function, self).__call__(*new_args, **new_kwargs)
  File "/Users/nick/opt/anaconda3/envs/ramp-ua/lib/python3.7/site-packages/rpy2/rinterface_lib/conversion.py", line 44, in _
    cdata = function(*args, **kwargs)
  File "/Users/nick/opt/anaconda3/envs/ramp-ua/lib/python3.7/site-packages/rpy2/rinterface.py", line 621, in __call__
    raise embedded.RRuntimeError(_rinterface._geterrmessage())
rpy2.rinterface_lib.embedded.RRuntimeError: Error in c("rampuaR", ) : argument 2 is empty

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.