File: it_syncpr.py

package info (click to toggle)
python-pyclustering 0.10.1.2-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 11,128 kB
  • sloc: cpp: 38,888; python: 24,311; sh: 384; makefile: 105
file content (98 lines) | stat: -rwxr-xr-x 3,148 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
"""!

@brief Integration-tests for Phase Oscillatory Neural Network for Pattern Recognition based on Kuramoto model.

@authors Andrei Novikov (pyclustering@yandex.ru)
@date 2014-2020
@copyright BSD-3-Clause

"""


import unittest;

import matplotlib;
matplotlib.use('Agg');

from pyclustering.nnet.tests.syncpr_templates import SyncprTestTemplates;

from pyclustering.nnet import solve_type;
from pyclustering.nnet.syncpr import syncpr;

from pyclustering.core.tests import remove_library;


class SyncprIntegrationTest(unittest.TestCase):
    def testCreateTenOscillatorsNetworkByCore(self):
        net = syncpr(10, 0.1, 0.1, True);
        assert len(net) == 10;

    def testCreateHundredOscillatorsNetworkByCore(self):
        net = syncpr(100, 0.1, 0.1, True);
        assert len(net) == 100;


    def testOutputDynamicFastSolverByCore(self):
        SyncprTestTemplates.templateOutputDynamic(solve_type.FAST, True);

    def testOutputDynamicRK4SolverByCore(self):
        SyncprTestTemplates.templateOutputDynamic(solve_type.RK4, True);


    def testOutputDynamicLengthStaticSimulationByCore(self):
        SyncprTestTemplates.templateOutputDynamicLengthStaticSimulation(True, True);


    def testOutputDynamicLengthDynamicSimulationByCore(self):
        SyncprTestTemplates.templateOutputDynamicLengthDynamicSimulation(True, True);

    def testOutputDynamicLengthDynamicSimulationWithoutCollectingByCore(self):
        SyncprTestTemplates.templateOutputDynamicLengthDynamicSimulation(False, True);


    def testTrainNetworkAndRecognizePatternByCore(self):
        SyncprTestTemplates.templateTrainNetworkAndRecognizePattern(True); 


    def testIncorrectPatternValuesByCore(self):
        SyncprTestTemplates.templateIncorrectPatternValues(True);

    def testIncorrectSmallPatternSizeByCore(self):
        patterns = [ [1, 1, 1, 1, 1, -1] ];
        SyncprTestTemplates.templateIncorrectPatternForTraining(patterns, True);

    def testIncorrectLargePatternSizeByCore(self):
        patterns = [ [1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1] ];
        SyncprTestTemplates.templateIncorrectPatternForTraining(patterns, True);


    def testPatternVisualizerCollectDynamicByCore(self):
        SyncprTestTemplates.templatePatternVisualizer(True, True);

    def testPatternVisualizerWithoutCollectDynamicByCore(self):
        SyncprTestTemplates.templatePatternVisualizer(False, True);


    def testMemoryOrderByCore(self):
        SyncprTestTemplates.templateMemoryOrder(True);


    def testStaticSimulationByCore(self):
        SyncprTestTemplates.templateStaticSimulation(True);


    def testDynamicSimulationByCore(self):
        SyncprTestTemplates.templateDynamicSimulation(True);


    def testGlobalSyncOrderByCore(self):
        SyncprTestTemplates.templateGlobalSyncOrder(True);


    def testLocalSyncOrderByCore(self):
        SyncprTestTemplates.templateLocalSyncOrder(True);


    @remove_library
    def testProcessingWhenLibraryCoreCorrupted(self):
        SyncprTestTemplates.templateOutputDynamic(solve_type.FAST, True);