예제 #1
0
 def generate_mf_group(self, G, x):
     mf_group = {}
     for (k, v) in G.iteritems():
         shp = v['shp']
         mf = v['mf']
         if mf == 'trap':
             mf_group[k] = trapmf(x, shp)
         if mf == 'tri':
             mf_group[k] = trimf(x, shp)
         if mf == 'gbell':
             mf_group[k] = gbellmf(x, shp[0], shp[1], shp[2])
         if mf == 'gauss':
             mf_group[k] = gaussmf(x, shp[0], shp[1])
         if mf == 'gauss2':
             mf_group[k] = gauss2mf(x, shp[0], shp[1])
         if mf == 'sig':
             mf_group[k] = sigmf(x, shp[0], shp[1])
         if mf == 'psig':
             mf_group[k] = psigmf(x, shp[0], shp[1], shp[2], shp[3])
         if mf == 'zmf':
             mf_group[k] = zmf(x, shp[0], shp[1], shp[2], shp[3])
         if mf == 'smf':
             mf_group[k] = smf(x, shp[0], shp[1], shp[2], shp[3])
         if mf == 'pimf':
             mf_group[k] = pimf(x, shp[0], shp[1], shp[2], shp[3])
         if mf == 'piecemf':
             mf_group[k] = piecemf(x, shp[0], shp[1], shp[2], shp[3])
     return mf_group
예제 #2
0
 def generate_mf_group(self, G, x):
     mf_group = {}
     for (k, v) in G.iteritems():
         shp = v['shp']
         mf = v['mf']
         if mf == 'trap':
             mf_group[k] = trapmf(x, shp)
         if mf == 'tri':
             mf_group[k] = trimf(x, shp)
         if mf == 'gbell':
             mf_group[k] = gbellmf(x, shp[0], shp[1], shp[2])
         if mf == 'gauss':
             mf_group[k] = gaussmf(x, shp[0], shp[1])
         if mf == 'gauss2':
             mf_group[k] = gauss2mf(x, shp[0], shp[1])
         if mf == 'sig':
             mf_group[k] = sigmf(x, shp[0], shp[1])
         if mf == 'psig':
             mf_group[k] = psigmf(x, shp[0], shp[1], shp[2], shp[3])
         if mf == 'zmf':
             mf_group[k] = zmf(x, shp[0], shp[1], shp[2], shp[3])
         if mf == 'smf':
             mf_group[k] = smf(x, shp[0], shp[1], shp[2], shp[3])
         if mf == 'pimf':
             mf_group[k] = pimf(x, shp[0], shp[1], shp[2], shp[3])
         if mf == 'piecemf':
             mf_group[k] = piecemf(x, shp[0], shp[1], shp[2], shp[3])
     return mf_group
예제 #3
0
def test_pimf_smf_zmf():
    x = np.arange(-4.0, 4.1, 0.1)
    expected = smf(x, -1 / 137., np.pi / 2.) * zmf(x, np.exp(1.), np.pi)
    test = pimf(x, -1 / 137., np.pi / 2., np.exp(1.), np.pi)
    assert_allclose(test, expected)
예제 #4
0
def test_pimf_smf_zmf():
    x = np.arange(-4.0, 4.1, 0.1)
    expected = smf(x, -1 / 137., np.pi / 2.) * zmf(x, np.exp(1.), np.pi)
    test = pimf(x, -1 / 137., np.pi / 2., np.exp(1.), np.pi)
    assert_allclose(test, expected)