def orderTest(self):
        assert type(self.meshTypes) == list, 'meshTypes must be a list'
        if type(self.tolerance) is not list:
            self.tolerance = np.ones(len(self.meshTypes))*self.tolerance

        # if we just provide one expected order, repeat it for each mesh type
        if type(self.expectedOrders) == float or type(self.expectedOrders) == int:
            self.expectedOrders = [self.expectedOrders for i in self.meshTypes]

        assert type(self.expectedOrders) == list, 'expectedOrders must be a list'
        assert len(self.expectedOrders) == len(self.meshTypes), 'expectedOrders must have the same length as the meshTypes'

        for ii_meshType, meshType in enumerate(self.meshTypes):
            self._meshType = meshType
            self._tolerance = self.tolerance[ii_meshType]
            self._expectedOrder = self.expectedOrders[ii_meshType]

            order = []
            err_old = 0.
            max_h_old = 0.
            for ii, nc in enumerate(self.meshSizes):
                max_h = self.setupMesh(nc)
                err = self.getError()
                if ii == 0:
                    print ''
                    print self._meshType + ':  ' + self.name
                    print '_____________________________________________'
                    print '   h  |    error    | e(i-1)/e(i) |  order'
                    print '~~~~~~|~~~~~~~~~~~~~|~~~~~~~~~~~~~|~~~~~~~~~~'
                    print '%4i  |  %8.2e   |' % (nc, err)
                else:
                    order.append(np.log(err/err_old)/np.log(max_h/max_h_old))
                    print '%4i  |  %8.2e   |   %6.4f    |  %6.4f' % (nc, err, err_old/err, order[-1])
                err_old = err
                max_h_old = max_h
            print '---------------------------------------------'
            passTest = np.mean(np.array(order)) > self._tolerance*self._expectedOrder
            if passTest:
                print happiness[np.random.randint(len(happiness))]
            else:
                print 'Failed to pass test on ' + self._meshType + '.'
                print sadness[np.random.randint(len(sadness))]
            print ''
            self.assertTrue(passTest)
For number of cells specified in meshSizes setup mesh, call getError
dataset/ETHPy150Open simpeg/simpeg/SimPEG/Tests.py/OrderTest.orderTest