annotate tests/test_broadcasting.py @ 14:ec5f97abf8ed

stub np broadcasting test
author Jeff Hammel <k0scist@gmail.com>
date Sun, 03 Sep 2017 12:07:49 -0700
parents
children 926c127305fa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14
ec5f97abf8ed stub np broadcasting test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
1 #!/usr/bin/env python
ec5f97abf8ed stub np broadcasting test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
2
ec5f97abf8ed stub np broadcasting test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
3 """
ec5f97abf8ed stub np broadcasting test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
4 illustration of numpy broadcasting
ec5f97abf8ed stub np broadcasting test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
5 """
ec5f97abf8ed stub np broadcasting test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
6
ec5f97abf8ed stub np broadcasting test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
7 import os
ec5f97abf8ed stub np broadcasting test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
8 import unittest
ec5f97abf8ed stub np broadcasting test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
9 import numpy as np
ec5f97abf8ed stub np broadcasting test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
10
ec5f97abf8ed stub np broadcasting test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
11 #apples, beef, eggs, potatos
ec5f97abf8ed stub np broadcasting test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
12 calories = [[56., 0.0, 4.4, 68.], # carbs
ec5f97abf8ed stub np broadcasting test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
13 [1.2, 104., 52., 8.], # protein
ec5f97abf8ed stub np broadcasting test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
14 [1.8, 135., 99., 0.9]] # fat
ec5f97abf8ed stub np broadcasting test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
15
ec5f97abf8ed stub np broadcasting test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
16 class TestBroadcasting(unittest.TestCase):
ec5f97abf8ed stub np broadcasting test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
17 def test_basic(self):
ec5f97abf8ed stub np broadcasting test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
18 """example of braodcasting"""
ec5f97abf8ed stub np broadcasting test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
19
ec5f97abf8ed stub np broadcasting test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
20 if __name__ == '__main__':
ec5f97abf8ed stub np broadcasting test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
21 unittest.main()