-
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
base: master
Are you sure you want to change the base?
Changes from 3 commits
6cbd941
041ab47
9129f4e
3f07713
57870a3
fc66ff1
8815e89
3dbe968
414dbbb
b813ac3
73bac49
e64735e
64a0c7b
6e6be58
166ad35
78ad0be
690a1f7
0c9dabc
ae6309b
0621041
16e026d
1cb1b88
e5335df
0adaec0
b045536
0acf363
7757a8f
354321f
f441dc0
ea878eb
0af6c2e
56f26b6
43b195b
bfc8e32
9559acf
c660f69
cdd90be
99c1c7c
7eb8e0a
5c9a9ad
4184764
ea16635
98873e5
fc5f5c6
d5ed651
2cd182d
c8adb0c
4e14f59
481ee3f
7e37bd6
26e8ad3
8d2ac7c
0798c6f
b1c079c
c3545ad
d5bf63d
2f93e27
2635ea4
c50606b
b1029c9
584ed45
342cca6
936f42a
04b00a4
740ce3f
11eef01
d049a0c
16edc89
dc77227
484baa7
23e2ab7
775973c
c5d20a8
821912e
e7dfdec
b6f3386
4dd208c
ab37453
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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): | ||
tbhallett marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"""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 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. I think this hasn't;t been done yet (the check that the path exists) 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. Finished working on this. May you check if its what you had in mind |
||
|
||
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. | ||
|
||
|
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.
make it
resourcefilepath = Path('./resources')
?