In [1]:
import targets as targets
import classification as classif
import stage as stage
import rules as rules
import comms as comms
import processor as processor
import datetime

In [2]:
ts = targets.TargetSpace()

In [3]:
bc = classif.BackgroundClassifier()
rnc = classif.RadiusNeighborsClassifier(classif.classification_weights, ts, outliers=bc)

In [4]:
send_triggers = rules.SendTriggers()

In [5]:
classification_processor = processor.ClassificationProcessor(rnc, ts, send_triggers, True)

In [6]:
stage_instance = stage.Stage(classification_processor, ts, send_triggers)

In [7]:
comms_instance = comms.InstrumentComms(stage_instance, True)

In [8]:
#For testing, uncomment 'while True' in stage.Stage.processEligibleStagedData()
#stage_instance.processEligibleStagedData()

In [9]:
#For testing
#stage_instance.recent_targets

In [16]:
stage_instance.processEligibleStagedData()


Exception in thread Thread-3:
Traceback (most recent call last):
  File "/Users/bernease/anaconda/envs/py3.5/lib/python3.5/threading.py", line 914, in _bootstrap_inner
    self.run()
  File "/Users/bernease/anaconda/envs/py3.5/lib/python3.5/threading.py", line 862, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/bernease/Projects/iAMP/iAMP-Novelty-Detection/shablona/processor.py", line 43, in threadFunctions
    self.fitClassificationsAndTriggerRules()
  File "/Users/bernease/Projects/iAMP/iAMP-Novelty-Detection/shablona/processor.py", line 89, in fitClassificationsAndTriggerRules
    X = np.array(target.get_classifier_features()).reshape(1, -1)
  File "/Users/bernease/Projects/iAMP/iAMP-Novelty-Detection/shablona/targets.py", line 76, in get_classifier_features
    adcp_entry['speed']]  # current
TypeError: 'NoneType' object is not subscriptable


In [17]:
stage_instance.data_queues


Out[17]:
{'adcp': 0,
 'camera': [],
 'nims': {371: [65,
   70,
   75,
   80,
   85,
   90,
   95,
   100,
   105,
   110,
   115,
   120,
   125,
   130,
   135,
   140,
   145,
   150,
   155,
   160,
   165,
   170,
   175,
   180,
   185,
   190,
   195,
   200,
   205,
   210,
   215,
   220,
   225,
   230,
   235,
   240,
   245,
   250,
   255,
   260,
   265,
   270,
   275,
   280,
   285,
   290,
   295,
   300,
   305,
   310,
   315,
   320,
   325,
   330,
   334,
   338,
   342,
   346,
   350,
   354,
   359,
   364,
   369,
   374,
   379,
   384,
   389,
   394,
   399,
   404,
   409,
   414,
   419,
   424,
   429,
   434,
   439,
   444,
   449,
   454,
   459,
   464,
   469,
   474,
   479,
   484,
   489,
   494,
   499,
   504,
   509,
   514,
   519,
   524,
   529,
   534,
   539,
   544,
   549,
   554,
   559,
   564,
   569,
   574,
   579,
   584,
   589,
   594,
   599,
   604,
   609,
   614,
   619,
   624,
   629,
   634,
   639,
   644,
   649,
   654,
   659,
   664,
   669,
   674,
   679,
   684,
   689,
   694,
   699,
   704,
   709,
   714,
   719,
   724,
   729,
   734,
   739,
   744,
   749,
   754,
   759,
   764,
   769,
   774,
   779,
   784,
   789,
   794,
   799,
   804,
   809,
   814,
   819,
   824,
   829,
   834,
   839,
   844,
   849,
   854,
   859,
   864,
   869,
   874,
   879,
   884,
   889,
   894,
   899,
   904,
   909,
   914,
   919,
   924,
   929,
   934,
   939,
   944,
   949,
   954,
   959,
   964,
   969,
   974,
   979,
   984,
   989,
   994,
   999,
   1004,
   1009,
   1014,
   1019,
   1024,
   1029,
   1034,
   1039,
   1044,
   1049,
   1054,
   1059,
   1064,
   1069,
   1074,
   1079,
   1084,
   1089,
   1094,
   1099,
   1104,
   1109,
   1114,
   1119,
   1124,
   1129,
   1134,
   1139,
   1144,
   1149,
   1154,
   1159,
   1164],
  380: [66,
   71,
   76,
   81,
   86,
   91,
   96,
   101,
   106,
   111,
   116,
   121,
   126,
   131,
   136,
   141,
   146,
   151,
   156,
   161,
   166,
   171,
   176,
   181,
   186,
   191,
   196,
   201,
   206,
   211,
   216,
   221,
   226,
   231,
   236,
   241,
   246,
   251,
   256,
   261,
   266,
   271,
   276,
   281,
   286,
   291,
   296,
   301,
   306,
   311,
   316,
   321,
   326,
   331,
   335,
   339,
   343,
   347,
   351,
   355,
   360,
   365,
   370,
   375,
   380,
   385,
   390,
   395,
   400,
   405,
   410,
   415,
   420,
   425,
   430,
   435,
   440,
   445,
   450,
   455,
   460,
   465,
   470,
   475,
   480,
   485,
   490,
   495,
   500,
   505,
   510,
   515,
   520,
   525,
   530,
   535,
   540,
   545,
   550,
   555,
   560,
   565,
   570,
   575,
   580,
   585,
   590,
   595,
   600,
   605,
   610,
   615,
   620,
   625,
   630,
   635,
   640,
   645,
   650,
   655,
   660,
   665,
   670,
   675,
   680,
   685,
   690,
   695,
   700,
   705,
   710,
   715,
   720,
   725,
   730,
   735,
   740,
   745,
   750,
   755,
   760,
   765,
   770,
   775,
   780,
   785,
   790,
   795,
   800,
   805,
   810,
   815,
   820,
   825,
   830,
   835,
   840,
   845,
   850,
   855,
   860,
   865,
   870,
   875,
   880,
   885,
   890,
   895,
   900,
   905,
   910,
   915,
   920,
   925,
   930,
   935,
   940,
   945,
   950,
   955,
   960,
   965,
   970,
   975,
   980,
   985,
   990,
   995,
   1000,
   1005,
   1010,
   1015,
   1020,
   1025,
   1030,
   1035,
   1040,
   1045,
   1050,
   1055,
   1060,
   1065,
   1070,
   1075,
   1080,
   1085,
   1090,
   1095,
   1100,
   1105,
   1110,
   1115,
   1120,
   1125,
   1130,
   1135,
   1140,
   1145,
   1150,
   1155,
   1160,
   1165],
  382: [67,
   72,
   77,
   82,
   87,
   92,
   97,
   102,
   107,
   112,
   117,
   122,
   127,
   132,
   137,
   142,
   147,
   152,
   157,
   162,
   167,
   172,
   177,
   182,
   187,
   192,
   197,
   202,
   207,
   212,
   217,
   222,
   227,
   232,
   237,
   242,
   247,
   252,
   257,
   262,
   267,
   272,
   277,
   282,
   287,
   292,
   297,
   302,
   307,
   312,
   317,
   322,
   327],
  384: [68,
   73,
   78,
   83,
   88,
   93,
   98,
   103,
   108,
   113,
   118,
   123,
   128,
   133,
   138,
   143,
   148,
   153,
   158,
   163,
   168,
   173,
   178,
   183,
   188,
   193,
   198,
   203,
   208,
   213,
   218,
   223,
   228,
   233,
   238,
   243,
   248,
   253,
   258,
   263,
   268,
   273,
   278,
   283,
   288,
   293,
   298,
   303,
   308,
   313,
   318,
   323,
   328,
   332,
   336,
   340,
   344,
   348,
   352,
   356,
   361,
   366,
   371,
   376,
   381,
   386,
   391,
   396,
   401,
   406,
   411,
   416,
   421,
   426,
   431,
   436,
   441,
   446,
   451,
   456,
   461,
   466,
   471,
   476,
   481,
   486,
   491,
   496,
   501,
   506,
   511,
   516,
   521,
   526,
   531,
   536,
   541,
   546,
   551,
   556,
   561,
   566,
   571,
   576,
   581,
   586,
   591,
   596,
   601,
   606,
   611,
   616,
   621,
   626,
   631,
   636,
   641,
   646,
   651,
   656,
   661,
   666,
   671,
   676,
   681,
   686,
   691,
   696,
   701,
   706,
   711,
   716,
   721,
   726,
   731,
   736,
   741,
   746,
   751,
   756,
   761,
   766,
   771,
   776,
   781,
   786,
   791,
   796,
   801,
   806,
   811,
   816,
   821,
   826,
   831,
   836,
   841,
   846,
   851,
   856,
   861,
   866,
   871,
   876,
   881,
   886,
   891,
   896,
   901,
   906,
   911,
   916,
   921,
   926,
   931,
   936,
   941,
   946,
   951,
   956,
   961,
   966,
   971,
   976,
   981,
   986,
   991,
   996,
   1001,
   1006,
   1011,
   1016,
   1021,
   1026,
   1031,
   1036,
   1041,
   1046,
   1051,
   1056,
   1061,
   1066,
   1071,
   1076,
   1081,
   1086,
   1091,
   1096,
   1101,
   1106,
   1111,
   1116,
   1121,
   1126,
   1131,
   1136,
   1141,
   1146,
   1151,
   1156,
   1161,
   1166],
  390: [69,
   74,
   79,
   84,
   89,
   94,
   99,
   104,
   109,
   114,
   119,
   124,
   129,
   134,
   139,
   144,
   149,
   154,
   159,
   164,
   169,
   174,
   179,
   184,
   189,
   194,
   199,
   204,
   209,
   214,
   219,
   224,
   229,
   234,
   239,
   244,
   249,
   254,
   259,
   264,
   269,
   274,
   279,
   284,
   289,
   294,
   299,
   304,
   309,
   314,
   319,
   324,
   329,
   333,
   337,
   341,
   345,
   349,
   353,
   357,
   362,
   367,
   372,
   377,
   382,
   387,
   392,
   397,
   402,
   407,
   412,
   417,
   422,
   427,
   432,
   437,
   442,
   447,
   452,
   457,
   462,
   467,
   472,
   477,
   482,
   487,
   492,
   497,
   502,
   507,
   512,
   517,
   522,
   527,
   532,
   537,
   542,
   547,
   552,
   557,
   562,
   567,
   572,
   577,
   582,
   587,
   592,
   597,
   602,
   607,
   612,
   617,
   622,
   627,
   632,
   637,
   642,
   647,
   652,
   657,
   662,
   667,
   672,
   677,
   682,
   687,
   692,
   697,
   702,
   707,
   712,
   717,
   722,
   727,
   732,
   737,
   742,
   747,
   752,
   757,
   762,
   767,
   772,
   777,
   782,
   787,
   792,
   797,
   802,
   807,
   812,
   817,
   822,
   827,
   832,
   837,
   842,
   847,
   852,
   857,
   862,
   867,
   872,
   877,
   882,
   887,
   892,
   897,
   902,
   907,
   912,
   917,
   922,
   927,
   932,
   937,
   942,
   947,
   952,
   957,
   962,
   967,
   972,
   977,
   982,
   987,
   992,
   997,
   1002,
   1007,
   1012,
   1017,
   1022,
   1027,
   1032,
   1037,
   1042,
   1047,
   1052,
   1057,
   1062,
   1067,
   1072,
   1077,
   1082,
   1087,
   1092,
   1097,
   1102,
   1107,
   1112,
   1117,
   1122,
   1127,
   1132,
   1137,
   1142,
   1147,
   1152,
   1157,
   1162,
   1167],
  391: [358,
   363,
   368,
   373,
   378,
   383,
   388,
   393,
   398,
   403,
   408,
   413,
   418,
   423,
   428,
   433,
   438,
   443,
   448,
   453,
   458,
   463,
   468,
   473,
   478,
   483,
   488,
   493,
   498,
   503,
   508,
   513,
   518,
   523,
   528,
   533,
   538,
   543,
   548,
   553,
   558,
   563,
   568,
   573,
   578,
   583,
   588,
   593,
   598,
   603,
   608,
   613,
   618,
   623,
   628,
   633,
   638,
   643,
   648,
   653,
   658,
   663,
   668,
   673,
   678,
   683,
   688,
   693,
   698,
   703,
   708,
   713,
   718,
   723,
   728,
   733,
   738,
   743,
   748,
   753,
   758,
   763,
   768,
   773,
   778,
   783,
   788,
   793,
   798,
   803,
   808,
   813,
   818,
   823,
   828,
   833,
   838,
   843,
   848,
   853,
   858,
   863,
   868,
   873,
   878,
   883,
   888,
   893,
   898,
   903,
   908,
   913,
   918,
   923,
   928,
   933,
   938,
   943,
   948,
   953,
   958,
   963,
   968,
   973,
   978,
   983,
   988,
   993,
   998,
   1003,
   1008,
   1013,
   1018,
   1023,
   1028,
   1033,
   1038,
   1043,
   1048,
   1053,
   1058,
   1063,
   1068,
   1073,
   1078,
   1083,
   1088,
   1093,
   1098,
   1103,
   1108,
   1113,
   1118,
   1123,
   1128,
   1133,
   1138,
   1143,
   1148,
   1153,
   1158,
   1163,
   1168]},
 'pamguard': []}

In [12]:
len(ts.classifier_index_to_target)


Out[12]:
8

In [ ]: