Browse Source

tons of staff from last months

asobolev 2 months ago
parent
commit
f63c1b9f8c
33 changed files with 8675 additions and 1267 deletions
  1. 160 38
      analysis/AEPs/AEPs - cross-session averages.ipynb
  2. 96 143
      analysis/AEPs/AEPs - single.ipynb
  3. 234 0
      analysis/AEPs/AEPs maps.ipynb
  4. 241 0
      analysis/AEPs/COMA.ipynb
  5. 294 0
      analysis/AEPs/Controls.ipynb
  6. 3 3
      analysis/AEPs/Instantaneous mutual dynamics P1-N1-P2-P3.ipynb
  7. 0 202
      analysis/AEPs/LFP modulation by target.ipynb
  8. 0 0
      analysis/AEPs/Metric stats.ipynb
  9. 357 0
      analysis/AEPs/N1 second peak.ipynb
  10. 141 92
      analysis/AEPs/PCA.ipynb
  11. 1 1
      analysis/AEPs/Population - AEP shape reconstruction based on GLM profiles.ipynb
  12. 277 0
      analysis/AEPs/Population correlations at diff phases to pulse onset.ipynb
  13. 454 0
      analysis/AEPs/UMAP.ipynb
  14. 0 0
      analysis/AL/LFP Spectrum.ipynb
  15. 1029 0
      analysis/AL/Population unit correlations.ipynb
  16. 398 0
      analysis/AL/Spectrum.ipynb
  17. 33 16
      analysis/Behavior/MoSeq tSNE - UMAP - PCA.ipynb
  18. 279 0
      analysis/CCR/AEPs - att state.ipynb
  19. 399 0
      analysis/Decoding/Stimulus in HPC by state.ipynb
  20. 281 0
      analysis/MMR/MMR by state.ipynb
  21. 792 0
      analysis/PSTH/By pop att state.ipynb
  22. 233 93
      analysis/PSTH/PCA.ipynb
  23. 19 15
      analysis/PSTH/TGT - BGR and Target Onset - Offset.ipynb
  24. 219 36
      analysis/PSTH/shuffle.ipynb
  25. 830 0
      analysis/Target/Population response to TGT entrance.ipynb
  26. 47 49
      analysis/Target/population - micro.ipynb
  27. 3 1
      analysis/spatial - allocentric.ipynb
  28. 1060 1
      playground.ipynb
  29. 206 0
      postprocessing/calibration.ipynb
  30. 325 223
      reporting/State-dependent neural dynamics in the gerbil Auditory Cortex/01 - Dynamics of Auditory Evoked Responses.ipynb
  31. 1 1
      reporting/State-dependent neural dynamics in the gerbil Auditory Cortex/03 - Tone duration modulates AEP and single units response structure in time.ipynb
  32. 30 30
      session/sessions.py
  33. 233 323
      sorting/ss-neurosuite.ipynb

File diff suppressed because it is too large
+ 160 - 38
analysis/AEPs/AEPs - cross-session averages.ipynb


File diff suppressed because it is too large
+ 96 - 143
analysis/AEPs/AEPs - single.ipynb


File diff suppressed because it is too large
+ 234 - 0
analysis/AEPs/AEPs maps.ipynb


File diff suppressed because it is too large
+ 241 - 0
analysis/AEPs/COMA.ipynb


File diff suppressed because it is too large
+ 294 - 0
analysis/AEPs/Controls.ipynb


+ 3 - 3
analysis/AEPs/Instantaneous mutual dynamics P1-N1-P2-P3.ipynb

@@ -2,7 +2,7 @@
  "cells": [
   {
    "cell_type": "code",
-   "execution_count": 324,
+   "execution_count": 1,
    "id": "afdb26cb",
    "metadata": {},
    "outputs": [],
@@ -14,7 +14,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 325,
+   "execution_count": 2,
    "id": "6afe19e4",
    "metadata": {},
    "outputs": [],
@@ -31,7 +31,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 326,
+   "execution_count": 3,
    "id": "dc5880ac",
    "metadata": {},
    "outputs": [

File diff suppressed because it is too large
+ 0 - 202
analysis/AEPs/LFP modulation by target.ipynb


analysis/AEPs/Metric stats and controls.ipynb → analysis/AEPs/Metric stats.ipynb


File diff suppressed because it is too large
+ 357 - 0
analysis/AEPs/N1 second peak.ipynb


File diff suppressed because it is too large
+ 141 - 92
analysis/AEPs/PCA.ipynb


+ 1 - 1
analysis/AEPs/Population - AEP shape reconstruction based on GLM profiles.ipynb

@@ -2,7 +2,7 @@
  "cells": [
   {
    "cell_type": "code",
-   "execution_count": 2,
+   "execution_count": 1,
    "id": "afdb26cb",
    "metadata": {},
    "outputs": [],

File diff suppressed because it is too large
+ 277 - 0
analysis/AEPs/Population correlations at diff phases to pulse onset.ipynb


File diff suppressed because it is too large
+ 454 - 0
analysis/AEPs/UMAP.ipynb


analysis/LFP Spectrum.ipynb → analysis/AL/LFP Spectrum.ipynb


File diff suppressed because it is too large
+ 1029 - 0
analysis/AL/Population unit correlations.ipynb


File diff suppressed because it is too large
+ 398 - 0
analysis/AL/Spectrum.ipynb


+ 33 - 16
analysis/Behavior/MoSeq tSNE - UMAP - PCA.ipynb

@@ -2,7 +2,7 @@
  "cells": [
   {
    "cell_type": "code",
-   "execution_count": 3,
+   "execution_count": 1,
    "id": "4001a375",
    "metadata": {},
    "outputs": [],
@@ -14,7 +14,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 4,
+   "execution_count": 2,
    "id": "570920e2",
    "metadata": {},
    "outputs": [],
@@ -34,7 +34,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 5,
+   "execution_count": 3,
    "id": "26ba4176",
    "metadata": {},
    "outputs": [
@@ -62,7 +62,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 256,
+   "execution_count": 4,
    "id": "43e652f6",
    "metadata": {},
    "outputs": [],
@@ -94,7 +94,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 255,
+   "execution_count": 5,
    "id": "4daf16cf",
    "metadata": {
     "scrolled": true
@@ -103,10 +103,7 @@
     {
      "data": {
       "text/plain": [
-       "['009266_hippoSIT_2023-04-13_08-57-46',\n",
-       " '009266_hippoSIT_2023-04-14_09-17-34',\n",
-       " '009266_hippoSIT_2023-04-17_09-06-10',\n",
-       " '009266_hippoSIT_2023-04-17_17-04-17',\n",
+       "['009266_hippoSIT_2023-04-17_17-04-17',\n",
        " '009266_hippoSIT_2023-04-18_10-10-37',\n",
        " '009266_hippoSIT_2023-04-18_17-03-10',\n",
        " '009266_hippoSIT_2023-04-19_10-33-51',\n",
@@ -118,7 +115,6 @@
        " '009266_hippoSIT_2023-04-24_16-56-55',\n",
        " '009266_hippoSIT_2023-04-26_08-20-17',\n",
        " '009266_hippoSIT_2023-05-02_12-22-14',\n",
-       " '009266_hippoSIT_2023-05-04_09-11-06',\n",
        " '009266_hippoSIT_2023-05-04_19-47-15',\n",
        " '009266_hippoSIT_2023-05-22_09-27-22',\n",
        " '009266_hippoSIT_2023-05-23_09-18-05',\n",
@@ -127,7 +123,7 @@
        " '009266_hippoSIT_2023-06-19_08-58-35']"
       ]
      },
-     "execution_count": 255,
+     "execution_count": 5,
      "metadata": {},
      "output_type": "execute_result"
     }
@@ -149,17 +145,17 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 257,
+   "execution_count": 6,
    "id": "7f4ffd8a",
    "metadata": {},
    "outputs": [
     {
      "data": {
       "text/plain": [
-       "'009266_hippoSIT_2023-04-20_08-57-39'"
+       "'009266_hippoSIT_2023-04-21_13-12-31'"
       ]
      },
-     "execution_count": 257,
+     "execution_count": 6,
      "metadata": {},
      "output_type": "execute_result"
     }
@@ -171,7 +167,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 258,
+   "execution_count": 7,
    "id": "f81aaedf",
    "metadata": {},
    "outputs": [],
@@ -185,7 +181,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 260,
+   "execution_count": 8,
    "id": "aac2b161",
    "metadata": {},
    "outputs": [],
@@ -202,6 +198,27 @@
     "#syl_ratio_mx = build_ratio_mx(session)"
    ]
   },
+  {
+   "cell_type": "code",
+   "execution_count": 11,
+   "id": "10bca63b",
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/plain": [
+       "(2400, 10)"
+      ]
+     },
+     "execution_count": 11,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "syl_ratio_mx.shape"
+   ]
+  },
   {
    "cell_type": "code",
    "execution_count": 261,

File diff suppressed because it is too large
+ 279 - 0
analysis/CCR/AEPs - att state.ipynb


File diff suppressed because it is too large
+ 399 - 0
analysis/Decoding/Stimulus in HPC by state.ipynb


File diff suppressed because it is too large
+ 281 - 0
analysis/MMR/MMR by state.ipynb


File diff suppressed because it is too large
+ 792 - 0
analysis/PSTH/By pop att state.ipynb


File diff suppressed because it is too large
+ 233 - 93
analysis/PSTH/PCA.ipynb


File diff suppressed because it is too large
+ 19 - 15
analysis/PSTH/TGT - BGR and Target Onset - Offset.ipynb


File diff suppressed because it is too large
+ 219 - 36
analysis/PSTH/shuffle.ipynb


File diff suppressed because it is too large
+ 830 - 0
analysis/Target/Population response to TGT entrance.ipynb


File diff suppressed because it is too large
+ 47 - 49
analysis/Target/population - micro.ipynb


+ 3 - 1
analysis/spatial - allocentric.ipynb

@@ -122,7 +122,9 @@
    "cell_type": "code",
    "execution_count": 5,
    "id": "eebb858c",
-   "metadata": {},
+   "metadata": {
+    "scrolled": false
+   },
    "outputs": [
     {
      "data": {

File diff suppressed because it is too large
+ 1060 - 1
playground.ipynb


File diff suppressed because it is too large
+ 206 - 0
postprocessing/calibration.ipynb


File diff suppressed because it is too large
+ 325 - 223
reporting/State-dependent neural dynamics in the gerbil Auditory Cortex/01 - Dynamics of Auditory Evoked Responses.ipynb


+ 1 - 1
reporting/State-dependent neural dynamics in the gerbil Auditory Cortex/03 - Tone duration modulates AEP and single units response structure in time.ipynb

@@ -295,7 +295,7 @@
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.10.9"
+   "version": "3.8.10"
   }
  },
  "nbformat": 4,

+ 30 - 30
session/sessions.py

@@ -12,15 +12,15 @@ selected_009266 = {
     '009266_hippoSIT_2023-04-18_17-03-10': {'A1': 17, 'PPC': 32},  # 7 + 55 correction, 5494 events
     '009266_hippoSIT_2023-04-19_10-33-51': {'A1': 17, 'PPC': 32},  # 4 + 55 correction, 6424 events
     '009266_hippoSIT_2023-04-20_08-57-39': {'A1': 1, 'PPC': 32},   # 1 + 55 correction, 6424 events
-    '009266_hippoSIT_2023-04-24_16-56-55': {'A1': 17, 'PPC': 32},  # 5 + 55* correction, 6165 events, frequency
-    '009266_hippoSIT_2023-04-26_08-20-17': {'A1': 17, 'PPC': 32},  # 12 + 55* correction, 6095 events, duration
-    '009266_hippoSIT_2023-05-02_12-22-14': {'A1': 20, 'PPC': 40},  # 10 + 55 correction, 5976 events, frequency
-    #'009266_hippoSIT_2023-05-04_09-11-06': {'A1': 17, 'PPC': 32},  # 5 + 55* correction, 4487 events, coma session with baseline AEPs
-    '009266_hippoSIT_2023-05-04_19-47-15': {'A1': 20, 'PPC': 32},  # 2 + 55 correction, 5678 events, frequency
     '009266_hippoSIT_2023-04-20_15-24-14': {'A1': 20, 'PPC': 32},  # 2 + 55 correction, 5612 events
     '009266_hippoSIT_2023-04-21_08-43-00': {'A1': 20, 'PPC': 32},  # 14 + 55 correction, 6282 events
     '009266_hippoSIT_2023-04-21_13-12-31': {'A1': 20, 'PPC': 32},  # 15 + 55 correction, 6041 events
     '009266_hippoSIT_2023-04-24_10-08-11': {'A1': 20, 'PPC': 40},  # 21 + 55 correction, 5579 events
+    '009266_hippoSIT_2023-04-24_16-56-55': {'A1': 17, 'PPC': 32},  # 5 + 55* correction, 6165 events, frequency
+    '009266_hippoSIT_2023-04-26_08-20-17': {'A1': 17, 'PPC': 32},  # 12 + 55* correction, 6095 events, duration
+    '009266_hippoSIT_2023-05-02_12-22-14': {'A1': 20, 'PPC': 40},  # 10 + 55 correction, 5976 events, frequency
+    #'009266_hippoSIT_2023-05-04_09-11-06': {'A1': 17, 'PPC': 32},  # 5 + 55* correction, 4487 events, coma session
+    '009266_hippoSIT_2023-05-04_19-47-15': {'A1': 20, 'PPC': 32},  # 2 + 55 correction, 5678 events, frequency
 
     # A1 - HPC
     '009266_hippoSIT_2023-05-22_09-27-22': {'A1': 9, 'HPC': 56},
@@ -32,35 +32,35 @@ selected_009266 = {
 
 # Old PPC sessions (P1 is on 30ms)
 selected_008229 = {
-    '008229_hippoSIT_2022-05-17_21-44-43': {'PPC': 0}, # chs: 0, 31, 54, 56; 103 corr
-    '008229_hippoSIT_2022-05-16_20-36-44': {'PPC': 0}, # chs: 0, 56; 91 corr
-    '008229_hippoSIT_2022-05-20_15-54-39': {'PPC': 0}, # chs: 0, 56; 65 corr
-    '008229_hippoSIT_2022-05-18_14-36-18': {'PPC': 0}, # chs: 0, 56; 70 corr
+    '008229_hippoSIT_2022-05-16_20-36-44': {"AEPs": {'PPC': 0}, "ephys": {"offset": 98}}, # chs: 0, 56; 91 corr
+    '008229_hippoSIT_2022-05-17_21-44-43': {"AEPs": {'PPC': 0}, "ephys": {"offset": 97}}, # chs: 0, 31, 54, 56; 103 corr
+    '008229_hippoSIT_2022-05-18_14-36-18': {"AEPs": {'PPC': 0}, "ephys": {"offset": 105}}, # chs: 0, 56; 70 corr
+    '008229_hippoSIT_2022-05-20_15-54-39': {"AEPs": {'PPC': 0}, "ephys": {"offset": 86}}, # chs: 0, 56; 65 corr
 }
 
 
 selected_009265 = {
-    '009265_hippoSIT_2023-02-24_09-53-26': {'A1': 48, 'PPC': 40},  # 90 corr
-    '009265_hippoSIT_2023-02-24_17-22-46': {'A1': 48, 'PPC': 40},  # 108 corr
-    '009265_hippoSIT_2023-02-27_10-18-32': {'A1': 16, 'PPC': 32},  # 66 corr
-    '009265_hippoSIT_2023-02-27_15-33-46': {'A1': 29, 'PPC': 32},  # 105 corr
-    '009265_hippoSIT_2023-02-28_09-16-50': {'A1': 29, 'PPC': 32},  # 100 corr
-    '009265_hippoSIT_2023-02-28_13-16-10': {'A1': 48, 'PPC': 32},  # 106 corr
-    '009265_hippoSIT_2023-02-28_20-45-04': {'A1': 48, 'PPC': 40},  # 87 corr
-    '009265_hippoSIT_2023-03-01_10-46-12': {'A1': 48, 'PPC': 40},  # 83 corr
-    '009265_hippoSIT_2023-03-02_09-32-54': {'A1': 28, 'PPC': 40},  # 101 corr
-    '009265_hippoSIT_2023-03-02_16-27-42': {'A1': 48, 'PPC': 40},  # 114 corr
-    '009265_hippoSIT_2023-03-02_20-11-35': {'A1': 48, 'PPC': 40},  # 83 corr
-    '009265_hippoSIT_2023-03-03_09-37-07': {'A1': 48, 'PPC': 40},  # 85 corr
-    '009265_hippoSIT_2023-03-03_16-00-47': {'A1': 48, 'PPC': 40},  # 102 corr
-    '009265_hippoSIT_2023-03-04_11-12-04': {'A1': 48, 'PPC': 40},  # 94 corr
-    '009265_hippoSIT_2023-03-05_11-52-17': {'A1': 48, 'PPC': 0},   # 66 corr
-    '009265_hippoSIT_2023-03-05_18-31-32': {'A1': 48, 'PPC': 35},  # 43 corr
-    '009265_hippoSIT_2023-03-08_18-10-07': {'A1': 48, 'PPC': 37},  # 102 corr
-    '009265_hippoSIT_2023-03-09_20-03-08': {'A1': 48, 'PPC': 40},  # 100 corr
-    '009265_hippoSIT_2023-03-10_09-57-34': {'A1': 48, 'PPC': 40},  # 98 corr
-    '009265_hippoSIT_2023-04-13_09-54-39': {'A1': 1, 'PPC': 33},   # 258 corr
-    '009265_hippoSIT_2023-04-20_11-39-02': {'A1': 16, 'PPC': 33},  # 0 corr??
+    '009265_hippoSIT_2023-02-24_09-53-26': {"AEPs": {'A1': 48, 'PPC': 40}, "ephys": {"offset": 116}},  # 90 corr
+    '009265_hippoSIT_2023-02-24_17-22-46': {"AEPs": {'A1': 48, 'PPC': 40}, "ephys": {"offset": 134}},  # 108 corr
+    '009265_hippoSIT_2023-02-27_10-18-32': {"AEPs": {'A1': 16, 'PPC': 32}, "ephys": {"offset": 97}},  # 66 corr
+    '009265_hippoSIT_2023-02-27_15-33-46': {"AEPs": {'A1': 29, 'PPC': 32}, "ephys": {"offset": 107}},  # 105 corr
+    '009265_hippoSIT_2023-02-28_09-16-50': {"AEPs": {'A1': 29, 'PPC': 32}, "ephys": {"offset": 101}},  # 100 corr
+    '009265_hippoSIT_2023-02-28_13-16-10': {"AEPs": {'A1': 48, 'PPC': 32}, "ephys": {"offset": 104}},  # 106 corr
+    '009265_hippoSIT_2023-02-28_20-45-04': {"AEPs": {'A1': 48, 'PPC': 40}, "ephys": {"offset": 103}},  # 87 corr
+    '009265_hippoSIT_2023-03-01_10-46-12': {"AEPs": {'A1': 48, 'PPC': 40}, "ephys": {"offset": 101}},  # 83 corr
+    '009265_hippoSIT_2023-03-02_09-32-54': {"AEPs": {'A1': 28, 'PPC': 40}, "ephys": {"offset": 105}},  # 101 corr
+    '009265_hippoSIT_2023-03-02_16-27-42': {"AEPs": {'A1': 48, 'PPC': 40}, "ephys": {"offset": 124}},  # 114 corr
+    '009265_hippoSIT_2023-03-02_20-11-35': {"AEPs": {'A1': 48, 'PPC': 40}, "ephys": {"offset": 105}},  # 83 corr
+    '009265_hippoSIT_2023-03-03_09-37-07': {"AEPs": {'A1': 48, 'PPC': 40}, "ephys": {"offset": 95}},  # 85 corr
+    '009265_hippoSIT_2023-03-03_16-00-47': {"AEPs": {'A1': 48, 'PPC': 40}, "ephys": {"offset": 111}},  # 102 corr
+    '009265_hippoSIT_2023-03-04_11-12-04': {"AEPs": {'A1': 48, 'PPC': 40}, "ephys": {"offset": 93}},  # 94 corr
+    '009265_hippoSIT_2023-03-05_11-52-17': {"AEPs": {'A1': 48, 'PPC': 0}, "ephys": {"offset": 108}},   # 66 corr
+    '009265_hippoSIT_2023-03-05_18-31-32': {"AEPs": {'A1': 48, 'PPC': 35}, "ephys": {"offset": 97}},  # 43 corr
+    '009265_hippoSIT_2023-03-08_18-10-07': {"AEPs": {'A1': 48, 'PPC': 37}, "ephys": {"offset": 100}},  # 102 corr
+    '009265_hippoSIT_2023-03-09_20-03-08': {"AEPs": {'A1': 48, 'PPC': 40}, "ephys": {"offset": 97}},  # 100 corr
+    '009265_hippoSIT_2023-03-10_09-57-34': {"AEPs": {'A1': 48, 'PPC': 40}, "ephys": {"offset": 96}},  # 98 corr
+    '009265_hippoSIT_2023-04-13_09-54-39': {"AEPs": {'A1': 1, 'PPC': 33}, "ephys": {"offset": 5}},   # 258 corr
+    '009265_hippoSIT_2023-04-20_11-39-02': {"AEPs": {'A1': 16, 'PPC': 33}, "ephys": {"offset": 0}},  # 0 corr??
 }
 
 

+ 233 - 323
sorting/ss-neurosuite.ipynb

@@ -810,13 +810,7 @@
       "\tIteration 102Q: 3 clusters Score -1015933 nChanged 6\n",
       "\tIteration 103Q: 3 clusters Score -1015936 nChanged 12\n",
       "\tIteration 104Q: 3 clusters Score -1015940 nChanged 12\n",
-      "\tIteration 105Q: 3 clusters Score -1015945 nChanged 12\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "\tIteration 105Q: 3 clusters Score -1015945 nChanged 12\n",
       "\tIteration 106Q: 3 clusters Score -1015948 nChanged 10\n",
       "\tIteration 107Q: 3 clusters Score -1015952 nChanged 9\n",
       "\tIteration 108Q: 3 clusters Score -1015956 nChanged 7\n",
@@ -1288,13 +1282,7 @@
       "Trying to split cluster 74 (757 points) \n",
       "\tIteration 0F: 2 clusters Score -101872.5 nChanged 0\n",
       "\tIteration 0F: 3 clusters Score -98685.12 nChanged 120\n",
-      "\tIteration 1F: 3 clusters Score -98991.63 nChanged 26\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "\tIteration 1F: 3 clusters Score -98991.63 nChanged 26\n",
       "\tIteration 2Q: 3 clusters Score -99070.27 nChanged 10\n",
       "\tIteration 3Q: 3 clusters Score -99096.95 nChanged 3\n",
       "\tIteration 4Q: 3 clusters Score -99104.48 nChanged 2\n",
@@ -1599,13 +1587,7 @@
       "\tIteration 44Q: 3 clusters Score -1062870 nChanged 123\n",
       "\tIteration 45Q: 3 clusters Score -1062938 nChanged 112\n",
       "\tIteration 46Q: 3 clusters Score -1062997 nChanged 113\n",
-      "\tIteration 47Q: 3 clusters Score -1063060 nChanged 98\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "\tIteration 47Q: 3 clusters Score -1063060 nChanged 98\n",
       "\tIteration 48Q: 3 clusters Score -1063112 nChanged 83\n",
       "\tIteration 49Q: 3 clusters Score -1063150 nChanged 78\n",
       "\tIteration 50Q: 3 clusters Score -1063188 nChanged 84\n",
@@ -2075,13 +2057,7 @@
       "\tIteration 3Q: 3 clusters Score -192356.3 nChanged 28\n",
       "\tIteration 4Q: 3 clusters Score -192406 nChanged 16\n",
       "\tIteration 5Q: 3 clusters Score -192434.5 nChanged 14\n",
-      "\tIteration 6Q: 3 clusters Score -192459.6 nChanged 8\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "\tIteration 6Q: 3 clusters Score -192459.6 nChanged 8\n",
       "\tIteration 7Q: 3 clusters Score -192470.8 nChanged 6\n",
       "\tIteration 8Q: 3 clusters Score -192480.3 nChanged 3\n",
       "\tIteration 9Q: 3 clusters Score -192484 nChanged 6\n",
@@ -2545,13 +2521,7 @@
       "\tIteration 39Q: 3 clusters Score -1056182 nChanged 1\n",
       "\tIteration 40F: 3 clusters Score -1056182 nChanged 0\n",
       "Trying to split cluster 15 (2359 points) \n",
-      "\tIteration 0F: 2 clusters Score -333314.7 nChanged 0\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "\tIteration 0F: 2 clusters Score -333314.7 nChanged 0\n",
       "\tIteration 0F: 3 clusters Score -328923.8 nChanged 638\n",
       "\tIteration 1F: 3 clusters Score -329581.8 nChanged 161\n",
       "\tIteration 2F: 3 clusters Score -329785 nChanged 100\n",
@@ -2862,13 +2832,7 @@
       "\tIteration 35Q: 3 clusters Score -380057 nChanged 2\n",
       "\tIteration 36Q: 3 clusters Score -380059.2 nChanged 1\n",
       "\tIteration 37Q: 3 clusters Score -380060.3 nChanged 1\n",
-      "\tIteration 38Q: 3 clusters Score -380061.2 nChanged 0\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "\tIteration 38Q: 3 clusters Score -380061.2 nChanged 0\n",
       "\tIteration 39F: 3 clusters Score -380061.2 nChanged 0\n",
       "Trying to split cluster 51 (4807 points) \n",
       "\tIteration 0F: 2 clusters Score -687516.8 nChanged 0\n",
@@ -3335,13 +3299,7 @@
       "\tIteration 25Q: 3 clusters Score -1057844 nChanged 59\n",
       "\tIteration 26Q: 3 clusters Score -1057874 nChanged 67\n",
       "\tIteration 27Q: 3 clusters Score -1057906 nChanged 62\n",
-      "\tIteration 28Q: 3 clusters Score -1057932 nChanged 51\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "\tIteration 28Q: 3 clusters Score -1057932 nChanged 51\n",
       "\tIteration 29Q: 3 clusters Score -1057955 nChanged 69\n",
       "\tIteration 30Q: 3 clusters Score -1057988 nChanged 62\n",
       "\tIteration 31Q: 3 clusters Score -1058018 nChanged 70\n",
@@ -3652,13 +3610,7 @@
       "\tIteration 65Q: 3 clusters Score -1245041 nChanged 4\n",
       "\tIteration 66Q: 3 clusters Score -1245043 nChanged 6\n",
       "\tIteration 67Q: 3 clusters Score -1245046 nChanged 5\n",
-      "\tIteration 68Q: 3 clusters Score -1245044 nChanged 6\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "\tIteration 68Q: 3 clusters Score -1245044 nChanged 6\n",
       "\tIteration 69Q: 3 clusters Score -1245045 nChanged 10\n",
       "\tIteration 70Q: 3 clusters Score -1245052 nChanged 11\n",
       "\tIteration 71Q: 3 clusters Score -1245060 nChanged 12\n",
@@ -3968,13 +3920,7 @@
       "\tIteration 10Q: 3 clusters Score -1222393 nChanged 187\n",
       "\tIteration 11Q: 3 clusters Score -1222509 nChanged 182\n",
       "\tIteration 12Q: 3 clusters Score -1222622 nChanged 173\n",
-      "\tIteration 13Q: 3 clusters Score -1222734 nChanged 148\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "\tIteration 13Q: 3 clusters Score -1222734 nChanged 148\n",
       "\tIteration 14Q: 3 clusters Score -1222820 nChanged 147\n",
       "\tIteration 15Q: 3 clusters Score -1222906 nChanged 125\n",
       "\tIteration 16Q: 3 clusters Score -1222987 nChanged 117\n",
@@ -4753,13 +4699,7 @@
       "\tIteration 1F: 3 clusters Score -26845.24 nChanged 9\n",
       "\tIteration 2Q: 3 clusters Score -26865.09 nChanged 5\n",
       "\tIteration 3Q: 3 clusters Score -26878.45 nChanged 3\n",
-      "\tIteration 4Q: 3 clusters Score -26886.72 nChanged 2\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "\tIteration 4Q: 3 clusters Score -26886.72 nChanged 2\n",
       "\tIteration 5Q: 3 clusters Score -26891.06 nChanged 0\n",
       "\tIteration 6F: 3 clusters Score -26891.06 nChanged 0\n",
       "Trying to split cluster 42 (4974 points) \n",
@@ -5230,13 +5170,7 @@
       "Deleting Class 72. Lose 1150.887573 but Gain 1942.078125\n",
       "Iteration 59Q: 26 clusters Score -4658176 nChanged 830\n",
       "Deleting Class 52. Lose 1192.384399 but Gain 1942.082031\n",
-      "Iteration 60F: 25 clusters Score -4659650 nChanged 959\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "Iteration 60F: 25 clusters Score -4659650 nChanged 959\n",
       "Deleting Class 30. Lose 1318.661987 but Gain 1942.078125\n",
       "Iteration 61Q: 24 clusters Score -4661177 nChanged 997\n",
       "Deleting Class 23. Lose 1359.628540 but Gain 1942.078125\n",
@@ -5545,13 +5479,7 @@
       "\tIteration 6Q: 3 clusters Score -178978.7 nChanged 19\n",
       "\tIteration 7Q: 3 clusters Score -178990.1 nChanged 29\n",
       "\tIteration 8Q: 3 clusters Score -179007.7 nChanged 39\n",
-      "\tIteration 9Q: 3 clusters Score -179030.2 nChanged 34\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "\tIteration 9Q: 3 clusters Score -179030.2 nChanged 34\n",
       "\tIteration 10Q: 3 clusters Score -179044.4 nChanged 27\n",
       "\tIteration 11Q: 3 clusters Score -179055.9 nChanged 28\n",
       "\tIteration 12Q: 3 clusters Score -179069.2 nChanged 23\n",
@@ -6018,13 +5946,7 @@
       "\tIteration 21Q: 3 clusters Score -266846.7 nChanged 16\n",
       "\tIteration 22Q: 3 clusters Score -266859.1 nChanged 12\n",
       "\tIteration 23Q: 3 clusters Score -266867 nChanged 6\n",
-      "\tIteration 24Q: 3 clusters Score -266870.9 nChanged 6\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "\tIteration 24Q: 3 clusters Score -266870.9 nChanged 6\n",
       "\tIteration 25Q: 3 clusters Score -266873.3 nChanged 5\n",
       "\tIteration 26Q: 3 clusters Score -266875.8 nChanged 1\n",
       "\tIteration 27Q: 3 clusters Score -266876.5 nChanged 0\n",
@@ -6334,13 +6256,7 @@
       "\tIteration 0F: 3 clusters Score -133600.3 nChanged 592\n",
       "\tIteration 1F: 3 clusters Score -134030.9 nChanged 140\n",
       "\tIteration 2F: 3 clusters Score -134149.2 nChanged 92\n",
-      "\tIteration 3F: 3 clusters Score -134220.2 nChanged 44\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "\tIteration 3F: 3 clusters Score -134220.2 nChanged 44\n",
       "\tIteration 4Q: 3 clusters Score -134254.8 nChanged 45\n",
       "\tIteration 5Q: 3 clusters Score -134286.9 nChanged 38\n",
       "\tIteration 6Q: 3 clusters Score -134315.5 nChanged 31\n",
@@ -7274,13 +7190,7 @@
       "\tIteration 2F: 3 clusters Score -196308.9 nChanged 130\n",
       "\tIteration 3F: 3 clusters Score -196391.1 nChanged 81\n",
       "\tIteration 4Q: 3 clusters Score -196442.1 nChanged 61\n",
-      "\tIteration 5Q: 3 clusters Score -196473.3 nChanged 60\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "\tIteration 5Q: 3 clusters Score -196473.3 nChanged 60\n",
       "\tIteration 6Q: 3 clusters Score -196507.3 nChanged 53\n",
       "\tIteration 7Q: 3 clusters Score -196540.8 nChanged 50\n",
       "\tIteration 8Q: 3 clusters Score -196573.5 nChanged 50\n",
@@ -7588,13 +7498,7 @@
       "\tIteration 65Q: 3 clusters Score -535599.2 nChanged 9\n",
       "\tIteration 66Q: 3 clusters Score -535600.9 nChanged 16\n",
       "\tIteration 67Q: 3 clusters Score -535604.5 nChanged 12\n",
-      "\tIteration 68Q: 3 clusters Score -535608.9 nChanged 14\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "\tIteration 68Q: 3 clusters Score -535608.9 nChanged 14\n",
       "\tIteration 69Q: 3 clusters Score -535612.1 nChanged 13\n",
       "\tIteration 70Q: 3 clusters Score -535612.5 nChanged 9\n",
       "\tIteration 71Q: 3 clusters Score -535616.1 nChanged 7\n",
@@ -7905,13 +7809,7 @@
       "\tIteration 2F: 3 clusters Score -133919.5 nChanged 78\n",
       "\tIteration 3Q: 3 clusters Score -133979.6 nChanged 57\n",
       "\tIteration 4Q: 3 clusters Score -134026 nChanged 46\n",
-      "\tIteration 5Q: 3 clusters Score -134051.1 nChanged 33\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "\tIteration 5Q: 3 clusters Score -134051.1 nChanged 33\n",
       "\tIteration 6Q: 3 clusters Score -134073.9 nChanged 22\n",
       "\tIteration 7Q: 3 clusters Score -134089.5 nChanged 18\n",
       "\tIteration 8Q: 3 clusters Score -134100.5 nChanged 23\n",
@@ -8220,13 +8118,7 @@
       "\tIteration 6Q: 3 clusters Score -331390.9 nChanged 187\n",
       "\tIteration 7Q: 3 clusters Score -331511.6 nChanged 153\n",
       "\tIteration 8Q: 3 clusters Score -331600.3 nChanged 135\n",
-      "\tIteration 9Q: 3 clusters Score -331696.5 nChanged 132\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "\tIteration 9Q: 3 clusters Score -331696.5 nChanged 132\n",
       "\tIteration 10Q: 3 clusters Score -331796.2 nChanged 128\n",
       "\tIteration 11Q: 3 clusters Score -331874.2 nChanged 94\n",
       "\tIteration 12Q: 3 clusters Score -331930 nChanged 84\n",
@@ -8673,13 +8565,7 @@
       "\tIteration 27F: 3 clusters Score -132256.2 nChanged 0\n",
       "Trying to split cluster 39 (839 points) \n",
       "\tIteration 0F: 2 clusters Score -62523.88 nChanged 0\n",
-      "\tIteration 0F: 3 clusters Score -61139.98 nChanged 205\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "\tIteration 0F: 3 clusters Score -61139.98 nChanged 205\n",
       "\tIteration 1F: 3 clusters Score -61368.66 nChanged 58\n",
       "\tIteration 2F: 3 clusters Score -61434.6 nChanged 18\n",
       "\tIteration 3Q: 3 clusters Score -61453.82 nChanged 13\n",
@@ -9227,13 +9113,7 @@
       "Deleting Class 82. Lose 1000.856689 but Gain 1965.796875\n",
       "Iteration 45Q: 40 clusters Score -5524884 nChanged 1165\n",
       "Deleting Class 74. Lose 1042.123535 but Gain 1965.796875\n",
-      "Iteration 46Q: 39 clusters Score -5526667 nChanged 1326\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "Iteration 46Q: 39 clusters Score -5526667 nChanged 1326\n",
       "Deleting Class 75. Lose 1041.902344 but Gain 1965.796875\n",
       "Iteration 47Q: 38 clusters Score -5528542 nChanged 1245\n",
       "Deleting Class 3. Lose 1154.672974 but Gain 1965.796875\n",
@@ -10094,13 +9974,7 @@
       "\tIteration 1F: 3 clusters Score -169897.7 nChanged 167\n",
       "\tIteration 2F: 3 clusters Score -170025.4 nChanged 107\n",
       "\tIteration 3Q: 3 clusters Score -170101.7 nChanged 79\n",
-      "\tIteration 4Q: 3 clusters Score -170144.2 nChanged 46\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "\tIteration 4Q: 3 clusters Score -170144.2 nChanged 46\n",
       "\tIteration 5Q: 3 clusters Score -170166.3 nChanged 29\n",
       "\tIteration 6Q: 3 clusters Score -170181.9 nChanged 21\n",
       "\tIteration 7Q: 3 clusters Score -170194.3 nChanged 24\n",
@@ -11425,13 +11299,7 @@
       "\tIteration 15Q: 3 clusters Score -125499.1 nChanged 76\n",
       "\tIteration 16Q: 3 clusters Score -125644.3 nChanged 50\n",
       "\tIteration 17Q: 3 clusters Score -125717.6 nChanged 31\n",
-      "\tIteration 18Q: 3 clusters Score -125748.3 nChanged 23\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "\tIteration 18Q: 3 clusters Score -125748.3 nChanged 23\n",
       "\tIteration 19Q: 3 clusters Score -125775.2 nChanged 24\n",
       "\tIteration 20F: 3 clusters Score -125800.5 nChanged 15\n",
       "\tIteration 21Q: 3 clusters Score -125825.2 nChanged 11\n",
@@ -11818,13 +11686,7 @@
       "\tIteration 16Q: 3 clusters Score -220814 nChanged 41\n",
       "\tIteration 17Q: 3 clusters Score -220841.6 nChanged 35\n",
       "\tIteration 18Q: 3 clusters Score -220861.7 nChanged 30\n",
-      "\tIteration 19Q: 3 clusters Score -220878.9 nChanged 29\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "\tIteration 19Q: 3 clusters Score -220878.9 nChanged 29\n",
       "\tIteration 20F: 3 clusters Score -220893.8 nChanged 21\n",
       "\tIteration 21Q: 3 clusters Score -220904.9 nChanged 21\n",
       "\tIteration 22Q: 3 clusters Score -220914.5 nChanged 22\n",
@@ -12383,13 +12245,7 @@
       "\tIteration 0F: 2 clusters Score -25475.01 nChanged 0\n",
       "\tIteration 0F: 3 clusters Score -24408.38 nChanged 73\n",
       "\tIteration 1F: 3 clusters Score -24557.79 nChanged 18\n",
-      "\tIteration 2Q: 3 clusters Score -24608.55 nChanged 5\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "\tIteration 2Q: 3 clusters Score -24608.55 nChanged 5\n",
       "\tIteration 3Q: 3 clusters Score -24617.32 nChanged 1\n",
       "\tIteration 4Q: 3 clusters Score -24620.37 nChanged 2\n",
       "\tIteration 5Q: 3 clusters Score -24624.18 nChanged 0\n",
@@ -13247,13 +13103,7 @@
       "\tIteration 12Q: 3 clusters Score -61226.86 nChanged 4\n",
       "\tIteration 13Q: 3 clusters Score -61230.67 nChanged 4\n",
       "\tIteration 14Q: 3 clusters Score -61234.61 nChanged 2\n",
-      "\tIteration 15Q: 3 clusters Score -61235.88 nChanged 1\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "\tIteration 15Q: 3 clusters Score -61235.88 nChanged 1\n",
       "\tIteration 16Q: 3 clusters Score -61236.38 nChanged 0\n",
       "\tIteration 17F: 3 clusters Score -61236.38 nChanged 0\n",
       "Trying to split cluster 75 (3212 points) \n",
@@ -13561,13 +13411,7 @@
       "Iteration 76Q: 34 clusters Score -9166968 nChanged 123\n",
       "Iteration 77Q: 34 clusters Score -9167010 nChanged 133\n",
       "Iteration 78Q: 34 clusters Score -9167036 nChanged 143\n",
-      "Trying to split cluster 4 (650 points) \n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "Trying to split cluster 4 (650 points) \n",
       "\tIteration 0F: 2 clusters Score -39923.85 nChanged 0\n",
       "\tIteration 0F: 3 clusters Score -38649.6 nChanged 167\n",
       "\tIteration 1F: 3 clusters Score -38878.2 nChanged 43\n",
@@ -14109,13 +13953,7 @@
       "\tIteration 4F: 3 clusters Score -678599 nChanged 486\n",
       "\tIteration 5F: 3 clusters Score -678933.8 nChanged 337\n",
       "\tIteration 6Q: 3 clusters Score -679118.6 nChanged 239\n",
-      "\tIteration 7Q: 3 clusters Score -679227.9 nChanged 156\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "\tIteration 7Q: 3 clusters Score -679227.9 nChanged 156\n",
       "\tIteration 8Q: 3 clusters Score -679287.8 nChanged 120\n",
       "\tIteration 9Q: 3 clusters Score -679327.9 nChanged 107\n",
       "\tIteration 10Q: 3 clusters Score -679364.6 nChanged 94\n",
@@ -15523,13 +15361,7 @@
       "\tIteration 5Q: 3 clusters Score -184948.8 nChanged 66\n",
       "\tIteration 6Q: 3 clusters Score -184985.2 nChanged 47\n",
       "\tIteration 7Q: 3 clusters Score -185012 nChanged 53\n",
-      "\tIteration 8Q: 3 clusters Score -185045.7 nChanged 46\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "\tIteration 8Q: 3 clusters Score -185045.7 nChanged 46\n",
       "\tIteration 9Q: 3 clusters Score -185073.1 nChanged 50\n",
       "\tIteration 10Q: 3 clusters Score -185098.8 nChanged 42\n",
       "\tIteration 11Q: 3 clusters Score -185124.4 nChanged 40\n",
@@ -16229,13 +16061,7 @@
       "\tIteration 20F: 3 clusters Score -457949.3 nChanged 104\n",
       "\tIteration 21Q: 3 clusters Score -457987.1 nChanged 110\n",
       "\tIteration 22Q: 3 clusters Score -458029.9 nChanged 113\n",
-      "\tIteration 23Q: 3 clusters Score -458078 nChanged 113\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "\tIteration 23Q: 3 clusters Score -458078 nChanged 113\n",
       "\tIteration 24Q: 3 clusters Score -458125.9 nChanged 127\n",
       "\tIteration 25Q: 3 clusters Score -458177.1 nChanged 123\n",
       "\tIteration 26Q: 3 clusters Score -458229.5 nChanged 104\n",
@@ -16545,13 +16371,7 @@
       "\tIteration 58Q: 3 clusters Score -154885.6 nChanged 2\n",
       "\tIteration 59Q: 3 clusters Score -154887.2 nChanged 3\n",
       "\tIteration 60F: 3 clusters Score -154888.9 nChanged 3\n",
-      "\tIteration 61Q: 3 clusters Score -154890.2 nChanged 1\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "\tIteration 61Q: 3 clusters Score -154890.2 nChanged 1\n",
       "\tIteration 62Q: 3 clusters Score -154891 nChanged 0\n",
       "\tIteration 63F: 3 clusters Score -154891 nChanged 0\n",
       "Trying to split cluster 22 (5207 points) \n",
@@ -16860,13 +16680,7 @@
       "\tIteration 5Q: 3 clusters Score -95246.86 nChanged 26\n",
       "\tIteration 6Q: 3 clusters Score -95269.77 nChanged 15\n",
       "\tIteration 7Q: 3 clusters Score -95282.77 nChanged 20\n",
-      "\tIteration 8Q: 3 clusters Score -95297.13 nChanged 16\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "\tIteration 8Q: 3 clusters Score -95297.13 nChanged 16\n",
       "\tIteration 9Q: 3 clusters Score -95315.96 nChanged 17\n",
       "\tIteration 10Q: 3 clusters Score -95328.22 nChanged 10\n",
       "\tIteration 11Q: 3 clusters Score -95339.23 nChanged 10\n",
@@ -17411,13 +17225,7 @@
       "\tIteration 9Q: 3 clusters Score -150722.4 nChanged 16\n",
       "\tIteration 10Q: 3 clusters Score -150732.6 nChanged 12\n",
       "\tIteration 11Q: 3 clusters Score -150741.5 nChanged 15\n",
-      "\tIteration 12Q: 3 clusters Score -150753.1 nChanged 14\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "\tIteration 12Q: 3 clusters Score -150753.1 nChanged 14\n",
       "\tIteration 13Q: 3 clusters Score -150763 nChanged 16\n",
       "\tIteration 14Q: 3 clusters Score -150775.2 nChanged 10\n",
       "\tIteration 15Q: 3 clusters Score -150782.5 nChanged 10\n",
@@ -17882,13 +17690,7 @@
       "\tIteration 11Q: 3 clusters Score -88024.47 nChanged 6\n",
       "\tIteration 12Q: 3 clusters Score -88028.52 nChanged 4\n",
       "\tIteration 13Q: 3 clusters Score -88032.74 nChanged 8\n",
-      "\tIteration 14Q: 3 clusters Score -88045.88 nChanged 9\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "\tIteration 14Q: 3 clusters Score -88045.88 nChanged 9\n",
       "\tIteration 15Q: 3 clusters Score -88054.32 nChanged 7\n",
       "\tIteration 16Q: 3 clusters Score -88061 nChanged 9\n",
       "\tIteration 17Q: 3 clusters Score -88069.67 nChanged 10\n",
@@ -18356,13 +18158,7 @@
       "\tIteration 0F: 2 clusters Score -2157159 nChanged 0\n",
       "\tIteration 0F: 3 clusters Score -2137977 nChanged 13039\n",
       "\tIteration 1F: 3 clusters Score -2145614 nChanged 1506\n",
-      "\tIteration 2F: 3 clusters Score -2146247 nChanged 1476\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "\tIteration 2F: 3 clusters Score -2146247 nChanged 1476\n",
       "\tIteration 3F: 3 clusters Score -2146906 nChanged 1450\n",
       "\tIteration 4F: 3 clusters Score -2147558 nChanged 1346\n",
       "\tIteration 5Q: 3 clusters Score -2148193 nChanged 1252\n",
@@ -18674,13 +18470,7 @@
       "\tIteration 0F: 3 clusters Score -304124.8 nChanged 1849\n",
       "\tIteration 1F: 3 clusters Score -305225 nChanged 379\n",
       "\tIteration 2F: 3 clusters Score -305501.5 nChanged 313\n",
-      "\tIteration 3F: 3 clusters Score -305712.5 nChanged 264\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "\tIteration 3F: 3 clusters Score -305712.5 nChanged 264\n",
       "\tIteration 4F: 3 clusters Score -305892 nChanged 224\n",
       "\tIteration 5Q: 3 clusters Score -306072.9 nChanged 208\n",
       "\tIteration 6Q: 3 clusters Score -306204.3 nChanged 185\n",
@@ -19224,13 +19014,7 @@
       "\tIteration 53F: 3 clusters Score -154893 nChanged 0\n",
       "Trying to split cluster 22 (5209 points) \n",
       "\tIteration 0F: 2 clusters Score -383039.5 nChanged 0\n",
-      "\tIteration 0F: 3 clusters Score -378872.2 nChanged 2161\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "\tIteration 0F: 3 clusters Score -378872.2 nChanged 2161\n",
       "\tIteration 1F: 3 clusters Score -380200.1 nChanged 418\n",
       "\tIteration 2F: 3 clusters Score -380447.9 nChanged 313\n",
       "\tIteration 3F: 3 clusters Score -380640.2 nChanged 260\n",
@@ -19696,13 +19480,7 @@
       "\tIteration 44Q: 3 clusters Score -2155928 nChanged 12\n",
       "\tIteration 45Q: 3 clusters Score -2155931 nChanged 8\n",
       "\tIteration 46Q: 3 clusters Score -2155932 nChanged 10\n",
-      "\tIteration 47Q: 3 clusters Score -2155935 nChanged 13\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "\tIteration 47Q: 3 clusters Score -2155935 nChanged 13\n",
       "\tIteration 48Q: 3 clusters Score -2155944 nChanged 9\n",
       "\tIteration 49Q: 3 clusters Score -2155950 nChanged 11\n",
       "\tIteration 50Q: 3 clusters Score -2155959 nChanged 9\n",
@@ -20014,13 +19792,7 @@
       "\tIteration 17Q: 3 clusters Score -306060 nChanged 30\n",
       "\tIteration 18Q: 3 clusters Score -306074.7 nChanged 22\n",
       "\tIteration 19Q: 3 clusters Score -306084.6 nChanged 17\n",
-      "\tIteration 20F: 3 clusters Score -306092.9 nChanged 12\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "\tIteration 20F: 3 clusters Score -306092.9 nChanged 12\n",
       "\tIteration 21Q: 3 clusters Score -306099 nChanged 16\n",
       "\tIteration 22Q: 3 clusters Score -306103.9 nChanged 11\n",
       "\tIteration 23Q: 3 clusters Score -306107.6 nChanged 10\n",
@@ -21021,13 +20793,7 @@
       "\tIteration 58Q: 3 clusters Score -379391.9 nChanged 23\n",
       "\tIteration 59Q: 3 clusters Score -379397.6 nChanged 18\n",
       "\tIteration 60F: 3 clusters Score -379401.5 nChanged 16\n",
-      "\tIteration 61Q: 3 clusters Score -379404.7 nChanged 14\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "\tIteration 61Q: 3 clusters Score -379404.7 nChanged 14\n",
       "\tIteration 62Q: 3 clusters Score -379407.8 nChanged 15\n",
       "\tIteration 63Q: 3 clusters Score -379411.2 nChanged 20\n",
       "\tIteration 64Q: 3 clusters Score -379415.6 nChanged 22\n",
@@ -21338,13 +21104,7 @@
       "\tIteration 23Q: 3 clusters Score -136087.9 nChanged 5\n",
       "\tIteration 24Q: 3 clusters Score -136090.6 nChanged 8\n",
       "\tIteration 25Q: 3 clusters Score -136094.5 nChanged 8\n",
-      "\tIteration 26Q: 3 clusters Score -136097.6 nChanged 4\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "\tIteration 26Q: 3 clusters Score -136097.6 nChanged 4\n",
       "\tIteration 27Q: 3 clusters Score -136100 nChanged 3\n",
       "\tIteration 28Q: 3 clusters Score -136102.2 nChanged 5\n",
       "\tIteration 29Q: 3 clusters Score -136104.2 nChanged 4\n",
@@ -22593,13 +22353,7 @@
       "\tIteration 12Q: 3 clusters Score -121634.9 nChanged 13\n",
       "\tIteration 13Q: 3 clusters Score -121641 nChanged 9\n",
       "\tIteration 14Q: 3 clusters Score -121648.6 nChanged 9\n",
-      "\tIteration 15Q: 3 clusters Score -121654.2 nChanged 12\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "\tIteration 15Q: 3 clusters Score -121654.2 nChanged 12\n",
       "\tIteration 16Q: 3 clusters Score -121661.6 nChanged 8\n",
       "\tIteration 17Q: 3 clusters Score -121668.1 nChanged 4\n",
       "\tIteration 18Q: 3 clusters Score -121669.4 nChanged 1\n",
@@ -22908,13 +22662,7 @@
       "\tIteration 36Q: 3 clusters Score -359422.1 nChanged 6\n",
       "\tIteration 37Q: 3 clusters Score -359423.4 nChanged 5\n",
       "\tIteration 38Q: 3 clusters Score -359423.9 nChanged 4\n",
-      "\tIteration 39Q: 3 clusters Score -359425.8 nChanged 1\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "\tIteration 39Q: 3 clusters Score -359425.8 nChanged 1\n",
       "\tIteration 40F: 3 clusters Score -359426.6 nChanged 2\n",
       "\tIteration 41Q: 3 clusters Score -359427.6 nChanged 2\n",
       "\tIteration 42Q: 3 clusters Score -359427.9 nChanged 3\n",
@@ -23456,13 +23204,7 @@
       "\tIteration 29Q: 3 clusters Score -226785 nChanged 11\n",
       "\tIteration 30Q: 3 clusters Score -226788.8 nChanged 12\n",
       "\tIteration 31Q: 3 clusters Score -226792.8 nChanged 14\n",
-      "\tIteration 32Q: 3 clusters Score -226797.4 nChanged 11\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "\tIteration 32Q: 3 clusters Score -226797.4 nChanged 11\n",
       "\tIteration 33Q: 3 clusters Score -226802.1 nChanged 17\n",
       "\tIteration 34Q: 3 clusters Score -226811 nChanged 19\n",
       "\tIteration 35Q: 3 clusters Score -226820.4 nChanged 25\n",
@@ -23772,13 +23514,7 @@
       "\tIteration 34Q: 3 clusters Score -387117.3 nChanged 4\n",
       "\tIteration 35Q: 3 clusters Score -387117.9 nChanged 3\n",
       "\tIteration 36Q: 3 clusters Score -387118.9 nChanged 2\n",
-      "\tIteration 37Q: 3 clusters Score -387119.8 nChanged 4\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "\tIteration 37Q: 3 clusters Score -387119.8 nChanged 4\n",
       "\tIteration 38Q: 3 clusters Score -387121 nChanged 2\n",
       "\tIteration 39Q: 3 clusters Score -387121.1 nChanged 3\n",
       "\tIteration 40F: 3 clusters Score -387122.6 nChanged 4\n",
@@ -24479,13 +24215,7 @@
       "\tIteration 5Q: 3 clusters Score -167557.4 nChanged 45\n",
       "\tIteration 6Q: 3 clusters Score -167583.4 nChanged 50\n",
       "\tIteration 7Q: 3 clusters Score -167610.9 nChanged 42\n",
-      "\tIteration 8Q: 3 clusters Score -167635.3 nChanged 33\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "\tIteration 8Q: 3 clusters Score -167635.3 nChanged 33\n",
       "\tIteration 9Q: 3 clusters Score -167655 nChanged 30\n",
       "\tIteration 10Q: 3 clusters Score -167671.3 nChanged 27\n",
       "\tIteration 11Q: 3 clusters Score -167685.9 nChanged 22\n",
@@ -24793,13 +24523,7 @@
       "\tIteration 40F: 3 clusters Score -354482 nChanged 19\n",
       "\tIteration 41Q: 3 clusters Score -354487.9 nChanged 14\n",
       "\tIteration 42Q: 3 clusters Score -354490.8 nChanged 19\n",
-      "\tIteration 43Q: 3 clusters Score -354497.1 nChanged 19\n"
-     ]
-    },
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
+      "\tIteration 43Q: 3 clusters Score -354497.1 nChanged 19\n",
       "\tIteration 44Q: 3 clusters Score -354501.2 nChanged 4\n",
       "\tIteration 45Q: 3 clusters Score -354502.3 nChanged 2\n",
       "\tIteration 46Q: 3 clusters Score -354503.4 nChanged 5\n",
@@ -25034,10 +24758,196 @@
   },
   {
    "cell_type": "code",
-   "execution_count": null,
+   "execution_count": 1,
    "id": "536aa218",
    "metadata": {},
    "outputs": [],
+   "source": [
+    "import os\n",
+    "\n",
+    "def build_file_path(where, session, file_name):\n",
+    "    return os.path.join(where, session.split('_')[0], session, file_name)"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 31,
+   "id": "c948f78e",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "import xml.etree.ElementTree as ET\n",
+    "\n",
+    "session = \"009266_hippoSIT_2023-04-17_17-04-17\"\n",
+    "fp = build_file_path(\"/home/sobolev/nevermind/Andrey/sandbox/data/\", session, \"\")\n",
+    "xml_path = os.path.join(fp, '%s.xml' % session)\n",
+    "root = ET.parse(xml_path).getroot()"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 32,
+   "id": "df355d00",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "ch_groups_xml = root.findall('spikeDetection')[0].findall('channelGroups')[0]\n",
+    "\n",
+    "channel_groups = {}\n",
+    "for i, grp in enumerate(ch_groups_xml):\n",
+    "    for channels in grp:\n",
+    "        if not channels.tag == 'channels':\n",
+    "            continue\n",
+    "        channel_groups[i+1] = [int(ch.text) for ch in channels]"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 34,
+   "id": "dd0b0525",
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/plain": [
+       "{1: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 14, 15],\n",
+       " 2: [17, 18, 19, 20, 22, 23, 24, 25, 27, 28, 29],\n",
+       " 3: [32, 33, 34, 35, 36, 37, 38, 39],\n",
+       " 4: [40, 41, 42, 43, 44, 45, 46, 47],\n",
+       " 5: [48, 49, 50, 51, 52, 53, 54, 55],\n",
+       " 6: [56, 57, 58, 59, 60, 61, 62, 63]}"
+      ]
+     },
+     "execution_count": 34,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "channel_groups"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 36,
+   "id": "7ff1e136",
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/plain": [
+       "['009266_hippoSIT_2023-04-17_17-04-17.spk.1',\n",
+       " '009266_hippoSIT_2023-04-17_17-04-17.spk.2',\n",
+       " '009266_hippoSIT_2023-04-17_17-04-17.spk.3',\n",
+       " '009266_hippoSIT_2023-04-17_17-04-17.spk.4',\n",
+       " '009266_hippoSIT_2023-04-17_17-04-17.spk.5',\n",
+       " '009266_hippoSIT_2023-04-17_17-04-17.spk.6']"
+      ]
+     },
+     "execution_count": 36,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "['%s.spk.%d' % (session, el) for el in channel_groups.keys()]"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 42,
+   "id": "bdcc7e77",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "electrodes = list(channel_groups.keys())\n",
+    "electrode = 1"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 49,
+   "id": "34923c36",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "num_fet = [\"\".join(['1' for x in range(len(channel_groups[el]) * 3 + 1)]) for el in electrodes]"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 46,
+   "id": "7084ae7e",
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/plain": [
+       "range(0, 43)"
+      ]
+     },
+     "execution_count": 46,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "range(len(channel_groups[electrode]) * 3 + 1)"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 45,
+   "id": "1f2908aa",
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/plain": [
+       "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 14, 15]"
+      ]
+     },
+     "execution_count": 45,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "channel_groups[electrode]"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 51,
+   "id": "c4d36016",
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/plain": [
+       "[(1, '1111111111111111111111111111111111111111111'),\n",
+       " (2, '1111111111111111111111111111111111'),\n",
+       " (3, '1111111111111111111111111'),\n",
+       " (4, '1111111111111111111111111'),\n",
+       " (5, '1111111111111111111111111'),\n",
+       " (6, '1111111111111111111111111')]"
+      ]
+     },
+     "execution_count": 51,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "[(el, fet) for el, fet in zip(electrodes, num_fet)]"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "id": "fffcd365",
+   "metadata": {},
+   "outputs": [],
    "source": []
   }
  ],