def testYearly(self): datestring = 'Yearly' start_date = datetime.datetime.now() hydro = Hydro(start_date, datestring) hydro.tokenize() self.assertEqual(len(hydro.tokens['all'].tokens), 1)
def testLimit(self): datestring = "Daily for 100 times" start_date = datetime.datetime.now() hydro = Hydro(start_date, datestring) hydro.tokenize() self.assertEqual(len(hydro.all_tokens.tokens), 4) dates = hydro.generate_dates() self.assertEqual(len(dates), 100)
def testDaily(self): datestring = 'Daily' start_date = datetime.datetime.now() hydro = Hydro(start_date, datestring) hydro.tokenize() self.assertEqual(len(hydro.tokens['all'].tokens), 1) dates = hydro.generate_dates() self.assertEqual(len(dates), 365)
def testMaximium(self): """ We're only allowed to return 365 events for now """ datestring = "Daily for 1201 times" start_date = datetime.datetime.now() hydro = Hydro(start_date, datestring) hydro.tokenize() self.assertEqual(len(hydro.all_tokens.tokens), 4) dates = hydro.generate_dates() self.assertEqual(len(dates), 365)
# === Hydro model # precipitation from precipitation import precipitation_coefficients # distribution for the initial model values from initial import initial # construct Hydro model from hydro import Hydro model = Hydro(precipitation_coefficients, initial, dt=10, integrator='RKSSP', numbify=0) # === SPUX # LIKELIHOOD # construct Particle Filtering likelihood from spux.likelihoods.pf import PF likelihood = PF(particles=[4, 16]) #likelihood = PF (particles=16) # REPLICATES # use Replicates aggregator to combine likelihood with multiple data sets from spux.aggregators.replicates import Replicates replicates = Replicates() # SAMPLER # construct EMCEE sampler
# === BARRIER from spux import framework framework.barrier () # === MODEL from hydro import Hydro from precipitation import precipitation_coefficients from initial import initial model = Hydro (precipitation_coefficients, initial, dt=10, integrator='RKSSP', numbify=0) framework.assign (model) # === INIT FRAMEWORK model.attach (workers = None) from spux.utils.seed import Seed from spux.utils.sandbox import Sandbox sandbox = Sandbox ('sandbox-synthesize') seed = Seed (1) # setup SPUX framework framework.setup (sandbox = sandbox, seed = seed, verbosity = 1, outputdir = 'datasets_synthetic') # init SPUX framework framework.init ()