From c1c5403b8274bd19aa1e71933cfaefe1ba622e59 Mon Sep 17 00:00:00 2001 From: Mario Mulansky Date: Fri, 10 Oct 2014 17:23:28 +0200 Subject: added License note in headers --- examples/merge.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 examples/merge.py (limited to 'examples/merge.py') diff --git a/examples/merge.py b/examples/merge.py new file mode 100644 index 0000000..55c7f0a --- /dev/null +++ b/examples/merge.py @@ -0,0 +1,28 @@ +""" merge.py + +Simple example showing the merging of two spike trains. + +Copyright 2014, Mario Mulansky + +Distributed under the MIT License (MIT) +""" + +from __future__ import print_function + +import numpy as np +import matplotlib.pyplot as plt + +import pyspike as spk + +# first load the data, ending time = 4000 +spike_trains = spk.load_spike_trains_from_txt("SPIKY_testdata.txt", 4000) + +spikes = spk.merge_spike_trains([spike_trains[0], spike_trains[1]]) + +print(spikes) + +plt.plot(spike_trains[0], np.ones_like(spike_trains[0]), 'o') +plt.plot(spike_trains[1], np.ones_like(spike_trains[1]), 'x') +plt.plot(spikes, 2*np.ones_like(spikes), 'o') + +plt.show() -- cgit v1.2.3 From f3fefa32f9c02c217448529454011d56669b42ae Mon Sep 17 00:00:00 2001 From: Mario Mulansky Date: Sun, 12 Oct 2014 18:27:38 +0200 Subject: changed name of example spike data file --- examples/PySpike_testdata.txt | 43 +++++++++++++++++++++++++++++++++++++++++++ examples/SPIKY_testdata.txt | 43 ------------------------------------------- examples/isi_matrix.py | 2 +- examples/merge.py | 2 +- examples/plot.py | 2 +- 5 files changed, 46 insertions(+), 46 deletions(-) create mode 100755 examples/PySpike_testdata.txt delete mode 100755 examples/SPIKY_testdata.txt (limited to 'examples/merge.py') diff --git a/examples/PySpike_testdata.txt b/examples/PySpike_testdata.txt new file mode 100755 index 0000000..c8bea67 --- /dev/null +++ b/examples/PySpike_testdata.txt @@ -0,0 +1,43 @@ +64.886 305.81 696 937.77 1059.7 1322.2 1576.1 1808.1 2121.5 2381.1 2728.6 2966.9 3223.7 3473.7 3644.3 3936.3 +65.553 307.49 696.63 948.66 1070.4 1312.2 1712.7 1934.3 2117.6 2356.9 2727.3 2980.6 3226.9 3475.7 3726.4 3944 +# test comment +69.064 319.1 688.32 947.85 1071.8 1300.8 1697.2 1930.6 2139.4 2354.2 2723.7 2963.6 3221.3 3470.1 +59.955 313.83 692.23 955.95 1070.4 1319.6 1681.9 1963.5 2151.4 2373.8 2729.4 2971.2 3220.2 3475.5 3632.3 3788.9 +# empty line + +59.977 306.84 686.09 935.08 1059.9 1325.9 1543.4 1821.9 2150.2 2390.4 2724.5 2969.6 3222.5 3471.5 3576 3913.9 +66.415 313.41 688.83 931.43 1051.8 1304.6 1555.6 1820.2 2150.5 2383.1 2723.4 2947.7 3196.6 3443.5 3575 3804.9 +66.449 311.02 689.26 947.12 1058.9 1286.6 1708.2 1957.3 2124.8 2375.7 2709.4 2977.6 3191.1 3449.6 3590.4 3831.2 +63.764 318.45 697.48 936.97 1059.3 1325 1687.9 1944.7 2132.5 2377.1 2713.1 2976.6 3196.8 3442.6 3741.6 3998.3 +63.906 314.79 693.26 937.12 1065.9 1315.8 1584.3 1821.5 2126.3 2396.8 2709.1 2967 3197.4 3444 3732.8 3849.5 +69.493 316.62 689.81 943.62 1071.9 1296.3 1654.8 1931.9 2127.5 2390.6 2708.9 2950.4 3194.8 3445.2 3670.1 3903.3 +61.789 317.53 555.82 813.15 1198.7 1448.7 1686.7 1943.5 2060.7 2311.4 2658.2 2900.2 3167.4 3418.2 3617.3 3771 +64.098 309.86 567.27 813.91 1182 1464.3 1576.8 1822.5 2063.1 2311.7 2655.8 2911.7 3168.3 3418.2 3586.4 3999.7 +68.59 315.5 559.52 806.23 1182.5 1441.1 1567.2 1804.8 2074.9 2315.8 2655.1 2913.2 3165.9 3419.5 3648.1 3884.4 +66.507 314.42 556.42 814.83 1182.5 1440.3 1701.3 1911.1 2069.7 2319.3 2662.3 2903.2 3167.4 3418.5 3545 3893.9 +72.744 318.45 554.4 819.64 1186.9 1449.7 1676 1957.4 2051.4 2302.8 2657.8 2916.2 3169.4 3416.7 3570.4 3884.8 +64.779 324.42 560.56 828.99 1174.8 1439.9 1563.7 1790.6 2067.7 2287.6 2657.4 2905.2 3139.2 3389.1 3507.8 3807.5 +64.852 316.63 568.89 815.61 1198.3 1454.1 1710.6 1933.9 2091.5 2309.6 2660.9 2907.5 3137.2 3389.3 3617.2 +63.089 314.52 553.8 827.06 1183.9 1457.6 1558.9 1808.3 2064.5 2337.1 2653.6 2897 3143.7 3385.7 3668.7 3803.8 +62.23 315.16 564.35 812.15 1199.6 1448.9 1562.7 1839.1 2069.7 2308.9 2649.6 2919.7 3141 3389.9 3723.6 3882.2 +69.662 311.93 564.91 805.25 1209.7 1451.4 1691.9 1932.1 2044.2 2329.4 2657.1 2908.5 3142.8 3390.5 3597.3 3991.1 +183.42 431.34 562.41 809.57 1086.3 1308.9 1555.9 1831.3 2057 2326.9 2591.3 2831.4 3113.9 3367.9 3555.3 3956 +188.49 442.39 572.4 810.76 1065 1326.7 1564.3 1803.4 2060.4 2322.4 2607.2 2824.1 3110.2 3363.9 3644.1 3819.6 +177 437.76 569.82 819.66 1064.1 1309.2 1685.7 1957.5 2066.9 2313.8 2593.2 2847 3116.8 3364.5 3727.3 3881.6 +193.9 441.93 586.9 804.98 1062.5 1312.4 1542.4 1793.1 2073.9 2314.7 2587.8 2845.9 3112.4 3359.8 +193.01 440.26 555.64 814.08 1056.3 1315 1689.9 1961.4 2049.1 2305 2593.9 2847.5 3110.6 3361.1 3711.6 3914.7 +194.71 437.57 566.18 806.73 1069.2 1314.6 1682.7 1942.2 2061.8 2304.6 2607.6 2841.7 3082.9 3330.3 3679.7 3848.2 +184.88 441.22 570.92 794.35 1063.7 1309.9 1678.7 1930 2058 2321.3 2606.7 2845 3084.8 3337.3 3640 3952.1 +189.66 443.59 560.67 816.89 1070.4 1303.4 1550.1 1815.5 2057.6 2323.7 2587.1 2843.5 3086.6 3333.6 3618.2 3815.4 +190.41 440.77 568.96 808.56 1073.8 1322.1 1686.5 1952.8 2068.7 2335.7 2595.7 2845.4 3086 3333.5 3635.6 3939.3 +181.16 440.67 577.54 823.52 1052.5 1322.3 1578.4 1822.2 2079.4 2309.1 2596.9 2851.9 3083.5 3335.1 3531.2 3770.6 +181.09 434.97 687.15 943.33 1192.9 1444 1699.4 1942 2194.6 2445.9 2549.4 2785.1 3056.5 3308.2 3620.5 3932.7 +186.7 446.53 688.18 942.86 1186.1 1441.9 1688.1 1922.2 2196.6 2455.3 2534.8 2776.5 3060.3 3309.4 3514.1 3808.6 +196.76 446 681.26 948.27 1195.8 1433.1 1699 1933 2201.2 2461.4 2547.4 2777.8 3055.7 3307.1 3590.6 3952.8 +200.68 427.11 695.67 946.42 1178.6 1440.1 1538.4 1809 2199.8 2432.5 2531.6 2793.2 3056.6 3308.6 3510.6 3928.1 +190.83 429.57 698.73 931.16 1190.6 1428.9 1698.3 1935 2176.8 2424.7 2530.5 2766.9 3062 3309.7 3689.8 +181.47 441.93 682.32 943.01 1190.1 1459.1 1570.6 1819.6 2189.8 2437.9 2543.3 2782.8 3025.9 3280.2 3581 3855.9 +191.38 435.69 702.76 935.62 1188.3 1438.3 1564.2 1823.9 2191.3 2444.9 2531.9 2782.4 3030.7 3275.7 3677.7 3829.2 +191.97 433.85 686.29 932.65 1183.1 1432.7 1563.9 1826.5 2214.1 2436.8 2529.8 2778.3 3028.3 3281.8 3582 3863.4 +189.51 453.21 691.3 940.86 1180.1 1430.1 1567.1 1835 2199 2448.2 2526.7 2773.8 3030.5 3280.1 3576.2 3893.6 +190.88 435.48 692.66 940.51 1189.5 1448.9 1575.1 1824.2 2190.8 2425.9 2530.6 2783.3 3033.3 3279.5 3733 3838.9 diff --git a/examples/SPIKY_testdata.txt b/examples/SPIKY_testdata.txt deleted file mode 100755 index c8bea67..0000000 --- a/examples/SPIKY_testdata.txt +++ /dev/null @@ -1,43 +0,0 @@ -64.886 305.81 696 937.77 1059.7 1322.2 1576.1 1808.1 2121.5 2381.1 2728.6 2966.9 3223.7 3473.7 3644.3 3936.3 -65.553 307.49 696.63 948.66 1070.4 1312.2 1712.7 1934.3 2117.6 2356.9 2727.3 2980.6 3226.9 3475.7 3726.4 3944 -# test comment -69.064 319.1 688.32 947.85 1071.8 1300.8 1697.2 1930.6 2139.4 2354.2 2723.7 2963.6 3221.3 3470.1 -59.955 313.83 692.23 955.95 1070.4 1319.6 1681.9 1963.5 2151.4 2373.8 2729.4 2971.2 3220.2 3475.5 3632.3 3788.9 -# empty line - -59.977 306.84 686.09 935.08 1059.9 1325.9 1543.4 1821.9 2150.2 2390.4 2724.5 2969.6 3222.5 3471.5 3576 3913.9 -66.415 313.41 688.83 931.43 1051.8 1304.6 1555.6 1820.2 2150.5 2383.1 2723.4 2947.7 3196.6 3443.5 3575 3804.9 -66.449 311.02 689.26 947.12 1058.9 1286.6 1708.2 1957.3 2124.8 2375.7 2709.4 2977.6 3191.1 3449.6 3590.4 3831.2 -63.764 318.45 697.48 936.97 1059.3 1325 1687.9 1944.7 2132.5 2377.1 2713.1 2976.6 3196.8 3442.6 3741.6 3998.3 -63.906 314.79 693.26 937.12 1065.9 1315.8 1584.3 1821.5 2126.3 2396.8 2709.1 2967 3197.4 3444 3732.8 3849.5 -69.493 316.62 689.81 943.62 1071.9 1296.3 1654.8 1931.9 2127.5 2390.6 2708.9 2950.4 3194.8 3445.2 3670.1 3903.3 -61.789 317.53 555.82 813.15 1198.7 1448.7 1686.7 1943.5 2060.7 2311.4 2658.2 2900.2 3167.4 3418.2 3617.3 3771 -64.098 309.86 567.27 813.91 1182 1464.3 1576.8 1822.5 2063.1 2311.7 2655.8 2911.7 3168.3 3418.2 3586.4 3999.7 -68.59 315.5 559.52 806.23 1182.5 1441.1 1567.2 1804.8 2074.9 2315.8 2655.1 2913.2 3165.9 3419.5 3648.1 3884.4 -66.507 314.42 556.42 814.83 1182.5 1440.3 1701.3 1911.1 2069.7 2319.3 2662.3 2903.2 3167.4 3418.5 3545 3893.9 -72.744 318.45 554.4 819.64 1186.9 1449.7 1676 1957.4 2051.4 2302.8 2657.8 2916.2 3169.4 3416.7 3570.4 3884.8 -64.779 324.42 560.56 828.99 1174.8 1439.9 1563.7 1790.6 2067.7 2287.6 2657.4 2905.2 3139.2 3389.1 3507.8 3807.5 -64.852 316.63 568.89 815.61 1198.3 1454.1 1710.6 1933.9 2091.5 2309.6 2660.9 2907.5 3137.2 3389.3 3617.2 -63.089 314.52 553.8 827.06 1183.9 1457.6 1558.9 1808.3 2064.5 2337.1 2653.6 2897 3143.7 3385.7 3668.7 3803.8 -62.23 315.16 564.35 812.15 1199.6 1448.9 1562.7 1839.1 2069.7 2308.9 2649.6 2919.7 3141 3389.9 3723.6 3882.2 -69.662 311.93 564.91 805.25 1209.7 1451.4 1691.9 1932.1 2044.2 2329.4 2657.1 2908.5 3142.8 3390.5 3597.3 3991.1 -183.42 431.34 562.41 809.57 1086.3 1308.9 1555.9 1831.3 2057 2326.9 2591.3 2831.4 3113.9 3367.9 3555.3 3956 -188.49 442.39 572.4 810.76 1065 1326.7 1564.3 1803.4 2060.4 2322.4 2607.2 2824.1 3110.2 3363.9 3644.1 3819.6 -177 437.76 569.82 819.66 1064.1 1309.2 1685.7 1957.5 2066.9 2313.8 2593.2 2847 3116.8 3364.5 3727.3 3881.6 -193.9 441.93 586.9 804.98 1062.5 1312.4 1542.4 1793.1 2073.9 2314.7 2587.8 2845.9 3112.4 3359.8 -193.01 440.26 555.64 814.08 1056.3 1315 1689.9 1961.4 2049.1 2305 2593.9 2847.5 3110.6 3361.1 3711.6 3914.7 -194.71 437.57 566.18 806.73 1069.2 1314.6 1682.7 1942.2 2061.8 2304.6 2607.6 2841.7 3082.9 3330.3 3679.7 3848.2 -184.88 441.22 570.92 794.35 1063.7 1309.9 1678.7 1930 2058 2321.3 2606.7 2845 3084.8 3337.3 3640 3952.1 -189.66 443.59 560.67 816.89 1070.4 1303.4 1550.1 1815.5 2057.6 2323.7 2587.1 2843.5 3086.6 3333.6 3618.2 3815.4 -190.41 440.77 568.96 808.56 1073.8 1322.1 1686.5 1952.8 2068.7 2335.7 2595.7 2845.4 3086 3333.5 3635.6 3939.3 -181.16 440.67 577.54 823.52 1052.5 1322.3 1578.4 1822.2 2079.4 2309.1 2596.9 2851.9 3083.5 3335.1 3531.2 3770.6 -181.09 434.97 687.15 943.33 1192.9 1444 1699.4 1942 2194.6 2445.9 2549.4 2785.1 3056.5 3308.2 3620.5 3932.7 -186.7 446.53 688.18 942.86 1186.1 1441.9 1688.1 1922.2 2196.6 2455.3 2534.8 2776.5 3060.3 3309.4 3514.1 3808.6 -196.76 446 681.26 948.27 1195.8 1433.1 1699 1933 2201.2 2461.4 2547.4 2777.8 3055.7 3307.1 3590.6 3952.8 -200.68 427.11 695.67 946.42 1178.6 1440.1 1538.4 1809 2199.8 2432.5 2531.6 2793.2 3056.6 3308.6 3510.6 3928.1 -190.83 429.57 698.73 931.16 1190.6 1428.9 1698.3 1935 2176.8 2424.7 2530.5 2766.9 3062 3309.7 3689.8 -181.47 441.93 682.32 943.01 1190.1 1459.1 1570.6 1819.6 2189.8 2437.9 2543.3 2782.8 3025.9 3280.2 3581 3855.9 -191.38 435.69 702.76 935.62 1188.3 1438.3 1564.2 1823.9 2191.3 2444.9 2531.9 2782.4 3030.7 3275.7 3677.7 3829.2 -191.97 433.85 686.29 932.65 1183.1 1432.7 1563.9 1826.5 2214.1 2436.8 2529.8 2778.3 3028.3 3281.8 3582 3863.4 -189.51 453.21 691.3 940.86 1180.1 1430.1 1567.1 1835 2199 2448.2 2526.7 2773.8 3030.5 3280.1 3576.2 3893.6 -190.88 435.48 692.66 940.51 1189.5 1448.9 1575.1 1824.2 2190.8 2425.9 2530.6 2783.3 3033.3 3279.5 3733 3838.9 diff --git a/examples/isi_matrix.py b/examples/isi_matrix.py index 3297d3d..2a4d075 100644 --- a/examples/isi_matrix.py +++ b/examples/isi_matrix.py @@ -17,7 +17,7 @@ import matplotlib.pyplot as plt import pyspike as spk # first load the data, interval ending time = 4000, start=0 (default) -spike_trains = spk.load_spike_trains_from_txt("SPIKY_testdata.txt", 4000) +spike_trains = spk.load_spike_trains_from_txt("PySpike_testdata.txt", 4000) print(len(spike_trains)) diff --git a/examples/merge.py b/examples/merge.py index 55c7f0a..726d32b 100644 --- a/examples/merge.py +++ b/examples/merge.py @@ -15,7 +15,7 @@ import matplotlib.pyplot as plt import pyspike as spk # first load the data, ending time = 4000 -spike_trains = spk.load_spike_trains_from_txt("SPIKY_testdata.txt", 4000) +spike_trains = spk.load_spike_trains_from_txt("PySpike_testdata.txt", 4000) spikes = spk.merge_spike_trains([spike_trains[0], spike_trains[1]]) diff --git a/examples/plot.py b/examples/plot.py index d7e2173..4ff75c4 100644 --- a/examples/plot.py +++ b/examples/plot.py @@ -15,7 +15,7 @@ import matplotlib.pyplot as plt import pyspike as spk -spike_trains = spk.load_spike_trains_from_txt("SPIKY_testdata.txt", +spike_trains = spk.load_spike_trains_from_txt("PySpike_testdata.txt", time_interval=(0,4000)) # plot the spike time -- cgit v1.2.3 From 5ce807943fab2ba233cff661e34e4d6a83397b99 Mon Sep 17 00:00:00 2001 From: Mario Mulansky Date: Mon, 13 Oct 2014 11:03:42 +0200 Subject: changed to BSD license --- License | 25 ++++++++----------------- examples/isi_matrix.py | 2 +- examples/merge.py | 2 +- examples/plot.py | 2 +- pyspike/__init__.py | 2 +- pyspike/cython_distance.pyx | 2 +- pyspike/distances.py | 2 +- pyspike/function.py | 2 +- pyspike/python_backend.py | 2 +- pyspike/spikes.py | 2 +- test/test_distance.py | 2 +- test/test_function.py | 2 +- test/test_spikes.py | 2 +- 13 files changed, 20 insertions(+), 29 deletions(-) (limited to 'examples/merge.py') diff --git a/License b/License index 95d0405..472deac 100644 --- a/License +++ b/License @@ -1,21 +1,12 @@ -The MIT License (MIT) +BSD License -Copyright (c) 2014 Mario Mulansky, +Copyright (c) 2014, Mario Mulansky +All rights reserved. -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/examples/isi_matrix.py b/examples/isi_matrix.py index db740dd..7bf1cf9 100644 --- a/examples/isi_matrix.py +++ b/examples/isi_matrix.py @@ -5,7 +5,7 @@ trains. Copyright 2014, Mario Mulansky -Distributed under the MIT License (MIT) +Distributed under the BSD License """ diff --git a/examples/merge.py b/examples/merge.py index 726d32b..2550cdb 100644 --- a/examples/merge.py +++ b/examples/merge.py @@ -4,7 +4,7 @@ Simple example showing the merging of two spike trains. Copyright 2014, Mario Mulansky -Distributed under the MIT License (MIT) +Distributed under the BSD License """ from __future__ import print_function diff --git a/examples/plot.py b/examples/plot.py index 5c3ad4a..da53670 100644 --- a/examples/plot.py +++ b/examples/plot.py @@ -4,7 +4,7 @@ Simple example showing how to load and plot spike trains and their distances. Copyright 2014, Mario Mulansky -Distributed under the MIT License (MIT) +Distributed under the BSD License """ diff --git a/pyspike/__init__.py b/pyspike/__init__.py index 3867e6e..c58a6b1 100644 --- a/pyspike/__init__.py +++ b/pyspike/__init__.py @@ -1,7 +1,7 @@ """ Copyright 2014, Mario Mulansky -Distributed under the MIT License (MIT) +Distributed under the BSD License """ __all__ = ["function", "distances", "spikes"] diff --git a/pyspike/cython_distance.pyx b/pyspike/cython_distance.pyx index 4ab4381..ccf8060 100644 --- a/pyspike/cython_distance.pyx +++ b/pyspike/cython_distance.pyx @@ -12,7 +12,7 @@ improves the performance of spike_distance by a factor of 10! Copyright 2014, Mario Mulansky -Distributed under the MIT License (MIT) +Distributed under the BSD License """ diff --git a/pyspike/distances.py b/pyspike/distances.py index b2eec92..3b9fe1f 100644 --- a/pyspike/distances.py +++ b/pyspike/distances.py @@ -4,7 +4,7 @@ Module containing several functions to compute spike distances Copyright 2014, Mario Mulansky -Distributed under the MIT License (MIT) +Distributed under the BSD License """ import numpy as np diff --git a/pyspike/function.py b/pyspike/function.py index 8107538..7722cc3 100644 --- a/pyspike/function.py +++ b/pyspike/function.py @@ -5,7 +5,7 @@ linear functions. Copyright 2014, Mario Mulansky -Distributed under the MIT License (MIT) +Distributed under the BSD License """ from __future__ import print_function diff --git a/pyspike/python_backend.py b/pyspike/python_backend.py index cf1a92f..a1f5ea2 100644 --- a/pyspike/python_backend.py +++ b/pyspike/python_backend.py @@ -5,7 +5,7 @@ implementation. Copyright 2014, Mario Mulansky -Distributed under the MIT License (MIT) +Distributed under the BSD License """ diff --git a/pyspike/spikes.py b/pyspike/spikes.py index c496ab8..d390222 100644 --- a/pyspike/spikes.py +++ b/pyspike/spikes.py @@ -4,7 +4,7 @@ Module containing several function to load and transform spike trains Copyright 2014, Mario Mulansky -Distributed under the MIT License (MIT) +Distributed under the BSD License """ import numpy as np diff --git a/test/test_distance.py b/test/test_distance.py index 3371cbd..b500b2c 100644 --- a/test/test_distance.py +++ b/test/test_distance.py @@ -4,7 +4,7 @@ Tests the isi- and spike-distance computation Copyright 2014, Mario Mulansky -Distributed under the MIT License (MIT) +Distributed under the BSD License """ diff --git a/test/test_function.py b/test/test_function.py index ed7d6bc..a579796 100644 --- a/test/test_function.py +++ b/test/test_function.py @@ -4,7 +4,7 @@ Tests the PieceWiseConst and PieceWiseLinear functions Copyright 2014, Mario Mulansky -Distributed under the MIT License (MIT) +Distributed under the BSD License """ from __future__ import print_function diff --git a/test/test_spikes.py b/test/test_spikes.py index 349e0bf..bf914c0 100644 --- a/test/test_spikes.py +++ b/test/test_spikes.py @@ -4,7 +4,7 @@ Test loading of spike trains from text files Copyright 2014, Mario Mulansky -Distributed under the MIT License (MIT) +Distributed under the BSD License """ from __future__ import print_function -- cgit v1.2.3 From ecc7898a0b6cd5bc353fd246f3ad549934c82229 Mon Sep 17 00:00:00 2001 From: Mario Mulansky Date: Mon, 27 Apr 2015 17:35:36 +0200 Subject: adjustments of examples --- examples/PySpike_testdata.txt | 0 examples/merge.py | 11 ++++++----- examples/multivariate.py | 5 +++-- examples/plot.py | 6 +++--- examples/spike_sync.py | 3 +-- 5 files changed, 13 insertions(+), 12 deletions(-) mode change 100755 => 100644 examples/PySpike_testdata.txt (limited to 'examples/merge.py') diff --git a/examples/PySpike_testdata.txt b/examples/PySpike_testdata.txt old mode 100755 new mode 100644 diff --git a/examples/merge.py b/examples/merge.py index 2550cdb..2ea96ea 100644 --- a/examples/merge.py +++ b/examples/merge.py @@ -17,12 +17,13 @@ import pyspike as spk # first load the data, ending time = 4000 spike_trains = spk.load_spike_trains_from_txt("PySpike_testdata.txt", 4000) -spikes = spk.merge_spike_trains([spike_trains[0], spike_trains[1]]) +merged_spike_train = spk.merge_spike_trains([spike_trains[0], spike_trains[1]]) -print(spikes) +print(merged_spike_train.spikes) -plt.plot(spike_trains[0], np.ones_like(spike_trains[0]), 'o') -plt.plot(spike_trains[1], np.ones_like(spike_trains[1]), 'x') -plt.plot(spikes, 2*np.ones_like(spikes), 'o') +plt.plot(spike_trains[0].spikes, np.ones_like(spike_trains[0].spikes), 'o') +plt.plot(spike_trains[1].spikes, np.ones_like(spike_trains[1].spikes), 'x') +plt.plot(merged_spike_train.spikes, + 2*np.ones_like(merged_spike_train.spikes), 'o') plt.show() diff --git a/examples/multivariate.py b/examples/multivariate.py index 260b217..53dbf0f 100644 --- a/examples/multivariate.py +++ b/examples/multivariate.py @@ -19,11 +19,12 @@ t_start = time.clock() # load the data time_loading = time.clock() spike_trains = spk.load_spike_trains_from_txt("PySpike_testdata.txt", - time_interval=(0, 4000)) + edges=(0, 4000)) t_loading = time.clock() print("Number of spike trains: %d" % len(spike_trains)) -num_of_spikes = sum([len(spike_trains[i]) for i in xrange(len(spike_trains))]) +num_of_spikes = sum([len(spike_trains[i].spikes) + for i in xrange(len(spike_trains))]) print("Number of spikes: %d" % num_of_spikes) # calculate the multivariate spike distance diff --git a/examples/plot.py b/examples/plot.py index d32c464..9670286 100644 --- a/examples/plot.py +++ b/examples/plot.py @@ -17,11 +17,11 @@ import matplotlib.pyplot as plt import pyspike as spk spike_trains = spk.load_spike_trains_from_txt("PySpike_testdata.txt", - time_interval=(0, 4000)) + edges=(0, 4000)) # plot the spike time -for (i, spikes) in enumerate(spike_trains): - plt.plot(spikes, i*np.ones_like(spikes), 'o') +for (i, spike_train) in enumerate(spike_trains): + plt.plot(spike_train.spikes, i*np.ones_like(spike_train.spikes), 'o') f = spk.isi_profile(spike_trains[0], spike_trains[1]) x, y = f.get_plottable_data() diff --git a/examples/spike_sync.py b/examples/spike_sync.py index 9c5f75c..9e81536 100644 --- a/examples/spike_sync.py +++ b/examples/spike_sync.py @@ -1,12 +1,11 @@ from __future__ import print_function -import numpy as np import matplotlib.pyplot as plt import pyspike as spk spike_trains = spk.load_spike_trains_from_txt("../test/SPIKE_Sync_Test.txt", - time_interval=(0, 4000)) + edges=(0, 4000)) plt.figure() -- cgit v1.2.3 From ee0e980b72c299eed12b7a3afc542fc470dd6d98 Mon Sep 17 00:00:00 2001 From: Mario Mulansky Date: Wed, 9 Mar 2016 12:30:35 +0100 Subject: updated examples to use new unified interface removed all occasions of *multi functions from examples as they are considered deprecated now. Uses unified interface everywhere. --- examples/averages.py | 2 +- examples/merge.py | 6 +++--- examples/multivariate.py | 4 ++-- examples/performance.py | 27 +++++++++++++++------------ examples/plot.py | 5 +++-- examples/profiles.py | 4 ++-- examples/spike_sync.py | 2 +- 7 files changed, 27 insertions(+), 23 deletions(-) (limited to 'examples/merge.py') diff --git a/examples/averages.py b/examples/averages.py index c3e81e2..8b405d0 100644 --- a/examples/averages.py +++ b/examples/averages.py @@ -12,7 +12,7 @@ from __future__ import print_function import pyspike as spk spike_trains = spk.load_spike_trains_from_txt("PySpike_testdata.txt", - time_interval=(0, 4000)) + edges=(0, 4000)) f = spk.isi_profile(spike_trains[0], spike_trains[1]) diff --git a/examples/merge.py b/examples/merge.py index 2ea96ea..b4437a3 100644 --- a/examples/merge.py +++ b/examples/merge.py @@ -21,9 +21,9 @@ merged_spike_train = spk.merge_spike_trains([spike_trains[0], spike_trains[1]]) print(merged_spike_train.spikes) -plt.plot(spike_trains[0].spikes, np.ones_like(spike_trains[0].spikes), 'o') -plt.plot(spike_trains[1].spikes, np.ones_like(spike_trains[1].spikes), 'x') +plt.plot(spike_trains[0], np.ones_like(spike_trains[0]), 'o') +plt.plot(spike_trains[1], np.ones_like(spike_trains[1]), 'x') plt.plot(merged_spike_train.spikes, - 2*np.ones_like(merged_spike_train.spikes), 'o') + 2*np.ones_like(merged_spike_train), 'o') plt.show() diff --git a/examples/multivariate.py b/examples/multivariate.py index 93f8516..e9579a5 100644 --- a/examples/multivariate.py +++ b/examples/multivariate.py @@ -28,7 +28,7 @@ num_of_spikes = sum([len(spike_trains[i]) print("Number of spikes: %d" % num_of_spikes) # calculate the multivariate spike distance -f = spk.spike_profile_multi(spike_trains) +f = spk.spike_profile(spike_trains) t_spike = time.clock() @@ -39,7 +39,7 @@ print("Spike distance from average: %.8f" % avrg) t_avrg = time.clock() # compute average distance directly, should give the same result as above -spike_dist = spk.spike_distance_multi(spike_trains) +spike_dist = spk.spike_distance(spike_trains) print("Spike distance directly: %.8f" % spike_dist) t_dist = time.clock() diff --git a/examples/performance.py b/examples/performance.py index ec6c830..30691f8 100644 --- a/examples/performance.py +++ b/examples/performance.py @@ -31,38 +31,41 @@ for i in range(M): t_end = datetime.now() runtime = (t_end-t_start).total_seconds() +sort_by = 'tottime' +# sort_by = 'cumtime' + print("Spike generation runtime: %.3fs" % runtime) print() print("================ ISI COMPUTATIONS ================") print(" MULTIVARIATE DISTANCE") -cProfile.run('spk.isi_distance_multi(spike_trains)', 'performance.stat') +cProfile.run('spk.isi_distance(spike_trains)', 'performance.stat') p = pstats.Stats('performance.stat') -p.strip_dirs().sort_stats('tottime').print_stats(5) +p.strip_dirs().sort_stats(sort_by).print_stats(5) print(" MULTIVARIATE PROFILE") -cProfile.run('spk.isi_profile_multi(spike_trains)', 'performance.stat') +cProfile.run('spk.isi_profile(spike_trains)', 'performance.stat') p = pstats.Stats('performance.stat') -p.strip_dirs().sort_stats('tottime').print_stats(5) +p.strip_dirs().sort_stats(sort_by).print_stats(5) print("================ SPIKE COMPUTATIONS ================") print(" MULTIVARIATE DISTANCE") -cProfile.run('spk.spike_distance_multi(spike_trains)', 'performance.stat') +cProfile.run('spk.spike_distance(spike_trains)', 'performance.stat') p = pstats.Stats('performance.stat') -p.strip_dirs().sort_stats('tottime').print_stats(5) +p.strip_dirs().sort_stats(sort_by).print_stats(5) print(" MULTIVARIATE PROFILE") -cProfile.run('spk.spike_profile_multi(spike_trains)', 'performance.stat') +cProfile.run('spk.spike_profile(spike_trains)', 'performance.stat') p = pstats.Stats('performance.stat') -p.strip_dirs().sort_stats('tottime').print_stats(5) +p.strip_dirs().sort_stats(sort_by).print_stats(5) print("================ SPIKE-SYNC COMPUTATIONS ================") print(" MULTIVARIATE DISTANCE") -cProfile.run('spk.spike_sync_multi(spike_trains)', 'performance.stat') +cProfile.run('spk.spike_sync(spike_trains)', 'performance.stat') p = pstats.Stats('performance.stat') -p.strip_dirs().sort_stats('tottime').print_stats(5) +p.strip_dirs().sort_stats(sort_by).print_stats(5) print(" MULTIVARIATE PROFILE") -cProfile.run('spk.spike_sync_profile_multi(spike_trains)', 'performance.stat') +cProfile.run('spk.spike_sync_profile(spike_trains)', 'performance.stat') p = pstats.Stats('performance.stat') -p.strip_dirs().sort_stats('tottime').print_stats(5) +p.strip_dirs().sort_stats(sort_by).print_stats(5) diff --git a/examples/plot.py b/examples/plot.py index 1922939..a0e04da 100644 --- a/examples/plot.py +++ b/examples/plot.py @@ -24,7 +24,8 @@ spike_trains = spk.load_spike_trains_from_txt("PySpike_testdata.txt", for (i, spike_train) in enumerate(spike_trains): plt.scatter(spike_train, i*np.ones_like(spike_train), marker='|') -f = spk.isi_profile(spike_trains[0], spike_trains[1]) +# profile of the first two spike trains +f = spk.isi_profile(spike_trains, indices=[0, 1]) x, y = f.get_plottable_data() plt.figure() @@ -32,7 +33,7 @@ plt.plot(x, np.abs(y), '--k', label="ISI-profile") print("ISI-distance: %.8f" % f.avrg()) -f = spk.spike_profile(spike_trains[0], spike_trains[1]) +f = spk.spike_profile(spike_trains, indices=[0, 1]) x, y = f.get_plottable_data() plt.plot(x, y, '-b', label="SPIKE-profile") diff --git a/examples/profiles.py b/examples/profiles.py index 05494bd..8412ffb 100644 --- a/examples/profiles.py +++ b/examples/profiles.py @@ -29,7 +29,7 @@ print("Average ISI distance:", f.avrg()) print() # compute the multivariate ISI profile -f = spk.isi_profile_multi(spike_trains) +f = spk.isi_profile(spike_trains) t = 1200 print("Multivariate ISI value at t =", t, ":", f(t)) @@ -56,7 +56,7 @@ print("Average SPIKE distance:", f.avrg()) print() # compute the multivariate SPIKE profile -f = spk.spike_profile_multi(spike_trains) +f = spk.spike_profile(spike_trains) # SPIKE values at certain points t = 1200 diff --git a/examples/spike_sync.py b/examples/spike_sync.py index 37dbff4..13ca0ce 100644 --- a/examples/spike_sync.py +++ b/examples/spike_sync.py @@ -31,7 +31,7 @@ plt.figure() plt.subplot(211) -f = spk.spike_sync_profile_multi(spike_trains) +f = spk.spike_sync_profile(spike_trains) x, y = f.get_plottable_data() plt.plot(x, y, '-b', alpha=0.7, label="SPIKE-Sync profile") -- cgit v1.2.3