IO module (symenergy.auxiliary.io)¶
@author: mcsoini
-
class
symenergy.auxiliary.io.
CacheParams
[source]¶ Bases:
symenergy.auxiliary.params.RcParams
-
items_opts
= {'path': {'cond': 'string', 'types': {<class 'str'>: 'none'}, 'values': ()}}¶
-
items_default
= {'path': '/home/docs/checkouts/readthedocs.org/user_builds/symenergy/checkouts/latest/symenergy/cache'}¶
-
-
class
symenergy.auxiliary.io.
Cache
(m_name)[source]¶ Bases:
object
Handles model cache files.
Cache files store the model results. They are automatically written to pickle files whose filename is generated is generated from a hash of the model objects. Existing cache files are automatically read to skip the model solution process.
-
prefix
= None¶
-
cache_name
= 'cache'¶
-
path
¶
-
load
()[source]¶ Load model results from cache file.
Returns: Dataframe containing model results. Return type: pandas.DataFrame
-
write
(df)[source]¶ Write dataframe to cache file.
Parameters: df (pandas.DataFrame) – Table with model results
-
file_exists
¶ Checks whether the cache file exists.
Returns: True if the cache file corresponding to the hashed filename exists. False otherwise. Return type: bool
-
get_name
(_dir)[source]¶ Returns a unique hashed model name based on the constraint, variable, multiplier, and parameter names.
Parameters: m (model.Model) – SymEnergy model instance
-
-
class
symenergy.auxiliary.io.
EvaluatorCache
(name, cache_name)[source]¶ Bases:
symenergy.auxiliary.io.Cache