name | arguments | returns |
is_enabled | | |
Return True if the history-keeping is enabled
:return:
|
name | arguments | returns |
get_history | | |
:return: Object of one of the following types:
CollectionTabular, CollectionArray, Collection
|
name | arguments | returns |
enable_history_common | frequency=1, chem_labels=None | None |
Activate the keeping of historical data (the specifics
will depend on the child class)
:param frequency: How many simulation cycles to wait until taking another data snapshot
:param chem_labels:
:return: None
|
name | arguments | returns |
disable_history | | None |
Inactivate any further captures related to this history.
Nothing is deleted: neither the history nor its parameters;
this history-keeping may later be resumed (possibly with different parameters)
by a call to enable_history()
:return: None
|
name | arguments | returns |
to_capture | step_count=None, extra=False | bool |
Return True if various criteria indicate that a snapshot should be taken at the give step_count;
False otherwise
Note that when step_count is 0 there's no capture, unless the frequency is 1
:param step_count: None means always capture
:param extra: [OPTIONAL] If True, it means that this is a special extra capture;
the capture frequency will NOT considered in the
decision about saving it, but an extra check will be performed
to make sure it's not a duplicate of the earlier capture
:return:
|
name | arguments | returns |
start_csv_log | log_file :str | None |
Register the specified filename for all future CSV logs.
Any existing file by that name will get over-written.
:param log_file:Name of a file to use for the CSV logs
:return: None
|
name | arguments | returns |
save_snapshot_common | system_time, data_snapshot, step_count=None, caption="" | str |
:param system_time:
:param data_snapshot: Data format will vary in different child classes
:param step_count:
:param caption: [OPTIONAL] String to save alongside this snapshot; if not provided,
the object property self.initial_caption is used, if that was set
:return: The caption that was actually used
|
name | arguments | returns |
set_caption_last_snapshot | caption | None |
Add a caption to the very last entry in the system history.
No action taken is caption is None
:param caption:
:return: None
|
name | arguments | returns |
__init__ | bins=None, *args, **kwargs | |
:param bins: List of bin addresses for which history is to be kept; use None to mean all
:param args:
:param kwargs:
|
name | arguments | returns |
enable_history | frequency=1, chem_labels=None, bins=None | None |
Request history capture, with the specified parameters.
If history was already enabled, this function can be used to alter its capture parameters.
:param frequency: [OPTIONAL] How many simulation cycles to wait until taking another data snapshot
:param chem_labels: [OPTIONAL] List of chemicals to include in the history;
if None (default), include them all.
:param bins: [OPTIONAL] Bin address, or list of them;
if None (default), include them all.
:return: None
|
name | arguments | returns |
save_snapshot | system_time, data_snapshot, step_count=None, caption="" | None |
EXAMPLE of data_snapshot (for 1D) systems:
{ 5: {"A": 1.3, "B": 3.9},
8: {"A": 4.6, "B": 2.7}
}
EXAMPLE of data_snapshot (for 2D) systems:
{ (0,0): {"A": 1.3, "B": 3.9},
(3,5): {"A": 4.6, "B": 2.7}
}
:param system_time: The time of this data snapshot
:param data_snapshot:
:param step_count:
:param caption: [OPTIONAL] String to save alongside this snapshot
:return: None
|
name | arguments | returns |
bin_history_size | | int |
Return the number of data points in the history kept so far
:return: An integer
|
name | arguments | returns |
bin_history | bin_address, include_captions=False, downsize=1 | |
Return the history at the given bin, as a Pandas dataframe.
The first column is "SYSTEM TIME", and the other ones are the various chemicals for which
history had been enabled.
If no historical data is located, an informational string is returned instead
:param bin_address: A single bin address. EXAMPLES, in 1D: 8 In 2D : (3,3)
:param include_captions: [OPTIONAL] If True, the captions are returned as an extra "caption" column at the end
:param downsize: [OPTIONAL] Pare down the returned history.
If different from 1, include only every n-th entry, where n = downsize,
starting with the initial (0-th) one. The final row is also always included, regardless.
Note: handy when the user unwisely collected an excessive amount of history!
:return: A Pandas data frame,
or a string with diagnostic suggestions if no historical data is present
|
name | arguments | returns |
__init__ | rxns=None, *args, **kwargs | |
:param rxns: List of reactions (identified by their index) for which history is to be kept;
use None to mean all
:param args:
:param kwargs:
|
name | arguments | returns |
enable_history | frequency=1, chem_labels=None, rxns=None | None |
Request history capture, with the specified parameters.
If history was already enabled, this function can be used to alter its capture parameters.
:param frequency: [OPTIONAL] How many simulation cycles to wait until taking another data snapshot
:param chem_labels: [OPTIONAL] List of chemicals to include in the history;
if None (default), include them all.
:param rxns:
:return: None
|
name | arguments | returns |
save_snapshot | system_time, data_snapshot, step_count=None, caption="" | None |
EXAMPLE of data_snapshot:
{"rxn1_rate": 6.3, "rxn2_rate": 14.3}
:param system_time:
:param data_snapshot:
:param step_count:
:param caption: [OPTIONAL] String to save alongside this snapshot
:return: None
|
name | arguments | returns |
__init__ | *args, **kwargs | |
:param args:
:param kwargs:
|
name | arguments | returns |
enable_history | frequency=1, chem_labels=None | None |
Request history capture, with the specified parameters.
If history was already enabled, this function can be used to alter its capture parameters.
:param frequency: [OPTIONAL] How many simulation cycles to wait until taking another data snapshot
:param chem_labels: [OPTIONAL] List of chemicals to include in the history;
if None (default), include them all.
:return: None
|
name | arguments | returns |
save_snapshot | system_time, data_snapshot, step_count=None, caption="" | None |
:param system_time:
:param data_snapshot: EXAMPLE: {"A": 1.3, "B": 4.9}
:param step_count:
:param caption: [OPTIONAL] String to save alongside this snapshot
:return: None
|