In [1]:
import sys
sys.path.append('../src')
import Pyfuzzy as Fuzz
import numpy as np
import pylab as plt
import pandas as pd
%matplotlib inline
In [2]:
f1=Fuzz.read_model('zr_simple_t.fis')
In [3]:
ZR=pd.ExcelFile('ZR_Daten_DDR_1976_1990.xlsx')
df=ZR.parse("Tabelle1")
pd.DataFrame({'NI': df['NI_6']+df['NI_7']+df['NI_8']+df['NI_9']}).describe()
Out[3]:
In [4]:
pd.DataFrame({'LT': df['LT_6']+df['LT_7']+df['LT_8']+df['LT_9']}).describe()
Out[4]:
In [5]:
az=[20,30,40,50,60,70] # array of soil quality
NI=np.random.normal(222,77,1000) # generate 1000 normal distributed NIs
LT=np.random.normal(63,4,1000) # same for the temperature
In [6]:
x=pd.DataFrame(np.zeros((1000,6)),columns=['20','30','40','50','60','70']) # a data frame to store the res
for k in az:
res=[]
for i in range(1000): # use the 1000 samples
val=f1.calc3(k,LT[i],NI[i])
res.append(val)
res=np.array(res)
x[str(k)]=res
x.describe()
Out[6]:
In [7]:
NI-=50 # 50 mm less
LT+=1 # 1 degree more
for k in az:
res=[]
for i in range(1000): # use the 1000 samples
val=f1.calc3(k,LT[i],NI[i])
res.append(val)
res=np.array(res)
x[str(k)]=res
x.describe()
Out[7]:
In [7]: