Ejemplo n.º 1
0
    def test_line_labels(self):
        fig = plot_vs_depth(self.x,self.z, ['a', 'b', 'c'])
        ax = fig.get_axes()[0]

        assert_allclose(ax.get_lines()[0].get_xydata(),
                     np.array([[ 1.,  0.],
                               [ 3.,  2.],
                               [ 5.,  4.],
                               [ 7.,  6.],
                               [ 9.,  8.]]))
        assert_allclose(ax.get_lines()[1].get_xydata(),
                     np.array([[  2.,   0.],
                               [  4.,   2.],
                               [  6.,   4.],
                               [  8.,   6.],
                               [ 10.,   8.]]))
        assert_allclose(ax.get_lines()[2].get_xydata(),
                     np.array([[  3.,   0.],
                               [  5.,   2.],
                               [  7.,   4.],
                               [  9.,   6.],
                               [ 11.,   8.]]))

        assert_equal(ax.get_lines()[0].get_label(), 'a')
        assert_equal(ax.get_lines()[1].get_label(), 'b')
        assert_equal(ax.get_lines()[2].get_label(), 'c')
        ok_(not ax.get_legend() is None)
        assert_equal(ax.get_legend().get_title().get_text(), 'time:')
Ejemplo n.º 2
0
    def test_line_labels(self):
        fig = plot_vs_depth(self.x,self.z, ['a', 'b', 'c'])
        ax = fig.get_axes()[0]

        assert_allclose(ax.get_lines()[0].get_xydata(),
                     np.array([[ 1.,  0.],
                               [ 3.,  2.],
                               [ 5.,  4.],
                               [ 7.,  6.],
                               [ 9.,  8.]]))
        assert_allclose(ax.get_lines()[1].get_xydata(),
                     np.array([[  2.,   0.],
                               [  4.,   2.],
                               [  6.,   4.],
                               [  8.,   6.],
                               [ 10.,   8.]]))
        assert_allclose(ax.get_lines()[2].get_xydata(),
                     np.array([[  3.,   0.],
                               [  5.,   2.],
                               [  7.,   4.],
                               [  9.,   6.],
                               [ 11.,   8.]]))

        assert_equal(ax.get_lines()[0].get_label(), 'a')
        assert_equal(ax.get_lines()[1].get_label(), 'b')
        assert_equal(ax.get_lines()[2].get_label(), 'c')
        ok_(not ax.get_legend() is None)
        assert_equal(ax.get_legend().get_title().get_text(), 'time:')
Ejemplo n.º 3
0
    def test_defaults(self):
        fig = plot_vs_depth(self.x, self.z, None)
        ax = fig.get_axes()[0]

        assert_allclose(ax.get_lines()[0].get_xydata(),
                     np.array([[ 1.,  0.],
                               [ 3.,  2.],
                               [ 5.,  4.],
                               [ 7.,  6.],
                               [ 9.,  8.]]))
        assert_allclose(ax.get_lines()[1].get_xydata(),
                     np.array([[  2.,   0.],
                               [  4.,   2.],
                               [  6.,   4.],
                               [  8.,   6.],
                               [ 10.,   8.]]))
        assert_allclose(ax.get_lines()[2].get_xydata(),
                     np.array([[  3.,   0.],
                               [  5.,   2.],
                               [  7.,   4.],
                               [  9.,   6.],
                               [ 11.,   8.]]))

        assert_equal(ax.get_lines()[0].get_label(), '_line0')
        assert_equal(ax.get_lines()[1].get_label(), '_line1')
        assert_equal(ax.get_lines()[2].get_label(), '_line2')

        assert_equal(ax.get_xlabel(), 'x')
        assert_equal(ax.get_ylabel(), 'Depth, z')

        assert_equal(ax.get_legend(), None)
Ejemplo n.º 4
0
 def test_propdict_fig_prop_figsize(self):
     fig = plot_vs_depth(self.x,
                         self.z, ['a', 'b', 'c'],
                         prop_dict={'fig_prop': {
                             'figsize': (8, 9)
                         }})
     assert_allclose(fig.get_size_inches(), (8, 9))
Ejemplo n.º 5
0
    def test_Rlzero(self):
        fig = plot_vs_depth(self.x, self.z, None, H=2.0, RLzero=0)
        ax = fig.get_axes()[0]

        assert_allclose(ax.get_lines()[0].get_xydata(),
                     np.array([[ 1.,  0.],
                               [ 3.,  -4.],
                               [ 5.,  -8.],
                               [ 7.,  -12.],
                               [ 9.,  -16.]]))
        assert_allclose(ax.get_lines()[1].get_xydata(),
                     np.array([[  2.,   0.],
                               [  4.,   -4.],
                               [  6.,   -8.],
                               [  8.,   -12.],
                               [ 10.,   -16.]]))
        assert_allclose(ax.get_lines()[2].get_xydata(),
                     np.array([[  3.,   0.],
                               [  5.,   -4.],
                               [  7.,   -8.],
                               [  9.,   -12.],
                               [ 11.,   -16.]]))

        assert_equal(ax.get_lines()[0].get_label(), '_line0')
        assert_equal(ax.get_lines()[1].get_label(), '_line1')
        assert_equal(ax.get_lines()[2].get_label(), '_line2')

        assert_equal(ax.get_xlabel(), 'x')
        assert_equal(ax.get_ylabel(), 'RL')

        assert_equal(ax.get_legend(), None)
Ejemplo n.º 6
0
    def test_Rlzero(self):
        fig = plot_vs_depth(self.x, self.z, None, H=2.0, RLzero=0)
        ax = fig.get_axes()[0]

        assert_allclose(ax.get_lines()[0].get_xydata(),
                     np.array([[ 1.,  0.],
                               [ 3.,  -4.],
                               [ 5.,  -8.],
                               [ 7.,  -12.],
                               [ 9.,  -16.]]))
        assert_allclose(ax.get_lines()[1].get_xydata(),
                     np.array([[  2.,   0.],
                               [  4.,   -4.],
                               [  6.,   -8.],
                               [  8.,   -12.],
                               [ 10.,   -16.]]))
        assert_allclose(ax.get_lines()[2].get_xydata(),
                     np.array([[  3.,   0.],
                               [  5.,   -4.],
                               [  7.,   -8.],
                               [  9.,   -12.],
                               [ 11.,   -16.]]))

        assert_equal(ax.get_lines()[0].get_label(), '_line0')
        assert_equal(ax.get_lines()[1].get_label(), '_line1')
        assert_equal(ax.get_lines()[2].get_label(), '_line2')

        assert_equal(ax.get_xlabel(), 'x')
        assert_equal(ax.get_ylabel(), 'RL')

        assert_equal(ax.get_legend(), None)
Ejemplo n.º 7
0
    def test_defaults(self):
        fig = plot_vs_depth(self.x, self.z, None)
        ax = fig.get_axes()[0]

        assert_allclose(ax.get_lines()[0].get_xydata(),
                     np.array([[ 1.,  0.],
                               [ 3.,  2.],
                               [ 5.,  4.],
                               [ 7.,  6.],
                               [ 9.,  8.]]))
        assert_allclose(ax.get_lines()[1].get_xydata(),
                     np.array([[  2.,   0.],
                               [  4.,   2.],
                               [  6.,   4.],
                               [  8.,   6.],
                               [ 10.,   8.]]))
        assert_allclose(ax.get_lines()[2].get_xydata(),
                     np.array([[  3.,   0.],
                               [  5.,   2.],
                               [  7.,   4.],
                               [  9.,   6.],
                               [ 11.,   8.]]))

        assert_equal(ax.get_lines()[0].get_label(), '_line0')
        assert_equal(ax.get_lines()[1].get_label(), '_line1')
        assert_equal(ax.get_lines()[2].get_label(), '_line2')

        assert_equal(ax.get_xlabel(), 'x')
        assert_equal(ax.get_ylabel(), 'Depth, z')

        assert_equal(ax.get_legend(), None)
Ejemplo n.º 8
0
 def test_propdict_legend_prop_title(self):
     fig = plot_vs_depth(self.x,
                         self.z, ['a', 'b', 'c'],
                         prop_dict={'legend_prop': {
                             'title': 'abc'
                         }})
     ax = fig.get_axes()[0]
     assert_equal(ax.get_legend().get_title().get_text(), 'abc')
Ejemplo n.º 9
0
    def test_propdict_has_legend(self):

        fig = plot_vs_depth(self.x,
                            self.z, ['a', 'b', 'c'],
                            prop_dict={'has_legend': False})
        ax = fig.get_axes()[0]

        assert_equal(ax.get_legend(), None)
Ejemplo n.º 10
0
    def test_propdict_has_legend(self):


        fig = plot_vs_depth(self.x, self.z, ['a', 'b', 'c'],
                           prop_dict={'has_legend': False})
        ax = fig.get_axes()[0]

        assert_equal(ax.get_legend(), None)
Ejemplo n.º 11
0
    def test_propdict_xylabels(self):


        fig = plot_vs_depth(self.x, self.z, ['a', 'b', 'c'],
                           prop_dict={'xlabel':'xxx', 'ylabel':'yyy'})
        ax = fig.get_axes()[0]

        assert_equal(ax.get_xlabel(), 'xxx')
        assert_equal(ax.get_ylabel(), 'yyy')
Ejemplo n.º 12
0
    def test_propdict_xylabels(self):


        fig = plot_vs_depth(self.x, self.z, ['a', 'b', 'c'],
                           prop_dict={'xlabel':'xxx', 'ylabel':'yyy'})
        ax = fig.get_axes()[0]

        assert_equal(ax.get_xlabel(), 'xxx')
        assert_equal(ax.get_ylabel(), 'yyy')
Ejemplo n.º 13
0
    def test_prop_dict_styles(self):
        fig = plot_vs_depth(self.x, self.z, None,
                            prop_dict={'styles':[{'markersize': 12,
                                                 'marker': '^'},
                                                 {'markersize': 3,
                                                 'marker': 's'}]})
        ax = fig.get_axes()[0]
        line1= ax.get_lines()[0]
        line2= ax.get_lines()[1]
        line3= ax.get_lines()[2]



        assert_equal(line1.get_marker(),'^')
        assert_equal(line1.get_markersize(),12)
        assert_equal(line2.get_marker(),'s')
        assert_equal(line2.get_markersize(),3)
        assert_equal(line3.get_marker(),'^')
        assert_equal(line3.get_markersize(),12)
Ejemplo n.º 14
0
    def test_prop_dict_styles(self):
        fig = plot_vs_depth(self.x, self.z, None,
                            prop_dict={'styles':[{'markersize': 12,
                                                 'marker': '^'},
                                                 {'markersize': 3,
                                                 'marker': 's'}]})
        ax = fig.get_axes()[0]
        line1= ax.get_lines()[0]
        line2= ax.get_lines()[1]
        line3= ax.get_lines()[2]



        assert_equal(line1.get_marker(),'^')
        assert_equal(line1.get_markersize(),12)
        assert_equal(line2.get_marker(),'s')
        assert_equal(line2.get_markersize(),3)
        assert_equal(line3.get_marker(),'^')
        assert_equal(line3.get_markersize(),12)
Ejemplo n.º 15
0
        por, doc, settle = zhuandyin2012(
            z=z, t=t, alpha=alpha, p=p, q=q, drn=drn, tpor=tpor, H = H, kv0 = kv0, mv0 = mv0, gamw = 10,
                ui = 100, nterms = nterms, plot_eigs=plot_eigs)
#            z, t, alpha = alpha, p=p, q=q, drn=drn,tpor=tpor, nterms=nterms, plot_eigs=plot_eigs)
        print('z',repr(z))
        print('t', repr(t))
        print('por',repr(por))
        print('doc',repr(doc))
        print('set',repr(settle))
        x = np.linspace(0,1,11)
        kv = (1+alpha*x)**p
        mv = (1+alpha*x)**q
#        print('x', repr(x))
#        print('kv', repr(kv))
#        print('mv', repr(mv))
        fig=plt.figure()
        ax= fig.add_subplot('111')
        ax.plot(kv, x, label='kv', ls='-')
        ax.plot(mv, x, label='mv', ls='-')
        ax.legend()
        ax.invert_yaxis()

        fig_por=plot_vs_depth(por, z, line_labels=['{0:.3g}'.format(v) for v in tpor],
                                           prop_dict={'xlabel': 'Pore Pressure'})
        fig_por.get_axes()[0].grid()
#        fig_por.get_axes()[0].set_xlim(0,1.3)
        fig_doc=plot_vs_time(t,doc, prop_dict={'ylabel': "Degree of consolidation"})
        fig_doc.gca().invert_yaxis()
        fig_set=plot_vs_time(t,settle, prop_dict={'ylabel': "Settlement"})
        fig_set.gca().invert_yaxis()
    plt.show()
Ejemplo n.º 16
0
 def test_propdict_legend_prop_title(self):
     fig = plot_vs_depth(self.x, self.z, ['a', 'b', 'c'],
                        prop_dict={'legend_prop':{'title':'abc'}})
     ax = fig.get_axes()[0]
     assert_equal(ax.get_legend().get_title().get_text(), 'abc')
Ejemplo n.º 17
0
        por, doc, settle = zhuandyin2012(
            z=z, t=t, alpha=alpha, p=p, q=q, drn=drn, tpor=tpor, H = H, kv0 = kv0, mv0 = mv0, gamw = 10,
                ui = 100, nterms = nterms, plot_eigs=plot_eigs)
#            z, t, alpha = alpha, p=p, q=q, drn=drn,tpor=tpor, nterms=nterms, plot_eigs=plot_eigs)
        print('z',repr(z))
        print('t', repr(t))
        print('por',repr(por))
        print('doc',repr(doc))
        print('set',repr(settle))
        x = np.linspace(0,1,11)
        kv = (1+alpha*x)**p
        mv = (1+alpha*x)**q
#        print('x', repr(x))
#        print('kv', repr(kv))
#        print('mv', repr(mv))
        fig=plt.figure()
        ax= fig.add_subplot('111')
        ax.plot(kv, x, label='kv', ls='-')
        ax.plot(mv, x, label='mv', ls='-')
        ax.legend()
        ax.invert_yaxis()

        fig_por=plot_vs_depth(por, z, line_labels=['{0:.3g}'.format(v) for v in tpor],
                                           prop_dict={'xlabel': 'Pore Pressure'})
        fig_por.get_axes()[0].grid()
#        fig_por.get_axes()[0].set_xlim(0,1.3)
        fig_doc=plot_vs_time(t,doc, prop_dict={'ylabel': "Degree of consolidation"})
        fig_doc.gca().invert_yaxis()
        fig_set=plot_vs_time(t,settle, prop_dict={'ylabel': "Settlement"})
        fig_set.gca().invert_yaxis()
    plt.show()
Ejemplo n.º 18
0
 def test_propdict_fig_prop_figsize(self):
     fig = plot_vs_depth(self.x, self.z, ['a', 'b', 'c'],
                        prop_dict={'fig_prop':{'figsize':(8,9)}})
     assert_allclose(fig.get_size_inches(), (8,9))