dabench.observer ================ .. py:module:: dabench.observer .. autoapi-nested-parse:: Observer module Classes ------- .. autoapisummary:: dabench.observer.Observer Package Contents ---------------- .. py:class:: Observer(state_vec, random_time_density = 1.0, random_location_density = 1.0, random_time_count = None, random_location_count = None, times = None, locations = None, stationary_observers = True, error_bias = 0.0, error_sd = 0.0, error_positive_only = False, random_seed = 99, store_as_jax = False) Flexibly samples observations from generated data :param state_vec: Data generator/loader object from which to gather observations. :param random_location_density: Fraction of locations in system_dim to randomly select for observing, must be value between 0 and 1. Default is 1. :param random_time_density: Fraction of times to randomly select for observing must be value between 0 and 1. Default is 1. :param random_location_count: Number of locations in data_obj's system_dim to randomly select for observing. Default is None. User should specify one of: random_location_count, random_location_density, or location_indices. If random_location_count is specified, it takes precedent over random_location_density. :param random_time_count: Number of times to randomly select for observing. Default is None. User should specify one of: random_time_count, random_time_density, or time_indices. If random_time_count is specified, it takes precedent over random_time_density. :param locations: Manually specified indices for observing. If 1D array provided, assumed to be for flattened system_dim. If >1D, must have same dimensionality as data generator's original_dim (e.g. (x, y, z)). If stationary_observers=False, expects leading time dimension. If not specified, will be randomly generated according to random_location_density OR random_location_count. Default is None. :param times: Indices of times to gather observations from. If not specified, randomly generate according to random_time_density OR random_time_count. Default is None. :param stationary_observers: If True, samples from same indices at each time step. If False, randomly generates/expects new observation indices at each timestep. Default is True. If False: If using random_location_count, the same number of indices will be randomly generated. If using random_location_density, indices are randomly generated, with the possibility of a different number of locations at each times step.. If using location_indices, expects indices to either be 2D (time_dim, system_dim) or >2D (time_dim, original_dim). :param error_bias: Mean of normal distribution of observation errors. If provided as an array, it is taken to be variable-specific and the length must be equal to data_obj.system_dim. Default is 0. :param error_sd: Standard deviation of observation errors. observation errors. If provided as an array, it is taken to be variable-specific and the length be equal to data_obj.system_dim. Default is 0. :param error_positive_only: Clip errors to be positive only. Default is False. :param random_seed: Random seed for sampling times and locations. Default is 99. :param store_as_jax: Store values as jax array instead of numpy array. Default is False (store as numpy). .. attribute:: locations Location indices for making observations. In system_dim (1D) or original dim (>1D) of self.state_vec. :type: ArrayLike .. attribute:: location_dim Number of locations sampled from (max in a single time step, if non-stationary observers). :type: int .. attribute:: times Time indices to gather observations from. :type: ArrayLike .. attribute:: time_dim Number of times sampled from. :type: int .. py:method:: observe() Generate observations. :returns: ObsVector containing observation values, times, locations, and errors