citylearn.utilities module
- class citylearn.utilities.FileHandler[source]
Bases:
object
- static read_json(filepath: str, **kwargs) dict [source]
Return JSON document as dictionary.
- Parameters:
filepath (str)
document. (pathname of JSON)
**kwargs (dict) – Other infrequently used keyword arguments to be parsed to simplejson.load.
- Returns:
JSON document converted to dictionary.
- Return type:
dict
- static read_pickle(filepath: str, **kwargs) Any [source]
Return pickle file as some Python class object.
- Parameters:
filepath (str)
file. (pathname of pickle)
**kwargs (dict) – Other infrequently used keyword arguments to be parsed to pickle.load.
- Returns:
Pickle file as a Python object.
- Return type:
Any
- static read_yaml(filepath: str) dict [source]
Return YAML document as dictionary.
- Parameters:
filepath (str)
document. (pathname of YAML)
- Returns:
YAML document converted to dictionary.
- Return type:
dict
- static write_json(filepath: str, dictionary: dict, **kwargs)[source]
Write dictionary to JSON file.
- Parameters:
filepath (str) – pathname of JSON document.
dictionary (dict) – dictionary to convert to JSON.
**kwargs (dict) – Other infrequently used keyword arguments to be parsed to simplejson.dump.
- class citylearn.utilities.NoiseUtils[source]
Bases:
object
- static generate_gaussian_noise(input_data: ndarray | Iterable[float], noise_std: float) ndarray [source]
Generates Gaussian noise matching input shape.
- Parameters:
input_data (Union[np.ndarray, Iterable[float]]) – Time series to add noise to.
noise_std (float) – Noise standard deviation (ignored if <= 0)
- Returns:
noise – Zero-mean noise array with same shape as input
- Return type:
np.ndarray