-
Notifications
You must be signed in to change notification settings - Fork 5
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
base: master
Are you sure you want to change the base?
Conversation
src/tlo/simulation.py
Outdated
@@ -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): |
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.
src/tlo/simulation.py
Outdated
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
Here, we could convert and store Path
type and check that path exists.
…alysis rti_deaths, re-worked test_rti
…tate cancer, fixed test equipment and dxmanager
…e path from simulation.py.
…t.py and breast_cancer.py method updated for resource file path from simulation.py
…t.py and breast_cancer.py method updated for resource file path from simulation.py
…t.py isort the import to fix incorrectly sorted error
…vert to path in simulation
…run_me and associated files
…manager and antenatal_interventions
…to jkumwenda/resource_file_path # Conflicts: # src/tlo/simulation.py
Is there anyone who has an idea how I can solve this problem. Whenever I run |
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.
Well done!!! This seems to do the job, and with a minimum if invasiveness! Thank you.
See a couple of comments/queries.
src/tlo/scenario.py
Outdated
logger.info(key="message", data=f"Running draw {sample['draw_number']}, sample {sample['sample_number']}") | ||
|
||
sim = Simulation( | ||
start_date=self.scenario.start_date, | ||
seed=sample["simulation_seed"], | ||
log_config=log_config, | ||
resourcefilepath=self.scenario.scenario_path) | ||
|
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.
confused about the need for these changes? Should they be on this PR?!?!
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.
I was mostly following the Simulation objects to make changes to them wherever they are... If this change is not necessary for this PR, I can rollback
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.
Yeah if it's not necessary for the PR, then I think it's best to roll it back.
src/tlo/simulation.py
Outdated
def __init__( | ||
self, | ||
*, | ||
start_date: Date, | ||
seed: Optional[int] = None, | ||
log_config: Optional[dict] = None, | ||
show_progress_bar: bool = False, | ||
resourcefilepath: Optional[Path] = None, | ||
resourcefilepath: str = None, |
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.
resourcefilepath: str = None, | |
resourcefilepath: Optional[str|Path] = None, |
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.
Thanks Wati and Joel. This all seems very good to me.
@tamuri and @matt-graham -- this looks ready to go, from my perspective |
Created resource file path function and calling it from different modules.