-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resource file path from simulation #1410
Open
jkumwenda
wants to merge
49
commits into
master
Choose a base branch
from
jkumwenda/resource_file_path
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
6cbd941
#Read function and enhanced lifestyle
jkumwenda 041ab47
Updated the resource file path and register function in simulation.py
jkumwenda 9129f4e
Implemented resourcefilepath for Disease modules to get resource file…
jkumwenda 3f07713
RTI and associated modules
thewati 57870a3
Schisto and associated modules
thewati fc66ff1
analysis_malaria and associated files
thewati 8815e89
analysis file of hiv and associated file, fixed test_schisto
thewati 3dbe968
epi analyses and associated files, removed unused import in analysis rti
thewati 414dbbb
diarhhhoea analyses and associated files, removed unused import in an…
thewati b813ac3
analyses_copd_prev and associated files
thewati 73bac49
alri analyses and associated files, fixed test_enhanced_lifestyle.py
thewati e64735e
prostate_cancer_analyses_logging and associated files, fixed test_hea…
thewati 64a0c7b
other_adult_cancers_analyses_logging and associated files, isort pros…
thewati 6e6be58
analysis_measles.py measles.py test_measles.py fixed for resource fil…
jkumwenda 166ad35
analysis_measles_deaths.py fixed for resource file path from simulati…
jkumwenda 78ad0be
analysis_measles.py removed unused from pathlib import Path .
jkumwenda 690a1f7
breast_cancer_analyses_logging.py calc_5y_survival_following_treatmen…
jkumwenda 0c9dabc
breast_cancer_analyses_logging.py calc_5y_survival_following_treatmen…
jkumwenda ae6309b
breast_cancer_analyses_logging.py calc_5y_survival_following_treatmen…
jkumwenda 0621041
bladder_cancer_analyses_single_run, calc_5y and associated files, con…
thewati 16e026d
fix resourcefilepath for test_beddays and test_cons
thewati 1cb1b88
fix test_demography and associated files, fixed fullmodel file
thewati e5335df
fix test utils, labour and newborn_outcomes
thewati 0adaec0
fix test_postnatal, pregnancy_supervisor, htm_scaleup, rmv unused imp…
thewati b045536
fix test healthburden, control_order_of_events, maternal_health_helpe…
thewati 0acf363
oesophageal cancer survival_following_treatment, analyses_depression_…
thewati 7757a8f
cardiometabolicdisorders_plots(NR) and associated files, test symptom…
thewati 354321f
tb (NR), stunting (NR) analyses and associated files
thewati f441dc0
fix tests epi and simplified_births
thewati ea878eb
all remaining NR anayses
thewati 0af6c2e
fix tests contraception, module_dependencies, fullmodel and determini…
thewati 56f26b6
fix tests logging_end_to_end, basic_sims, find_events, breast_cancer
thewati 43b195b
fix tests healthsystem, analysis
thewati bfc8e32
Merge branch 'master' into jkumwenda/resource_file_path
thewati 9559acf
fix failing tests after merging
thewati c660f69
Merge branch 'master' into jkumwenda/resource_file_path
thewati cdd90be
to be debugged
thewati 99c1c7c
update simulation file
thewati 7eb8e0a
Merge remote-tracking branch 'origin/jkumwenda/resource_file_path' in…
thewati 5c9a9ad
update the simulation file
thewati 4184764
fix errors in scenario and tes_sim
thewati ea16635
update to scenario and tlo_parameters
thewati 98873e5
fix test_module_dependencies, health_system, simulation
thewati fc5f5c6
fix scripts
thewati d5ed651
fix hiv_tb_calibration file res access, and test to check resourcefil…
thewati 2cd182d
remove unexpected resourcefilepath in simulation
thewati c8adb0c
Merge branch 'master' into jkumwenda/resource_file_path
mnjowe 4e14f59
review resourcefilepath in sim and rmv spaces in scenario
thewati 481ee3f
Rollback scenario.py
thewati File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
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 |
---|---|---|
|
@@ -44,7 +44,7 @@ class Simulation: | |
""" | ||
|
||
def __init__(self, *, start_date: Date, seed: int = None, log_config: dict = None, | ||
show_progress_bar=False): | ||
show_progress_bar=False, resourcefilepath = None): | ||
"""Create a new simulation. | ||
|
||
:param start_date: the date the simulation begins; must be given as | ||
|
@@ -53,6 +53,7 @@ def __init__(self, *, start_date: Date, seed: int = None, log_config: dict = Non | |
:param log_config: sets up the logging configuration for this simulation | ||
:param show_progress_bar: whether to show a progress bar instead of the logger | ||
output during the simulation | ||
:param resourcefilepath: path to the resources folder | ||
""" | ||
# simulation | ||
self.date = self.start_date = start_date | ||
|
@@ -80,6 +81,7 @@ def __init__(self, *, start_date: Date, seed: int = None, log_config: dict = Non | |
data=f'Simulation RNG {seed_from} entropy = {self._seed_seq.entropy}' | ||
) | ||
self.rng = np.random.RandomState(np.random.MT19937(self._seed_seq)) | ||
self.resourcefilepath = resourcefilepath | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here, we could convert and store |
||
|
||
def _configure_logging(self, filename: str = None, directory: Union[Path, str] = "./outputs", | ||
custom_levels: Dict[str, int] = None, suppress_stdout: bool = False): | ||
|
@@ -165,7 +167,7 @@ def register(self, *modules, sort_modules=True, check_all_dependencies=True): | |
|
||
self.modules[module.name] = module | ||
module.sim = self | ||
module.read_parameters('') | ||
module.read_parameters(self.resourcefilepath) | ||
|
||
if self._custom_log_levels: | ||
logging.set_logging_levels(self._custom_log_levels) | ||
|
@@ -313,7 +315,6 @@ def find_events_for_person(self, person_id: int): | |
|
||
return person_events | ||
|
||
|
||
class EventQueue: | ||
"""A simple priority queue for events. | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add str type hint to resourcefilepath.