Ejemplo n.º 1
0
 def test_get_class_parts_limits_with_edges(self):
     classes = model._get_wltc_data()['classes']
     class_limits = {cls: model.get_class_parts_limits(cls, edges=True) for cls in classes.keys()}  
     for (cls,  l) in class_limits.items():
         self.assertEqual(l[0], 0, 'Class(%s): Left-edge not 0!'%cls)
     for (cls,  l) in class_limits.items():
         self.assertEqual(l[-1], len(classes[cls]['cycle'])-0.5, 'Class(%s): Section Right-edge not len(cycle)!'%cls)
Ejemplo n.º 2
0
 def test_get_class_parts_limits_with_edges(self):
     classes = model._get_wltc_data()['classes']
     class_limits = {cls: model.get_class_parts_limits(cls, edges=True) for cls in classes.keys()}
     for (cls,  l) in class_limits.items():
         self.assertEqual(l[0], 0, 'Class(%s): Left-edge not 0!'%cls)
     for (cls,  l) in class_limits.items():
         self.assertEqual(l[-1], len(classes[cls]['cycle'])-0.5, 'Class(%s): Section Right-edge not len(cycle)!'%cls)
Ejemplo n.º 3
0
 def test_get_class_parts_limits_sorted(self):
     classes = model._get_wltc_data()['classes']
     class_limits = {
         cls: model.get_class_parts_limits(cls, edges=True)
         for cls in classes.keys()
     }
     for (cls, l) in class_limits.items():
         self.assertSequenceEqual(l, sorted(l),
                                  'Class(%s): Unsorted!' % cls)
Ejemplo n.º 4
0
    for (txt, h_pos) in zip(txts, txts_pos):
        ax1.text(h_pos + 8, v_pos, txt, style='italic',
            bbox=bbox, size=8)


    ax1.grid()
    ax1.xaxis.grid = True
    ax1.yaxis.grid = True

    fig.set_size_inches(2 * 2 * 1.618, 2)

    return fig


if __name__ == '__main__':
    os.chdir(path.dirname(__file__))

    wltc_data = model._get_wltc_data()
    for (class_name, class_data) in wltc_data['classes'].items():
        fig = make_class_fig(class_name, class_data)

        img_fname = path.join('..', 'docs', '_static', 'wltc_%s.png'%class_name )

        nargs = len(sys.argv)
        if (nargs > 1):
            plt.show()
        if (nargs == 1 or nargs > 2):
            fig.savefig(img_fname, dpi=100)
            print('Stored image: %s'% img_fname)

Ejemplo n.º 5
0
 def test_get_class_parts_limits_sorted(self):
     classes = model._get_wltc_data()['classes']
     class_limits = {cls: model.get_class_parts_limits(cls, edges=True) for cls in classes.keys()}  
     for (cls,  l) in class_limits.items():
         self.assertSequenceEqual(l, sorted(l), 'Class(%s): Unsorted!'%cls)