-
Notifications
You must be signed in to change notification settings - Fork 1
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
add load_pickle mode and create_pickle_in_report option #205
base: dev
Are you sure you want to change the base?
Conversation
|
||
mode = ["load_pickle"] | ||
|
||
Instead of simulating given scenario, read in pickle file instead. Needs the `load_pickle` option to point to a pickle file. If the `load_pickle` option is set, `load_pickle` must be the first mode. However, this mode may come in later in the mode chain again, reloading schedule and scenario from file. Options in config file that are stored in schedule are ignored. |
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.
Instead of simulating ("a" or "the") given scenario.
Suggestion for the rest, with more focus on what the mode does
"Instead of generating a scenario based on file for trip, vehicle and station data, a previously simulated scenario is loaded. This scenario already contains results. Modes can be chained after load_pickle in the usual fashion. Multiple "load_pickle" modes per chain are allowed....
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.
# However, cost parameters are supposed to be mutable after loading from pickle
should be mentioned as well
# Pickle current schedule and scenario during report mode | ||
# create_pickle_in_report = false | ||
# Load this pickle file, expects load_pickle as first mode | ||
# load_pickle = "example.pkl" |
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 verbose that its a path. for me "load_pickle" reads like a bool
if isinstance(args.mode, list): | ||
first_mode = args.mode[0] | ||
else: | ||
first_mode = args.mode |
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.
why do we cast to list?
calling a single mode = [load_pickle]
or mode = load_pickle
would only load the schedule in memory and then quit, right? in other words it should be enforced it is a list with at least one element following. but this is again not the job of simulate.
args loading should check that multiple modes are given or running the simulation has basically no use. I dont see the use in backwards compatibility at this point, since a single mode does not really produce any useful output anymore @j-brendel
its also a duplication of simulate.py 98ff
how about moving the cast of simulate.py to previous args handling. then modes_simulation() can skip it as well as simulate
if isinstance(args.mode, list): | ||
first_mode = args.mode[0] | ||
else: | ||
first_mode = args.mode | ||
assert first_mode == "load_pickle", "Load pickle: first mode must be load_pickle" | ||
# schedule and scenario read out from pickle file in first mode | ||
# DataContainer is part of schedule | ||
schedule = None | ||
scenario = "pickle" # must not be 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.
with the above change i would like
assert args.mode[0] == "load_pickle"
schedule, scenario = load_pickle(None, None, args=args)
args.mode = args.mode[1:]
i really dislike changing type of scenario, even for just a short while.
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.
please consider my suggestions.
Also dev must be merged
Implements #116
Requires dill, as standard pickle can't handle parametrized
Trip.consumption.calculate_consumption.interpol_function