forked from jgomezdans/KaFKA
-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
Description
Main idea is to have a wrapper around the prior engine that gathers all the relevant data files for different parameters and relevant dates in the temporal grid, and stores them. The pseudocode for this would be similar to the one that follows
class Prior(object):
"""A class to wrap the MULTIPLY prior engine to the inference engine"""
def __init__ ( self, prior_engine_config_file):
"""This method sets up the MULTIPLY prior engine using a YAML (e.g.)
configuration file. It also sets up a mean dictionary that will be index by
parameter name, and then by date (each date storing the mean and
standard deviation filenames for the given parameter and date)
"""
self.prior_engine = PriorEngine(prior_engine_config_file)
self.prior_info_mean = {}
self.prior_info_mean = {}
def _get_prior_date(self, parameters, date):
"""This method gets the prior information for a given set of parameters and
a particular date. """
for param in parameters:
mean, std_dev = self.prior_engine(param, date)
# mean and std_dev are the full path to the global VRT file
self.prior_info_mean[param][date] = mean
self.prior_info_std[param][date] = std_dev
def get_all_priors(self, parameters, time_grid):
"""A method to go through all dates and query the prior information.
Takes a list of parameters, and a time grid (some iterator, list possibly)
and stores the prior in self.prior_info{mean|std}.
"""
for timestep in time_grid:
self._get_prior_date(parameters, timestep)
def process_prior(self, parameters, timestep, state_grid, inv_cov=True):
"""This method reads in the prior parameters for a given `timestep`,
processes them to match the state grid, and returns a mean state
vector and an (inverse) sparse covariance matrix.
"""
passReactions are currently unavailable