starttimes = uniform(loc=0,scale=24).ppf(starttimes) str_times = starttimes.astype(int) #print ("start times" + ":",str_times.astype(int)) ########################## #spillduration from triang_distributin(5,50,30) spilltimes = lhs(10,samples=10) for i in range(10): spilltimes[:,i] = triang(loc=5,scale=45,c=0.556).ppf(spilltimes[:,i]) spill_dur = spilltimes.astype(int) #print ("spill duration" + ":",spill_dur) #filepath = os.path.join(base_dir, 'Scenarios.txt') #with open(filepath, 'w') as f: # f.write("%s\n" % str_days) # f.write("%s\n" %str_times) # f.write("%s\n" %spill_dur) #f.close()
def pdfnorm(self, y): # pickler problem with triang_gen marginals = [triang(self.c, loc = l, scale = s) for l,s in zip(self.locs/self.sigmas, self.scales/self.sigmas)] # have var's normalized to 1 (confirmed) ytmp = y if len(y.shape) == 2 else y.reshape((-1,1)) return np.apply_along_axis(lambda yi: np.product([m.pdf(yij) for m,yij in zip(marginals, yi/self.sigmas)]), 1, ytmp)