{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/usr/lib/python3/dist-packages/urllib3/connection.py:391: SubjectAltNameWarning: Certificate for merlin.fmf.uni-lj.si has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/urllib3/urllib3/issues/497 for details.)\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "User: andrej studen CSRF: 1f11a0b613d172716bb47acf122d5106\n"
     ]
    }
   ],
   "source": [
    "import sys\n",
    "import os\n",
    "import SimpleITK\n",
    "import numpy\n",
    "import matplotlib.pyplot\n",
    "import subprocess\n",
    "sys.path.append(os.path.join(os.path.expanduser('~'),'software','src','nixSuite','wrapper'))\n",
    "import nixWrapper\n",
    "nixWrapper.loadLibrary('labkeyInterface')\n",
    "import labkeyInterface\n",
    "net=labkeyInterface.labkeyInterface()\n",
    "fconfig=os.path.join(os.path.expanduser('~'),'.labkey','network.json')\n",
    "net.init(fconfig)\n",
    "net.getCSRF()\n",
    "import labkeyFileBrowser\n",
    "sys.path.append(os.getcwd())\n",
    "import downloadPatient\n",
    "fb=labkeyFileBrowser.labkeyFileBrowser(net)\n",
    "project='dinamic_spect/Patients'\n",
    "locDir=os.path.join(os.path.expanduser('~'),'temp','dynamicSPECT')\n",
    "import labkeyDatabaseBrowser\n",
    "db=labkeyDatabaseBrowser.labkeyDB(net)\n",
    "ds=db.selectRows(project,'study','Imaging',[])\n",
    "patients=[row['aliasID'] for row in ds['rows']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#doAnalysis\n",
    "import subprocess\n",
    "\n",
    "patients=list(set(patients))\n",
    "#this is if IVF is inferred from locations\n",
    "runScript='doPixelAnalysis.sh'\n",
    "#this is if IVF is taken from clusters\n",
    "runScript='doPixelIVFAnalysis.sh'\n",
    "scriptPath=os.path.join(os.path.expanduser('~'),\\\n",
    "                        'scripts','dynamicSPECT',runScript)\n",
    "#patients1=['10KFMIR']\n",
    "patients1=patients\n",
    "for pId in patients1:\n",
    "    if pId.find('8')==0:\n",
    "        continue\n",
    "    for sigma2 in [0.1,1.0,4.0]:\n",
    "        print('{}/{}'.format(pId,sigma2))\n",
    "        subprocess.run([scriptPath,pId,str(sigma2)], \\\n",
    "                         check=True, stdout=subprocess.PIPE)\n",
    "    \n",
    "   "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [],
   "source": [
    "def getPatientNIM(id):\n",
    "    f=os.path.join(locDir,id,id+'Volume19.nrrd')\n",
    "    im=SimpleITK.ReadImage(f)\n",
    "    nim=SimpleITK.GetArrayFromImage(im)\n",
    "    return nim\n",
    "\n",
    "def getIWeights(locDir,p,nclass,realizationId,ic):\n",
    "    fname='{}_{}_{}_center{}_centerWeigth.nrrd'.\\\n",
    "            format(p,nclass,realizationId+1,ic+1)\n",
    "    uFile=os.path.join(locDir,p,fname)\n",
    "            \n",
    "    imU=SimpleITK.ReadImage(uFile)\n",
    "    return SimpleITK.GetArrayFromImage(imU)\n",
    "\n",
    "\n",
    "\n",
    "#gets weights by class for a particular realization and sigma2 averaging\n",
    "def getWeights(project,locDir,p,nclass,realizationId,sigma2,na):\n",
    "    #for w1, classes are in 0 to nclass-1 space\n",
    "    idFilter={'variable':'aliasID','value':p,'oper':'eq'}\n",
    "    ds=db.selectRows(project,'study','Segmentation',[idFilter])\n",
    "    pts={r['regionId']:[float(x) for x in [r['x'],r['y'],r['z']]] for r in ds['rows']}\n",
    "       \n",
    "    w={region:numpy.zeros(nclass) for region in pts}\n",
    "    na2=0.5*(na-1)\n",
    "    \n",
    "    for c in numpy.arange(nclass):\n",
    "        fname='{}_{}_{}_center{}_centerWeigth.nrrd'.\\\n",
    "            format(p,nclass,realizationId+1,c+1)\n",
    "        uFile=os.path.join(locDir,p,fname)\n",
    "            \n",
    "        imU=SimpleITK.ReadImage(uFile)\n",
    "        nU=SimpleITK.GetArrayFromImage(imU)\n",
    "        \n",
    "        \n",
    "        for region in w:\n",
    "            #print(pts[region])\n",
    "            idx=[int(x) for x in pts[region]]\n",
    "            #print(nU[tuple(idx)])\n",
    "            \n",
    "            #gaussian weighted summation of surrounding pixels\n",
    "            fidx=numpy.zeros(3)\n",
    "            fs=0\n",
    "            for i in numpy.arange(na):\n",
    "                fidx[0]=idx[0]+(i-na2)\n",
    "                for j in numpy.arange(na):\n",
    "                    fidx[1]=idx[1]+(j-na2)\n",
    "                    for k in numpy.arange(na):\n",
    "                        fidx[2]=idx[2]+(k-na2)\n",
    "                        fidx=[int(x) for x in fidx]\n",
    "                        fw=numpy.array(fidx)-numpy.array(pts[region])\n",
    "                        fw=numpy.exp(-0.5*sum(fw*fw)/sigma2);\n",
    "                        fs+=fw\n",
    "                        w[region][c]+=fw*nU[tuple(fidx)]\n",
    "                        #print('{}/{}: {:.2f} {:.2g}'.format(idx,fidx,fw,nU[tuple(fidx)]))\n",
    "            w[region][c]/=fs\n",
    "            \n",
    "            \n",
    "    return w\n",
    "\n",
    "#gets fitPar for a particular realization\n",
    "def getFitPar(locDir,p,nclass,realizationId):\n",
    "    #fitGoodnes A tau alpha delay [k1 BVF k2 delay]xNcenters\n",
    "    fname='{}_{}_{}_fitParFinal.txt'.format(p,nclass,realizationId+1)\n",
    "    uFile=os.path.join(locDir,p,fname)\n",
    "    return numpy.genfromtxt(uFile,delimiter='\\t')\n",
    "\n",
    "def getFitParIVF(locDir,p,nclass,realizationId):\n",
    "    #fitGoodnes A tau alpha delay [k1 BVF k2 delay]xNcenters\n",
    "    fname='{}_{}_{}_IVF_fitParFinal.txt'.format(p,nclass,realizationId+1)\n",
    "    uFile=os.path.join(locDir,p,fname)\n",
    "    return numpy.genfromtxt(uFile,delimiter='\\t')\n",
    "\n",
    "def getFitParPixel(locDir,p,nclass,sigma2):\n",
    "    sigmaCode='{:.2f}'.format(sigma2)\n",
    "    sigmaCode=sigmaCode.replace(\".\",\"p\")\n",
    "    fname='{}_{}_{}_Pixel_fitParFinal.txt'.format(p,nclass,sigmaCode)\n",
    "    uFile=os.path.join(locDir,p,fname)\n",
    "    return numpy.genfromtxt(uFile,delimiter='\\t')\n",
    "\n",
    "def getFitParPixelIVF(locDir,p,nclass,sigma2):\n",
    "    sigmaCode='{:.2f}'.format(sigma2)\n",
    "    sigmaCode=sigmaCode.replace(\".\",\"p\")\n",
    "    fname='{}_{}_{}_PixelIVF_fitParFinal.txt'.format(p,nclass,sigmaCode)\n",
    "    uFile=os.path.join(locDir,p,fname)\n",
    "    return numpy.genfromtxt(uFile,delimiter='\\t')\n",
    "\n",
    "def getK1(fitPar,iclass):\n",
    "    #fitGoodnes A tau alpha delay [k1 BVF k2 delay]xNcenters\n",
    "    #0 to nclass-1 space\n",
    "    return fitPar[4*iclass+5]\n",
    "\n",
    "def calculateK1(w,fitPar):\n",
    "    k1={region:{'M':0,'W':0} for region in w}\n",
    "    for region in w:\n",
    "        cmax=numpy.argmax(w[region])\n",
    "        k1[region]['M']=getK1(fitPar,cmax)\n",
    "        fs=0\n",
    "        for c in numpy.arange(len(w[region])):\n",
    "            fs+=w[region][c]*getK1(fitPar,c)\n",
    "        k1[region]['W']=fs\n",
    "    return k1\n",
    "\n",
    "def getPatientValuesByNclass(project,locDir,p,nclass,nrealizations,sigma2,na):\n",
    "    k1={}\n",
    "    for i in numpy.arange(nrealizations):\n",
    "        w=getWeights(project,locDir,p,nclass,i,sigma2,na)\n",
    "        fitPar=getFitParIVF(locDir,p,nclass,i)\n",
    "        qk1=calculateK1(w,fitPar)\n",
    "        for region in w:\n",
    "            for type in qk1[region]:\n",
    "                try:\n",
    "                    k1[region][type].append(qk1[region][type])\n",
    "                except KeyError:\n",
    "                    k1={region:{type:[] for type in qk1[region]} for region in w}\n",
    "                    print(type)\n",
    "                    k1[region][type].append(qk1[region][type])\n",
    "        print('[{}] {}/{}'.format(nclass,i+1,nrealizations))\n",
    "    return k1   \n",
    "\n",
    "def getSummaryPatientValuesByNclass(project,locDir,p,nclass,nrealizations,sigma2,na):\n",
    "    k1=getPatientValuesByNclass(project,locDir,p,nclass,nrealizations,sigma2,na)\n",
    "    avgType=['M','W']\n",
    "    summaryK1={type:{region:{\n",
    "        'mean':numpy.mean(k1[region][type]), \n",
    "        'std':numpy.std(k1[region][type]), \n",
    "        'median':numpy.median(k1[region][type])} for region in k1}\n",
    "               for type in avgType}\n",
    "    \n",
    "    return summaryK1\n",
    "\n",
    "def fullSummary(project,locDir,patientList,classes,nr,sigma2,na):\n",
    "    return \\\n",
    "        {p:{c:getSummaryPatientValuesByNclass(project,locDir,p,c,nr,sigma2,na) for c in classes} for p in patientList}\n",
    "          \n",
    "def storeSummary(db,project,locDir,k1,sigma2,na):\n",
    "    dsM=db.selectRows(project,'study','Imaging',[])\n",
    "    for p in k1:\n",
    "        idFilter={'variable':'aliasID','value':p,'oper':'eq'}\n",
    "        for c in k1[p]:\n",
    "            cFilter={'variable':'nclass','value':str(c),'oper':'eq'}\n",
    "            for t in k1[p][c]:\n",
    "                tFilter={'variable':'option','value':t,'oper':'eq'}\n",
    "                for r in k1[p][c][t]:\n",
    "                    rFilter={'variable':'regionId','value':str(r),'oper':'eq'}\n",
    "                    ds=db.selectRows(project,'study','Summary',[idFilter,cFilter,tFilter,rFilter])\n",
    "                    if len(ds['rows'])>0:\n",
    "                        qrow=ds['rows'][0]\n",
    "                        mode='update'\n",
    "                    else:\n",
    "                        frow=[r for r in dsM['rows'] if r['aliasID']==p]\n",
    "                        qrow={'aliasID':p,'nclass':c,'option':t,'regionId':r}\n",
    "                        qrow['SequenceNum']=frow[0]['SequenceNum']+c+0.001*r\n",
    "                        if t=='M':\n",
    "                            qrow['SequenceNum']+=0.0001\n",
    "                        qrow['PatientId']=frow[0]['PatientId']\n",
    "                        mode='insert'\n",
    "                    for v in k1[p][c][t][r]:\n",
    "                        qrow[v]=k1[p][c][t][r][v]\n",
    "                    qrow['sigma2']=sigma2\n",
    "                    qrow['na']=na\n",
    "                    db.modifyRows(mode,project,'study','Summary',[qrow])\n",
    "    \n",
    "def summaryPixelIVF(project,locDir,patientList,sigma2List,na):\n",
    "     return \\\n",
    "        {p:{sigma2:getPixelIVF(project,locDir,p,sigma2,na) for sigma2 in sigma2List} for p in patientList}\n",
    "    \n",
    "def storeIVF(db,project,locDir,k1):\n",
    "    dsM=db.selectRows(project,'study','Imaging',[])\n",
    "    for p in k1:\n",
    "        idFilter={'variable':'aliasID','value':p,'oper':'eq'}\n",
    "        for s2 in k1[p]:\n",
    "            sigmaFilter={'variable':'sigma2','value':str(s2),'oper':'eq'}\n",
    "            for r in k1[p][s2]:\n",
    "                rFilter={'variable':'regionId','value':str(r),'oper':'eq'}\n",
    "                typeFilter={'variable':'option','value':'D','oper':'eq'}\n",
    "                ds=db.selectRows(project,'study','Summary',[idFilter,sigmaFilter,rFilter,typeFilter])\n",
    "                if len(ds['rows'])>0:\n",
    "                    qrow=ds['rows'][0]\n",
    "                    mode='update'\n",
    "                else:\n",
    "                    frow=[r for r in dsM['rows'] if r['aliasID']==p]\n",
    "                    qrow={'aliasID':p,'sigma2':s2,'regionId':r}\n",
    "                    qrow['SequenceNum']=40+frow[0]['SequenceNum']+0.01*r+0.001*s2\n",
    "                    qrow['PatientId']=frow[0]['PatientId']\n",
    "                    mode='insert'\n",
    "                qrow['mean']=k1[p][s2][r]\n",
    "                qrow['na']=7\n",
    "                qrow['nclass']=16\n",
    "                qrow['option']='D'\n",
    "                db.modifyRows(mode,project,'study','Summary',[qrow])\n",
    "\n",
    "def getPixelIVF(project,locDir,p,sigma2,na):\n",
    "    fitPar=getFitParPixelIVF(locDir,p,16,sigma2)\n",
    "    idFilter={'variable':'aliasID','value':p,'oper':'eq'}\n",
    "    ds=db.selectRows(project,'study','Segmentation',[idFilter])\n",
    "    k1={r['regionId']:getK1(fitPar,r['regionId']) for r in ds['rows']}\n",
    "    return k1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/usr/lib/python3/dist-packages/urllib3/connection.py:391: SubjectAltNameWarning: Certificate for merlin.fmf.uni-lj.si has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/urllib3/urllib3/issues/497 for details.)\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "User: andrej studen CSRF: 17bf53278b0f13614ae3309e7a463854\n",
      "User: andrej studen CSRF: 22dadb1b4e7221b0cd979807da1a4ff6\n",
      "User: andrej studen CSRF: ed3eaa75c54c2bb3e12303e26583f5f9\n",
      "User: andrej studen CSRF: 337ed20101cf285e5605322bffa1cd51\n",
      "User: andrej studen CSRF: b68eebb23ff3af45c586408f32b87f11\n",
      "User: andrej studen CSRF: 5cc0625f0d6bf440db0d9e60f594b122\n",
      "User: andrej studen CSRF: 5c9ffbae68481bf084b48442e79d7357\n",
      "User: andrej studen CSRF: 7d836429dd698e5bc6945e8da366bc9e\n",
      "User: andrej studen CSRF: ed0e0184dcd4f1d2626d9665a3e086af\n",
      "User: andrej studen CSRF: 428867e145f20fa5e6ca692039ecd408\n",
      "User: andrej studen CSRF: 0f400d925f4aef0f298fb6d248438249\n",
      "User: andrej studen CSRF: b654238e335a6e7b1df02b64920073af\n",
      "User: andrej studen CSRF: 41b03d1eb4b3a5dd238423c0f587e180\n",
      "User: andrej studen CSRF: 27df1b508fe8f1a70ea828f2e862280d\n",
      "User: andrej studen CSRF: 4a9076cc3738d683e2cf2fbd8f8c5b4c\n",
      "User: andrej studen CSRF: b37d1917cdba01cb75965339b619a5d8\n",
      "User: andrej studen CSRF: 7fbbc8ab36147ce63b3c385c573eebb4\n",
      "User: andrej studen CSRF: 8a43405a6a9d757ffad2eddd74fecb7d\n",
      "User: andrej studen CSRF: f0e67fa4cbfe0366bb1ee3e7e55a7cc8\n",
      "User: andrej studen CSRF: f7bf58531d14fc4b2ea295e055e6d6ec\n",
      "User: andrej studen CSRF: 431c59916a4326791b25e5658c080e58\n",
      "User: andrej studen CSRF: 2dd3f65092e6ed51a666fa77dd86ce66\n",
      "User: andrej studen CSRF: 8551d4e2ef147f4233e079df8240adc5\n",
      "User: andrej studen CSRF: 7764f105ee11b55128db1829ecedf5b5\n",
      "User: andrej studen CSRF: c3c9e09d533377fd086311c3f061ef29\n",
      "User: andrej studen CSRF: 34dcfb71364e0e870d97d6e4c472be39\n",
      "User: andrej studen CSRF: 3c1c462943d30fba4b5783cfb9a26778\n",
      "User: andrej studen CSRF: 23ac71554f80d4f2335d084eaaf1ae0a\n",
      "User: andrej studen CSRF: 744c5ac610207f99a406246ffda4626f\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/usr/lib/python3/dist-packages/urllib3/connection.py:391: SubjectAltNameWarning: Certificate for merlin.fmf.uni-lj.si has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/urllib3/urllib3/issues/497 for details.)\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "User: andrej studen CSRF: 313af0c78a7edb78a1561d50b28869dc\n",
      "User: andrej studen CSRF: f8d24a674a73f5ddc2701cc376906cdd\n",
      "User: andrej studen CSRF: c9b2de745f7bc2df266cb42479c9a32f\n",
      "User: andrej studen CSRF: 79771f7b36c56ad9f07fecf6775bdc73\n",
      "User: andrej studen CSRF: 49540e450f9283e42cba4e80b7b81736\n",
      "User: andrej studen CSRF: 5f168ba1e595bfde5da70f286b1f8174\n",
      "User: andrej studen CSRF: a01455e01e725ca1fa75db01076f257c\n",
      "User: andrej studen CSRF: 36486ce410c13a61a6411eed9cdd60ca\n",
      "User: andrej studen CSRF: 475543826e85b7e18206a896148b5f30\n",
      "User: andrej studen CSRF: efb9b093bcb413ba615a3c8747c1cb70\n",
      "User: andrej studen CSRF: 7fd7fe9d68df3b9e7a0c9a7fa837f3dc\n",
      "User: andrej studen CSRF: c91de4dd61b48da10546bbbb12ed8d9d\n",
      "User: andrej studen CSRF: 97b1d3e43cbc495c651b08c7152aed8e\n",
      "User: andrej studen CSRF: aad95faeae40acf7cbf689a5c8bd9cc6\n",
      "User: andrej studen CSRF: c537fa8373d7d6212992e39c8bf68d5f\n",
      "User: andrej studen CSRF: f597b1d54fc6f956396db35b58fabdf1\n",
      "User: andrej studen CSRF: 6d404bd8d9ea8666ed7422ad783c8a02\n",
      "User: andrej studen CSRF: 5e654b4a60bc289455a002e3bf9178ba\n",
      "User: andrej studen CSRF: e369fa0fb464b4286a7ca18a84f33811\n",
      "User: andrej studen CSRF: 1d58eccc72e8853a42a7efa5128ef2b7\n",
      "User: andrej studen CSRF: 2982e33513c70d6233227304ff05d52c\n",
      "User: andrej studen CSRF: 9c81db02cbb27f723780de149e0749eb\n",
      "User: andrej studen CSRF: 14562ee2f3ef2d1036792e62031e567e\n",
      "User: andrej studen CSRF: bc19e7012b298bf80e57ef16a4e36aa4\n",
      "User: andrej studen CSRF: 69942ab5d7a0f1231c5d901e5d482b1b\n",
      "User: andrej studen CSRF: 757c8d62978013c72e7c25eaa7ded01a\n",
      "User: andrej studen CSRF: a2d64c0ae62fab8f32a3f72fbce618c8\n",
      "User: andrej studen CSRF: 284783f9ac4a2b089bf6f7298ef7ba61\n",
      "User: andrej studen CSRF: 539a62b02dfbb0f112cdd215a972be4d\n",
      "User: andrej studen CSRF: 6e985ffd4db5c13b4e7f866f3fa7e968\n",
      "User: andrej studen CSRF: 8e96412c76ac47ea2ed5e6ca63714cc9\n",
      "User: andrej studen CSRF: c36c692f9cb0a603b67083b3ce61ec48\n",
      "User: andrej studen CSRF: 111e23a9a32e6bfedc57738cbc87c3f1\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/usr/lib/python3/dist-packages/urllib3/connection.py:391: SubjectAltNameWarning: Certificate for merlin.fmf.uni-lj.si has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/urllib3/urllib3/issues/497 for details.)\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "User: andrej studen CSRF: 9f24cbb291c47c56b7741c71a02e488e\n",
      "User: andrej studen CSRF: c232789d429a02bff4c0a617a4c26858\n",
      "User: andrej studen CSRF: 5734f5ba9bfec89a1aeb114376a9fef5\n",
      "User: andrej studen CSRF: 3792528a7bb76aaff6092118553ba627\n",
      "User: andrej studen CSRF: 362bba4356ea1d49aa6b5cb6ad6af396\n",
      "User: andrej studen CSRF: 259bbd00ae278a08c1caa25f025b8219\n",
      "User: andrej studen CSRF: 0e51127ea215c4895061af0b7ad1033c\n",
      "User: andrej studen CSRF: 0c46a7a3362083c99e1132b0c55dbe8d\n",
      "User: andrej studen CSRF: 5df538089223bfd21deebd7440896d6c\n",
      "User: andrej studen CSRF: 81febb24856699adda51c4de2eaa0008\n",
      "User: andrej studen CSRF: 7c80dd351743726250e6ef04265f45b5\n",
      "User: andrej studen CSRF: 0119088c789400bac86a6443b19c8224\n",
      "User: andrej studen CSRF: 8c4f84b713677dceaa929a9a50e38f36\n",
      "User: andrej studen CSRF: e57699ab9b1f4271a22f4302f7a5f2e7\n",
      "User: andrej studen CSRF: 0615fc88ded5d2cd7bcd823d27f793f9\n",
      "User: andrej studen CSRF: 83392aee168ce6409133c6b9f0bc1272\n",
      "User: andrej studen CSRF: 85dc7ff8be681968c48a385a01ef55cd\n",
      "User: andrej studen CSRF: ac199b4f5b6469976484a0ef1d3dfb2d\n",
      "User: andrej studen CSRF: 7d641a93ea738408c4c98a47e042eeb5\n",
      "User: andrej studen CSRF: f98213b0e172376d06fa8666cc01f836\n",
      "User: andrej studen CSRF: c657389564fed0b694336b89d39c0420\n",
      "User: andrej studen CSRF: 2093d35a0e8d12d4b823bcbe3d88c029\n",
      "User: andrej studen CSRF: 280154139aafb3b3b634ee95b8e9ab57\n",
      "User: andrej studen CSRF: 5b6b11b4a51f28a616b24185a3dcff42\n",
      "User: andrej studen CSRF: 1421c672da3f24ef0fcc88856bd6ee8f\n",
      "User: andrej studen CSRF: 14c225d796c6043b3e5895efdffdb21b\n",
      "User: andrej studen CSRF: f6c7073ea9c5ac49f73bccabf1e5ce32\n",
      "User: andrej studen CSRF: 00d051a4ca90b7d5b2b6fbb98a64d1e5\n",
      "User: andrej studen CSRF: 9de2c0c544a0a1e5e25d102a7f490af7\n",
      "User: andrej studen CSRF: db3f905d4d2a91387b4a4dd5fdec2aba\n",
      "User: andrej studen CSRF: 650be1f5cddf9d6ef804f847ee666d4d\n",
      "User: andrej studen CSRF: efca2dd889ff0ab6b4ae640acdddf6fa\n",
      "User: andrej studen CSRF: 82ae1e1be2e5912efe2a1b49238a206c\n",
      "User: andrej studen CSRF: d72754e75d53233d77a795f58d698de0\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/usr/lib/python3/dist-packages/urllib3/connection.py:391: SubjectAltNameWarning: Certificate for merlin.fmf.uni-lj.si has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/urllib3/urllib3/issues/497 for details.)\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "User: andrej studen CSRF: 3d28c21f556e86469e0f16a0217510b1\n",
      "User: andrej studen CSRF: 6137d519a0e993374ffbce0425620463\n",
      "User: andrej studen CSRF: 1235590fbdbaadf5b1b7b60a1068bfc3\n",
      "User: andrej studen CSRF: a84902612a2d3d9d8b0df39e434457cd\n",
      "User: andrej studen CSRF: 3ce63a50b6694a433a0b2a5b37040bdc\n",
      "User: andrej studen CSRF: f2ecb64a6a71dffbce6c86129a0e16d9\n",
      "User: andrej studen CSRF: a234a0244921696e95e5d3abd903aa6a\n",
      "User: andrej studen CSRF: 53ca9d39b6d9eb5d01f565d47589bcec\n",
      "User: andrej studen CSRF: 73bf19c27641f36b49ceb7e2c05ea919\n",
      "User: andrej studen CSRF: 8444b01dc71e5eef82f807996a3ca447\n",
      "User: andrej studen CSRF: cf13ad9355ed3bebc4b051df4b08905d\n",
      "User: andrej studen CSRF: e63bdc9c44171b801e38ebe6f7236a15\n",
      "User: andrej studen CSRF: cba8b713e62972ad319aa08d01ddc874\n",
      "User: andrej studen CSRF: fdbac798d6125ad8e6c695c86f0534a4\n",
      "User: andrej studen CSRF: 1fb494721ca95cac04d71c069ade686d\n",
      "User: andrej studen CSRF: 1a48a9ab1bd3a4d076b87b51009d94ec\n",
      "User: andrej studen CSRF: c38e10cf05221b37a24b950e494a679f\n",
      "User: andrej studen CSRF: cdc55ec4c47c0e2d38c45df16f7e14c5\n",
      "User: andrej studen CSRF: 6c0231c4b9010a387833b2e227282cfc\n",
      "User: andrej studen CSRF: 4497b29f1cefafa8bb9dfc36d792f725\n",
      "User: andrej studen CSRF: 1077496e8cc5932647eaf1645bc4bcd1\n",
      "User: andrej studen CSRF: b89f400bb3ba02fd81f529120aeacccf\n",
      "User: andrej studen CSRF: 012811adf1c147f0b7a45d71bdf3b4e3\n",
      "User: andrej studen CSRF: 64f045d8063aa4c01895d45a6b8d456f\n",
      "User: andrej studen CSRF: 60799164e447796e0a5cd7cfab3ef262\n",
      "User: andrej studen CSRF: b8bb560ed73640520bc0ee0e1bd56a96\n",
      "User: andrej studen CSRF: e5f13c276bf403a0b4c0d00242f4c245\n",
      "User: andrej studen CSRF: aaffced5592ba12c61bb39ada0370f97\n",
      "User: andrej studen CSRF: f14daed93cdda355636efc83f91bc4bd\n",
      "User: andrej studen CSRF: 2b8f86d836619f0e092e49361c497856\n",
      "User: andrej studen CSRF: 97d444338e73180829b1ba13be8f7820\n",
      "User: andrej studen CSRF: b45fbd7a5ae4ecce144421e12c7493ce\n",
      "User: andrej studen CSRF: 992f7cc5562f27306594fd958b4d3268\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/usr/lib/python3/dist-packages/urllib3/connection.py:391: SubjectAltNameWarning: Certificate for merlin.fmf.uni-lj.si has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/urllib3/urllib3/issues/497 for details.)\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "User: andrej studen CSRF: 5c94b435c42f153616571977d5c04f25\n",
      "User: andrej studen CSRF: 1cad8c6726e0979f2cf3f9bfc0887b84\n",
      "User: andrej studen CSRF: 2961f086cc1c13615d7b4785b9ed5215\n",
      "User: andrej studen CSRF: 9d4e755752646e5345e61baf76e332a2\n",
      "User: andrej studen CSRF: 35ad6c5dabdef8814e3cb24c5fb511ff\n",
      "User: andrej studen CSRF: 65d4c33a4f160f1794cb5d786dd41d2c\n",
      "User: andrej studen CSRF: 3dc89aa8b101d3b1a7115ec26a874583\n",
      "User: andrej studen CSRF: 9481984467988d904814ff07564eaf57\n",
      "User: andrej studen CSRF: 5b93bd1908ce71a734d48d62bb290735\n",
      "User: andrej studen CSRF: 3780077872601ace090401de29b6211c\n",
      "User: andrej studen CSRF: 1b3b1a868a63d6c5186b3c4574613e70\n",
      "User: andrej studen CSRF: 598944823a8a8547c4efc3c3c4eea725\n",
      "User: andrej studen CSRF: f211acca71ba88b2bc06f51e01385ae2\n",
      "User: andrej studen CSRF: 670ba304d796ab5cfef06e20c5b9ac96\n",
      "User: andrej studen CSRF: 30bfd69d9faa8f52d0ffa3d2980062d3\n",
      "User: andrej studen CSRF: 3d1436dd74bb2722d30ba4f1b00ea866\n",
      "User: andrej studen CSRF: a8ab139ed43ac2c1f08ad75d9b611c31\n",
      "User: andrej studen CSRF: ca487b1983e1af95ba21015c095ac76a\n",
      "User: andrej studen CSRF: e340dc16fd94c9bbdb7120f40781cb9d\n",
      "User: andrej studen CSRF: cc3ec2b38bc6de96939402bf8f4cfb0f\n",
      "User: andrej studen CSRF: 47e2a13f0dffcd5660f5d503b444c4fc\n",
      "User: andrej studen CSRF: b61e170856634306c33249818ef56497\n",
      "User: andrej studen CSRF: 39f89e811018698c4f9f7d63febf61cd\n",
      "User: andrej studen CSRF: a4b02789ce9a1726224ed97740c37944\n",
      "User: andrej studen CSRF: 126ec86a9e5cfe4946ab7e48eb2abff6\n",
      "User: andrej studen CSRF: 539ab75da7ff122af12d9aa0d39c75fe\n",
      "User: andrej studen CSRF: 4300f33dc41bf4f849a80ae7c996cc3a\n",
      "User: andrej studen CSRF: d497e04a6079e10b5d74fd0e2112b657\n",
      "User: andrej studen CSRF: 5192bea7856131302ad4cf2666737223\n",
      "User: andrej studen CSRF: 9e632649bda175f287124046168a2e0d\n",
      "User: andrej studen CSRF: cdacc232d34f2c3ac108d0e7776a5e55\n",
      "User: andrej studen CSRF: 94d7fc9b06ea4de6f0158edfa8c5b982\n",
      "User: andrej studen CSRF: 79351835f2fe2ad99307201371e0f9e6\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/usr/lib/python3/dist-packages/urllib3/connection.py:391: SubjectAltNameWarning: Certificate for merlin.fmf.uni-lj.si has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/urllib3/urllib3/issues/497 for details.)\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "User: andrej studen CSRF: 2fa666697908fdc063c6fe764e2c4c3e\n",
      "User: andrej studen CSRF: 468d7ac0799d872dea0cff4e5bc72c2d\n",
      "User: andrej studen CSRF: 7b01cca5c97a00f4d513669d06ed4937\n",
      "User: andrej studen CSRF: 5edf9222fc17a03b1bdfe2a77b4a9513\n",
      "User: andrej studen CSRF: 1c4f28b912da6a0d1401bd6c47986a42\n",
      "User: andrej studen CSRF: 490bdf1edf9f916538024986ff68982f\n",
      "User: andrej studen CSRF: 3f08b9e414d2334d15122157a2a06edb\n",
      "User: andrej studen CSRF: 245cd211aa6161b1e9d5ee6bd564e7f2\n",
      "User: andrej studen CSRF: 88a6f2412b48859a5c4c65f0d405b4f0\n",
      "User: andrej studen CSRF: 878ef0c26a71c3a02d5609395880501b\n",
      "User: andrej studen CSRF: cb46b4c8014b55e112559791b22696b8\n",
      "User: andrej studen CSRF: 907a5eaec3739e15d292915ec0423b1c\n",
      "User: andrej studen CSRF: a5cf3f93dc9b944f70ec7a7ca87d78f9\n",
      "User: andrej studen CSRF: 1b0166366696fb72fb1e911fb0cf2c25\n",
      "User: andrej studen CSRF: 3ccff50b4979bda949dfff4f53a7a708\n",
      "User: andrej studen CSRF: c25e00daf08b5c6019d2227a216e8dc1\n",
      "User: andrej studen CSRF: f11a39cac798ad686e479ef5d5131df3\n",
      "User: andrej studen CSRF: 7a9734fd95031ec04f12a796372a507a\n",
      "User: andrej studen CSRF: ac853942d51bab33ca1d514f0cbcdfa6\n",
      "User: andrej studen CSRF: 28e816b593e280402052c5b2b2a7efb6\n",
      "User: andrej studen CSRF: 15cae34beb97379c8b6547ed4cbd6af3\n",
      "User: andrej studen CSRF: bd3fd702e6d0523d4a368a0d7fae2f30\n",
      "User: andrej studen CSRF: 6660cb2f84bb8f3750ec5ec05d3162e5\n",
      "User: andrej studen CSRF: a5df32f6e3971bc670bdaa399f475988\n",
      "User: andrej studen CSRF: 333c7237fbe437bda97ac879b0910ddb\n",
      "User: andrej studen CSRF: 0fa34ae60f37f609204dc4a69fc3989f\n",
      "User: andrej studen CSRF: 0bc15c1728a458659024553ab0b41865\n",
      "User: andrej studen CSRF: f4044c498adbb046748be02e202452cf\n",
      "User: andrej studen CSRF: 9bfc37782ee8fc36c2f731f902d31f64\n",
      "User: andrej studen CSRF: db807ee35692973297b8dea4785aade6\n"
     ]
    }
   ],
   "source": [
    "pat=[p for p in patients if p.find('8')!=0]\n",
    "k1=summaryPixelIVF(project,locDir,pat,[0.1],7)\n",
    "storeIVF(db,project,locDir,k1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "M\n",
      "[10] 1/20\n",
      "[10] 2/20\n",
      "[10] 3/20\n",
      "[10] 4/20\n",
      "[10] 5/20\n",
      "[10] 6/20\n",
      "[10] 7/20\n",
      "[10] 8/20\n",
      "[10] 9/20\n",
      "[10] 10/20\n",
      "[10] 11/20\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/usr/lib/python3/dist-packages/urllib3/connection.py:391: SubjectAltNameWarning: Certificate for merlin.fmf.uni-lj.si has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/urllib3/urllib3/issues/497 for details.)\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[10] 12/20\n",
      "[10] 13/20\n",
      "[10] 14/20\n",
      "[10] 15/20\n",
      "[10] 16/20\n",
      "[10] 17/20\n",
      "[10] 18/20\n",
      "[10] 19/20\n",
      "[10] 20/20\n",
      "M\n",
      "[10] 1/20\n",
      "[10] 2/20\n",
      "[10] 3/20\n",
      "[10] 4/20\n",
      "[10] 5/20\n",
      "[10] 6/20\n",
      "[10] 7/20\n",
      "[10] 8/20\n",
      "[10] 9/20\n",
      "[10] 10/20\n",
      "[10] 11/20\n",
      "[10] 12/20\n",
      "[10] 13/20\n",
      "[10] 14/20\n",
      "[10] 15/20\n",
      "[10] 16/20\n",
      "[10] 17/20\n",
      "[10] 18/20\n",
      "[10] 19/20\n",
      "[10] 20/20\n",
      "M\n",
      "[10] 1/20\n",
      "[10] 2/20\n",
      "[10] 3/20\n",
      "[10] 4/20\n",
      "[10] 5/20\n",
      "[10] 6/20\n",
      "[10] 7/20\n",
      "[10] 8/20\n",
      "[10] 9/20\n",
      "[10] 10/20\n",
      "[10] 11/20\n",
      "[10] 12/20\n",
      "[10] 13/20\n",
      "[10] 14/20\n",
      "[10] 15/20\n",
      "[10] 16/20\n",
      "[10] 17/20\n",
      "[10] 18/20\n",
      "[10] 19/20\n",
      "[10] 20/20\n",
      "M\n",
      "[10] 1/20\n",
      "[10] 2/20\n",
      "[10] 3/20\n",
      "[10] 4/20\n",
      "[10] 5/20\n",
      "[10] 6/20\n",
      "[10] 7/20\n",
      "[10] 8/20\n",
      "[10] 9/20\n",
      "[10] 10/20\n",
      "[10] 11/20\n",
      "[10] 12/20\n",
      "[10] 13/20\n",
      "[10] 14/20\n",
      "[10] 15/20\n",
      "[10] 16/20\n",
      "[10] 17/20\n",
      "[10] 18/20\n",
      "[10] 19/20\n",
      "[10] 20/20\n",
      "M\n",
      "[10] 1/20\n",
      "[10] 2/20\n",
      "[10] 3/20\n",
      "[10] 4/20\n",
      "[10] 5/20\n",
      "[10] 6/20\n",
      "[10] 7/20\n",
      "[10] 8/20\n",
      "[10] 9/20\n",
      "[10] 10/20\n",
      "[10] 11/20\n",
      "[10] 12/20\n",
      "[10] 13/20\n",
      "[10] 14/20\n",
      "[10] 15/20\n",
      "[10] 16/20\n",
      "[10] 17/20\n",
      "[10] 18/20\n",
      "[10] 19/20\n",
      "[10] 20/20\n",
      "M\n",
      "[10] 1/20\n",
      "[10] 2/20\n",
      "[10] 3/20\n",
      "[10] 4/20\n",
      "[10] 5/20\n",
      "[10] 6/20\n",
      "[10] 7/20\n",
      "[10] 8/20\n",
      "[10] 9/20\n",
      "[10] 10/20\n",
      "[10] 11/20\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/usr/lib/python3/dist-packages/urllib3/connection.py:391: SubjectAltNameWarning: Certificate for merlin.fmf.uni-lj.si has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/urllib3/urllib3/issues/497 for details.)\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[10] 12/20\n",
      "[10] 13/20\n",
      "[10] 14/20\n",
      "[10] 15/20\n",
      "[10] 16/20\n",
      "[10] 17/20\n",
      "[10] 18/20\n",
      "[10] 19/20\n",
      "[10] 20/20\n",
      "M\n",
      "[10] 1/20\n",
      "[10] 2/20\n",
      "[10] 3/20\n",
      "[10] 4/20\n",
      "[10] 5/20\n",
      "[10] 6/20\n",
      "[10] 7/20\n",
      "[10] 8/20\n",
      "[10] 9/20\n",
      "[10] 10/20\n",
      "[10] 11/20\n",
      "[10] 12/20\n",
      "[10] 13/20\n",
      "[10] 14/20\n",
      "[10] 15/20\n",
      "[10] 16/20\n",
      "[10] 17/20\n",
      "[10] 18/20\n",
      "[10] 19/20\n",
      "[10] 20/20\n",
      "M\n",
      "[10] 1/20\n",
      "[10] 2/20\n",
      "[10] 3/20\n",
      "[10] 4/20\n",
      "[10] 5/20\n",
      "[10] 6/20\n",
      "[10] 7/20\n",
      "[10] 8/20\n",
      "[10] 9/20\n",
      "[10] 10/20\n",
      "[10] 11/20\n",
      "[10] 12/20\n",
      "[10] 13/20\n",
      "[10] 14/20\n",
      "[10] 15/20\n",
      "[10] 16/20\n",
      "[10] 17/20\n",
      "[10] 18/20\n",
      "[10] 19/20\n",
      "[10] 20/20\n",
      "M\n",
      "[10] 1/20\n",
      "[10] 2/20\n",
      "[10] 3/20\n",
      "[10] 4/20\n",
      "[10] 5/20\n",
      "[10] 6/20\n",
      "[10] 7/20\n",
      "[10] 8/20\n",
      "[10] 9/20\n",
      "[10] 10/20\n",
      "[10] 11/20\n",
      "[10] 12/20\n",
      "[10] 13/20\n",
      "[10] 14/20\n",
      "[10] 15/20\n",
      "[10] 16/20\n",
      "[10] 17/20\n",
      "[10] 18/20\n",
      "[10] 19/20\n",
      "[10] 20/20\n",
      "M\n",
      "[10] 1/20\n",
      "[10] 2/20\n",
      "[10] 3/20\n",
      "[10] 4/20\n",
      "[10] 5/20\n",
      "[10] 6/20\n",
      "[10] 7/20\n",
      "[10] 8/20\n",
      "[10] 9/20\n",
      "[10] 10/20\n",
      "[10] 11/20\n",
      "[10] 12/20\n",
      "[10] 13/20\n",
      "[10] 14/20\n",
      "[10] 15/20\n",
      "[10] 16/20\n",
      "[10] 17/20\n",
      "[10] 18/20\n",
      "[10] 19/20\n",
      "[10] 20/20\n",
      "M\n",
      "[10] 1/20\n",
      "[10] 2/20\n",
      "[10] 3/20\n",
      "[10] 4/20\n",
      "[10] 5/20\n",
      "[10] 6/20\n",
      "[10] 7/20\n",
      "[10] 8/20\n",
      "[10] 9/20\n",
      "[10] 10/20\n",
      "[10] 11/20\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/usr/lib/python3/dist-packages/urllib3/connection.py:391: SubjectAltNameWarning: Certificate for merlin.fmf.uni-lj.si has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/urllib3/urllib3/issues/497 for details.)\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[10] 12/20\n",
      "[10] 13/20\n",
      "[10] 14/20\n",
      "[10] 15/20\n",
      "[10] 16/20\n",
      "[10] 17/20\n",
      "[10] 18/20\n",
      "[10] 19/20\n",
      "[10] 20/20\n",
      "M\n",
      "[10] 1/20\n",
      "[10] 2/20\n",
      "[10] 3/20\n",
      "[10] 4/20\n",
      "[10] 5/20\n",
      "[10] 6/20\n",
      "[10] 7/20\n",
      "[10] 8/20\n",
      "[10] 9/20\n",
      "[10] 10/20\n",
      "[10] 11/20\n",
      "[10] 12/20\n",
      "[10] 13/20\n",
      "[10] 14/20\n",
      "[10] 15/20\n",
      "[10] 16/20\n",
      "[10] 17/20\n",
      "[10] 18/20\n",
      "[10] 19/20\n",
      "[10] 20/20\n",
      "User: andrej studen CSRF: df555041b52afb9bf30c326700ca356c\n",
      "User: andrej studen CSRF: fdcd7fbbb136ec3e82012448ff0240a4\n",
      "User: andrej studen CSRF: 47dfc17a1798f0b8d32982c1cd940ee3\n",
      "User: andrej studen CSRF: 9e41ce7fbf9783b102145634ae6107ab\n",
      "User: andrej studen CSRF: e5b5814d36a6692544ac7e6739eb9f4d\n",
      "User: andrej studen CSRF: 8ec124028215131b41f9e52467ee8988\n",
      "User: andrej studen CSRF: 169a7925868fb11bc1ef0c421ddc6189\n",
      "User: andrej studen CSRF: 0778c569f60b8cbaec95cb3e5447fed5\n",
      "User: andrej studen CSRF: ea8b49b0accff0baf382b556aac52f47\n",
      "User: andrej studen CSRF: e9f0416fd141ceeb7d37a53f42e5f2f0\n",
      "User: andrej studen CSRF: af93f8e72d3cbd7642d85caff338bff4\n",
      "User: andrej studen CSRF: 82da862db44daa5ed24ed9323a5ed542\n",
      "User: andrej studen CSRF: e296f7b9cbb2da940f5e51ea19962651\n",
      "User: andrej studen CSRF: 117a9237861a76cb146e0d9f1c8b62c9\n",
      "User: andrej studen CSRF: de73a3403c37e0a59aba9300a4c666a3\n",
      "User: andrej studen CSRF: 84f09def571a58d90ed7c15efa0eaac4\n",
      "User: andrej studen CSRF: 41e860f31d756e85dbd946442a2046bd\n",
      "User: andrej studen CSRF: 4a26ab89aa0faec36a3b102d7952e169\n",
      "User: andrej studen CSRF: 3320bc55bb7e54acf734b9735526d406\n",
      "User: andrej studen CSRF: 785f2759288c051fa21cbe93de0394a3\n",
      "User: andrej studen CSRF: 875077d3fa113e364001d0e31764e7b3\n",
      "User: andrej studen CSRF: 7642f88d4ccd6da23b43d3a432cc80b2\n",
      "User: andrej studen CSRF: 65587d6f851acf364496ab8467510528\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/usr/lib/python3/dist-packages/urllib3/connection.py:391: SubjectAltNameWarning: Certificate for merlin.fmf.uni-lj.si has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/urllib3/urllib3/issues/497 for details.)\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "User: andrej studen CSRF: 48b40284c31bb48929a82734bb65ca3d\n",
      "User: andrej studen CSRF: 2aa80cba92aa56e5c945957dd271356f\n",
      "User: andrej studen CSRF: e8b8b3ebeaca455af903b1d6f5157c3a\n",
      "User: andrej studen CSRF: 84a16a36e35d1881b925962a717fdc60\n",
      "User: andrej studen CSRF: 01e5e132324adc93a2a56b0fe5b8228c\n",
      "User: andrej studen CSRF: 02e8ed43e6f6a970c865845406dbf458\n",
      "User: andrej studen CSRF: 4f7ec37b047b824ca0a9736f308d39c9\n",
      "User: andrej studen CSRF: 8863ccc7d23994ad59f42cc6f71aeca1\n",
      "User: andrej studen CSRF: d4281b029d7bfb13ddb14106d22fa3b1\n",
      "User: andrej studen CSRF: b4f0f6fa40aec9c5b277ac3f6c458b8a\n",
      "User: andrej studen CSRF: 38e5b62e22fa15ca2bedc1a66c72d6c9\n",
      "User: andrej studen CSRF: efb9b88a7a95dcc4fd8d24f3be82782e\n",
      "User: andrej studen CSRF: 1711ec7a3204d974f9ec23120b5ea793\n",
      "User: andrej studen CSRF: f829dcc4f71f01aefeed5502494c310c\n",
      "User: andrej studen CSRF: 836270326e66a2328d0c432d1e2da707\n",
      "User: andrej studen CSRF: 9070522738a901c8d9bba08d9eaf5422\n",
      "User: andrej studen CSRF: ac79ce52be434f67319c96aae7ac9f6a\n",
      "User: andrej studen CSRF: 4fc516b0654cd4a7f26285ae9259561f\n",
      "User: andrej studen CSRF: d48b4079d2614b771760133a53c2e312\n",
      "User: andrej studen CSRF: e1dba57e3ac2b428296d2c2b2da91dae\n",
      "User: andrej studen CSRF: 4a83966a2d36c23d2fdd80333a4ec961\n",
      "User: andrej studen CSRF: 763d2331ed0be50c2e5dd1eb060077a1\n",
      "User: andrej studen CSRF: 580162adeb1b4f3feff4374c53440892\n",
      "User: andrej studen CSRF: 3f239a6cf32a569a1592103c05b52bab\n",
      "User: andrej studen CSRF: 8b794b7a81b40e5c9342d40f5a01ccb7\n",
      "User: andrej studen CSRF: fc0770b2ccffdde7ae61ccca1f461924\n",
      "User: andrej studen CSRF: 076250188acc6c0be1cd99a8670ae349\n",
      "User: andrej studen CSRF: 4ca350ebfb697d980647d604d9c6f7e1\n",
      "User: andrej studen CSRF: 5d95d809f37ddc3164dc0e49eff78920\n",
      "User: andrej studen CSRF: 7a58f19ac02bbc332488d43516a75ff0\n",
      "User: andrej studen CSRF: 604cd31caba86a2baf8b6b18875718ff\n",
      "User: andrej studen CSRF: fd13aa275f2ec32dc312c1c9038abb36\n",
      "User: andrej studen CSRF: c03a07df8eb4bab4011a620c7fab8dae\n",
      "User: andrej studen CSRF: 44fc8c2f0adaa897a7bd30da4ca57728\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/usr/lib/python3/dist-packages/urllib3/connection.py:391: SubjectAltNameWarning: Certificate for merlin.fmf.uni-lj.si has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/urllib3/urllib3/issues/497 for details.)\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "User: andrej studen CSRF: bba48859f47c283d452b88a23a796901\n",
      "User: andrej studen CSRF: 08a9a78a7a10973f6ae51a32857d01be\n",
      "User: andrej studen CSRF: 1a5766956c389b1ecf3e977fabe1f079\n",
      "User: andrej studen CSRF: 596607a285047323fe66094a3509115c\n",
      "User: andrej studen CSRF: 3b7c717facdbd4c6e9fb49b97dc9750b\n",
      "User: andrej studen CSRF: 1fcead8e2366296ce08da02d54de98d3\n",
      "User: andrej studen CSRF: 4420be65677d462659aef9d8513d7c14\n",
      "User: andrej studen CSRF: c02e895d8835548ed9fb2c3c2484d135\n",
      "User: andrej studen CSRF: 4d6a838465d45791d3af602f720c4ee8\n",
      "User: andrej studen CSRF: ec2ee60cae35b16636557f4cf1cb3ef8\n",
      "User: andrej studen CSRF: 8a8b8b4d8e47a665b516ead41ec2beab\n",
      "User: andrej studen CSRF: 2475821dba981d8e5f32d8fe0e3360de\n",
      "User: andrej studen CSRF: 52ca6ae0fc698720f4d969612c41f236\n",
      "User: andrej studen CSRF: e41aa596f56941e2ba6eb50025810471\n",
      "User: andrej studen CSRF: d733c466dcf2ab0e46c78d1e42f52cec\n",
      "User: andrej studen CSRF: 5856c287594860c4d0234498df298f61\n",
      "User: andrej studen CSRF: 47f870462f8c0cc8ac6981aea2fc4aaf\n",
      "User: andrej studen CSRF: b2418735dcf59d8ae262c075a2075ca0\n",
      "User: andrej studen CSRF: fbbf15ef1f839020d5a5b647b2a8fcc1\n",
      "User: andrej studen CSRF: 17929da1ae17e458a53e9efc385f7960\n",
      "User: andrej studen CSRF: c569091952a982a5a92b72e06dac2388\n",
      "User: andrej studen CSRF: 5f4d644373c6821f6d29d08aa6558756\n",
      "User: andrej studen CSRF: 6106928a08463e8b7367ebf35d0ce09d\n",
      "User: andrej studen CSRF: f97911dfeb3335d28b8cf4c78816d249\n",
      "User: andrej studen CSRF: f1e66a33e0779cf8d6ee60a1ec212e5b\n",
      "User: andrej studen CSRF: a791023c8bca2345e97845e08e597ca1\n",
      "User: andrej studen CSRF: 61e52198215a63b442009615669da57e\n",
      "User: andrej studen CSRF: 2d93ec94ad415fde42f5e2ddb2376fc2\n",
      "User: andrej studen CSRF: d6c7eb87404b63ccd1fe443f56df5851\n",
      "User: andrej studen CSRF: 917c0111d0ad408d4e8d0e603a184282\n",
      "User: andrej studen CSRF: 911911f46fc1829c6b0350e710183d77\n",
      "User: andrej studen CSRF: 92f5294a13ea2aa7e76d8cb109c56054\n",
      "User: andrej studen CSRF: 9e8a0adbe71adf3db28a49c15dddba56\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/usr/lib/python3/dist-packages/urllib3/connection.py:391: SubjectAltNameWarning: Certificate for merlin.fmf.uni-lj.si has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/urllib3/urllib3/issues/497 for details.)\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "User: andrej studen CSRF: 426c7f7482c28cf51f8043ad5a8a8783\n",
      "User: andrej studen CSRF: 50fd944f5bfe7df7fd257ea783e228fd\n",
      "User: andrej studen CSRF: e3b1667cfebf1278150c45bef601627b\n",
      "User: andrej studen CSRF: e9b75e89948d83c7e9a110eda25e324b\n",
      "User: andrej studen CSRF: bdcf3d7918ad792c3c26833a62a79845\n",
      "User: andrej studen CSRF: 37ef68a78f746d362ebd8eb8e3aa5022\n",
      "User: andrej studen CSRF: 9cc5de0dfa305d1a84a9372b82879943\n",
      "User: andrej studen CSRF: f8fb10e4e38b32446811571b06493113\n",
      "User: andrej studen CSRF: 085a38a1609f0377e2ff3c8f0136080e\n",
      "User: andrej studen CSRF: 66fb53627950073a6de46ea0db124e2e\n",
      "User: andrej studen CSRF: f36c77b1d97b94d88159ba2973956c9b\n",
      "User: andrej studen CSRF: a02359eda9705cbc52028b79f5eeea28\n",
      "User: andrej studen CSRF: ce4bb4df74a6fd27f61ed0dbc04fa0d2\n",
      "User: andrej studen CSRF: 3e864058d251e716a53893ae70f07701\n",
      "User: andrej studen CSRF: 9fd6ec63749284b4acc8837d19bd8cc6\n",
      "User: andrej studen CSRF: 5b3c5bd905c43be2ecb830ef9fd9b83b\n",
      "User: andrej studen CSRF: b5b61592eef1f2437cd36f6f8fdf0db6\n",
      "User: andrej studen CSRF: d23779013c191580902ac111168345bd\n",
      "User: andrej studen CSRF: c6e74e62a6cf3d531f991964ec01ff35\n",
      "User: andrej studen CSRF: aba43d5fa2148b69ee9c8652f4844f7b\n",
      "User: andrej studen CSRF: 006829317ca7897a65ec9f89285fb4f2\n",
      "User: andrej studen CSRF: 7e29be1b1ead3a426f5774bfaea4f7d3\n",
      "User: andrej studen CSRF: 9c1b1b37de1db73337867bb6c8e1d4f6\n",
      "User: andrej studen CSRF: 919250b5df2dba6a538c1808a1ea89ec\n",
      "User: andrej studen CSRF: 04fe1e8ee3aefe5d7d7f77ba3a683852\n",
      "User: andrej studen CSRF: 87e2d680d9a3eb2b13fb452c625054d1\n",
      "User: andrej studen CSRF: 1bb6d9c99e96d40aa53519d86c432644\n",
      "User: andrej studen CSRF: 59212f8916484e2aeeb83532b2006ed4\n",
      "User: andrej studen CSRF: 10c002c78af933970527d38390412613\n",
      "User: andrej studen CSRF: f4d3474551b029bf954acd597aa69106\n",
      "User: andrej studen CSRF: f1a27f8fb6a628018fb5fda4c8fd8700\n",
      "User: andrej studen CSRF: 6e9a8b4b19ba996ab2eb53c712648304\n",
      "User: andrej studen CSRF: 0caa60af4d09a380787dc1f30778b4cc\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/usr/lib/python3/dist-packages/urllib3/connection.py:391: SubjectAltNameWarning: Certificate for merlin.fmf.uni-lj.si has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/urllib3/urllib3/issues/497 for details.)\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "User: andrej studen CSRF: b33d8404b6d520473d7fe67cd6b17ffd\n",
      "User: andrej studen CSRF: 88c16da9bc6f846ff42e274e7e7f30e1\n",
      "User: andrej studen CSRF: 1393a589857627c16f75e517584ee639\n",
      "User: andrej studen CSRF: 0d78f3cce7463617a53001f57feed24f\n",
      "User: andrej studen CSRF: 697ffab3c614291603f865a285b6e4a6\n",
      "User: andrej studen CSRF: f8fb4b97853d7ff076b8355a4feb59b0\n",
      "User: andrej studen CSRF: 97260193c69c1b5626f2d9ed04abcfed\n",
      "User: andrej studen CSRF: 89ff2a338e990d1281029903ee567adb\n",
      "User: andrej studen CSRF: e486e5c83a755dc6fa24db92a0d4adb7\n",
      "User: andrej studen CSRF: a3ba661c52bdd6b50845befe0334e057\n",
      "User: andrej studen CSRF: 4c62bbbcabf78c1ae9735977199003d2\n",
      "User: andrej studen CSRF: 31e7da64cf8bc8d440f492c08dae03c6\n",
      "User: andrej studen CSRF: 00b7000ff7f918ff69aec0746483423a\n",
      "User: andrej studen CSRF: 5a93597207e7d0f82e2f0a62d8708a3f\n",
      "User: andrej studen CSRF: 5b09fbbf3dbf9719705b8eaaa0705d15\n",
      "User: andrej studen CSRF: 72137fc05cc4977b0c7c21e4830314eb\n",
      "User: andrej studen CSRF: 68cfa16ea7ef26d5550b828417862547\n",
      "User: andrej studen CSRF: 32814a4b3698720cb03dc511f113c8d2\n",
      "User: andrej studen CSRF: 23ebe3dfc5b94eb3d13688d16efdbf07\n",
      "User: andrej studen CSRF: 739cf9ec9df35d5fa04bd00f754d3c3a\n",
      "User: andrej studen CSRF: 7c52d04b325241f5c487d5162b205140\n",
      "User: andrej studen CSRF: 84bb623d5eb9de0babbcd6a62b5864dc\n",
      "User: andrej studen CSRF: 0ce35f3985d852ea65c57d6257da086f\n",
      "User: andrej studen CSRF: 41b4338e26a6e8d13eba759c4dd774ca\n",
      "User: andrej studen CSRF: 1d5de387ee5c1110ec78d4a1764284bb\n",
      "User: andrej studen CSRF: 08c5f42a8adb47d0e23519b6f6da602c\n",
      "User: andrej studen CSRF: 7034387693fa5549cf5e66acb7789a47\n",
      "User: andrej studen CSRF: ec5950664445b1141a71786870a82ff1\n",
      "User: andrej studen CSRF: c71e5b75280af6e8f27426d407dc7105\n",
      "User: andrej studen CSRF: f15a0684abc05852dfae7606d387b502\n",
      "User: andrej studen CSRF: c77a5f126cb432c0f09c994b493a6687\n",
      "User: andrej studen CSRF: dc35ca0d08c1068094942aeda90d7be2\n",
      "User: andrej studen CSRF: cdbea5c24d335d5015243e55ada4192a\n",
      "User: andrej studen CSRF: ec2be23dfc434805e2d5eb8fb2223b68\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/usr/lib/python3/dist-packages/urllib3/connection.py:391: SubjectAltNameWarning: Certificate for merlin.fmf.uni-lj.si has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/urllib3/urllib3/issues/497 for details.)\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "User: andrej studen CSRF: 2de51b8ed9fa56384fb4b58572e5af6d\n",
      "User: andrej studen CSRF: db1fcba430f979efe579c75befb2d9e6\n",
      "User: andrej studen CSRF: 6c56304e2faa53e5f2f55ecf9a8531a2\n",
      "User: andrej studen CSRF: 557aa9a5d592cd1ca31a7a9c0350cd31\n",
      "User: andrej studen CSRF: a5bb1d24187c7e73776bc7ea83a1ff77\n",
      "User: andrej studen CSRF: fb0b5bbacc3a1ee18393b18121be7e0b\n",
      "User: andrej studen CSRF: a94b0d71b1942690bbe7d9a8b8f136c1\n",
      "User: andrej studen CSRF: cc7d1587f692d40b90255015abbaf592\n",
      "User: andrej studen CSRF: 695205226708ef6b4014d6117e3f61e7\n",
      "User: andrej studen CSRF: 73096f57940e4035e42fb15dbb7d4382\n",
      "User: andrej studen CSRF: eaecac55b23e716c759dc3b7a13f21dd\n",
      "User: andrej studen CSRF: ac81ef7eebdb4b8cdd366b0b802aae91\n",
      "User: andrej studen CSRF: b281b20d9b63972aab08847210a83d66\n",
      "User: andrej studen CSRF: 54c1fa3ae622ecd26a8654ba57c73f7f\n",
      "User: andrej studen CSRF: 9238309e8f82f92b6f18c62f970c5a99\n",
      "User: andrej studen CSRF: bbb1a3f8569782bc54cbbd1e46b5c6d4\n",
      "User: andrej studen CSRF: 4cb8f6eda31f286f7fe474afa5ca8941\n",
      "User: andrej studen CSRF: 6e277219eada30cca8ab6d976e69682f\n",
      "User: andrej studen CSRF: 80b9b24876333bb44d7950007df06cbb\n",
      "User: andrej studen CSRF: 59bea01d44cc945167c6308a9fbfc400\n",
      "User: andrej studen CSRF: c91d7f340adfaccda81f0489ca34c770\n",
      "User: andrej studen CSRF: da04634fee3ce9741dd0024c4e49b3f6\n",
      "User: andrej studen CSRF: 48f77edc2f370ea46d873b855bf5a4ec\n",
      "User: andrej studen CSRF: 8e4873282989444d3859df781af6c61d\n",
      "User: andrej studen CSRF: 2e07fda759af7e264768fbfe70319899\n",
      "User: andrej studen CSRF: 3ed08df44b32c2ae2d48f1b682a0874e\n",
      "User: andrej studen CSRF: 765a0b8914b871dd42c8f1327a909330\n",
      "User: andrej studen CSRF: efbe941182dcbfa686726fef1c0dba51\n",
      "User: andrej studen CSRF: 163a51757e65265276b7916dd44e323f\n",
      "User: andrej studen CSRF: cdf829f2244a0a597e71b59b7fd1c587\n",
      "User: andrej studen CSRF: 1f01e2eda08a2cd39138f77fc16c58f5\n",
      "User: andrej studen CSRF: d2b250b76d2bf77b262d0686d92fc15c\n",
      "User: andrej studen CSRF: a3701892e10a678b1b4df980ea72467e\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/usr/lib/python3/dist-packages/urllib3/connection.py:391: SubjectAltNameWarning: Certificate for merlin.fmf.uni-lj.si has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/urllib3/urllib3/issues/497 for details.)\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "User: andrej studen CSRF: c2939b2dba028dde41f55b41b89ba471\n",
      "User: andrej studen CSRF: eb17d1b6592333c46d3492cc3034987b\n",
      "User: andrej studen CSRF: 20cadb2f4f19ba3c012ca2ac28cae1f0\n",
      "User: andrej studen CSRF: 3288d5c08fe6f79b13421411e58d573b\n",
      "User: andrej studen CSRF: 9dd806bb2fccc7f56d6fcb72a8584123\n",
      "User: andrej studen CSRF: 219c79c6aa6fef6bfa1a00aab33b497d\n",
      "User: andrej studen CSRF: 383317df7a013f646d308142d928e008\n",
      "User: andrej studen CSRF: 01d0a4c714900ea885bc58940d49cace\n",
      "User: andrej studen CSRF: 8777841f83d426957125616603cef904\n",
      "User: andrej studen CSRF: b2a3f11369096383a5b69d446e089fd4\n",
      "User: andrej studen CSRF: 0ed0ba1226caac613466ba61a3e5e43e\n",
      "User: andrej studen CSRF: d2e1326235e3402c4c051dc984a2e30e\n",
      "User: andrej studen CSRF: c31364eedc85572ce05eb6d86b0bfae8\n",
      "User: andrej studen CSRF: 9d65652ef2565e907806bca5c58f4fd4\n",
      "User: andrej studen CSRF: 61c79aea2c580ff24e387134bdd69ddb\n",
      "User: andrej studen CSRF: f41f325a9279d7844f47d90f52ede432\n",
      "User: andrej studen CSRF: 686fbd5995bdb668425451adca6284e0\n",
      "User: andrej studen CSRF: 8c961eab8f654b7a69ee382d6c5ea628\n",
      "User: andrej studen CSRF: 127ddaa3e576f27f0d10be6d1b2bc5b6\n",
      "User: andrej studen CSRF: 29b25f2a4de61054d238fe058de6a6e9\n",
      "User: andrej studen CSRF: 6c269930757f8f2271aba1b6a056a579\n",
      "User: andrej studen CSRF: a503491c0a2e9182157a065fdb8f6d4d\n",
      "User: andrej studen CSRF: 37450821681f311b3733dd17411573e7\n",
      "User: andrej studen CSRF: f86c0730ca99afa8b872be3fd9ba7f1c\n",
      "User: andrej studen CSRF: 537456779914bf433eaf59e217df89d7\n",
      "User: andrej studen CSRF: 213d9a39ebe7404a76a1bf1f6230e2ed\n",
      "User: andrej studen CSRF: c01f24c7fddb43c5058a85efc26a25de\n",
      "User: andrej studen CSRF: 49931a27667f6887eb6e9714eb51dc1f\n",
      "User: andrej studen CSRF: 2d787635abac7a73fd4bdaa9ac8ed66d\n",
      "User: andrej studen CSRF: 8eb10ee7f66688f501f1377d83d4df72\n",
      "User: andrej studen CSRF: 27701bdac549226587aaa28279040fbf\n",
      "User: andrej studen CSRF: e371e5b28e3e9a0811b4d5063cea7ec2\n",
      "User: andrej studen CSRF: 892a75724d019548dec5c42bea7f8b6b\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/usr/lib/python3/dist-packages/urllib3/connection.py:391: SubjectAltNameWarning: Certificate for merlin.fmf.uni-lj.si has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/urllib3/urllib3/issues/497 for details.)\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "User: andrej studen CSRF: 77fb58c6906e19bdfd3050d2058b6f1c\n",
      "User: andrej studen CSRF: 048a3778a47c514e3509a28a1f68243b\n",
      "User: andrej studen CSRF: 3b948206d1b2ad2eca78ca97d9af77cc\n",
      "User: andrej studen CSRF: b9013b5e441952430f4350276f5d92a4\n",
      "User: andrej studen CSRF: 47ed9d4501a22ec0d66aa5bb05b9a175\n",
      "User: andrej studen CSRF: 838f4b26ba224cbdb7f20202ba18ccbd\n",
      "User: andrej studen CSRF: b535eec39be9a2ef1726f49202450aa0\n",
      "User: andrej studen CSRF: 9e87cddc7f521238c2cae40a92e2b347\n",
      "User: andrej studen CSRF: f0f44eb4905df593139f58f03434fc0c\n",
      "User: andrej studen CSRF: febb1e6f75945ca05ab6144b98a65373\n",
      "User: andrej studen CSRF: d44cc896020a3ded9a4f84405f95815f\n",
      "User: andrej studen CSRF: 3bd0da4f6d3ab0d2f74e05f3556e5f5f\n",
      "User: andrej studen CSRF: f58be4f88535672823d3610361b3bf43\n",
      "User: andrej studen CSRF: 6bb100b06a21d74170bbed166234f1c1\n",
      "User: andrej studen CSRF: a760f2a787bb854606fc91e28cf5dbe2\n",
      "User: andrej studen CSRF: b0edc3838840065b7d30bb1dae074757\n",
      "User: andrej studen CSRF: 393ccbf943d1b145f63e2a8bc296f498\n",
      "User: andrej studen CSRF: d2cd6842ff88f27a32f32ecb5a1d155b\n",
      "User: andrej studen CSRF: a8d6785d4562d8c7d22b62ebef010d6f\n",
      "User: andrej studen CSRF: a7ac5ddd2719cf60438952bf8f2da18b\n",
      "User: andrej studen CSRF: df2e6a289e5c0edf69ea21b2f7558211\n",
      "User: andrej studen CSRF: 627dbdd1556c7db715a8d3272095eb65\n",
      "User: andrej studen CSRF: 76c8d6a90f7c65f88d3f1dda1917a03b\n",
      "User: andrej studen CSRF: c36a22f0ae8e228ee7249cf14fd22f92\n",
      "User: andrej studen CSRF: dfad3c55f8b18d6a5930c2bf866d9f72\n",
      "User: andrej studen CSRF: 884b75f93a9cb45e3e0ca8fde154078f\n",
      "User: andrej studen CSRF: 32c613852e019325afb7c32f556caff2\n",
      "User: andrej studen CSRF: 5c1b6c1aa33c21a1b05c95bc65da5d71\n",
      "User: andrej studen CSRF: eb87cf353627c13eb96c2887f0ee477f\n",
      "User: andrej studen CSRF: cb9a96e0934d9984a665d411049a5075\n",
      "User: andrej studen CSRF: d33058042b6d3ce895962f6a480fd8c6\n",
      "User: andrej studen CSRF: 9d76408cbe405fc46d73177b7c7fcf51\n",
      "User: andrej studen CSRF: baef4a50cc38a35184b04b1ab1d54a64\n",
      "User: andrej studen CSRF: 2d4ef711901143a046927c8aa19c1649\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/usr/lib/python3/dist-packages/urllib3/connection.py:391: SubjectAltNameWarning: Certificate for merlin.fmf.uni-lj.si has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/urllib3/urllib3/issues/497 for details.)\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "User: andrej studen CSRF: 864e2293c5409ab3ecf525f7d79cbf2c\n",
      "User: andrej studen CSRF: 98d4ea65fc9f4c0291361168104c756b\n",
      "User: andrej studen CSRF: 4a92e2766ad6af32a3d7c7174e483bdd\n",
      "User: andrej studen CSRF: 7f490eefd6ba1be7d0d3a619c033770d\n",
      "User: andrej studen CSRF: 94411a767db48513601da467d077a966\n",
      "User: andrej studen CSRF: e28f2ce07187575bba214119646f9df8\n",
      "User: andrej studen CSRF: fce1580e2199ea9c0b3ba15642c68876\n",
      "User: andrej studen CSRF: 1722d70046dc422a8cc524821d3a0a50\n",
      "User: andrej studen CSRF: 58ebb28c987de6369de1dceb4e2faa35\n",
      "User: andrej studen CSRF: 6316de3dbda33316c9e47e0e6fd1ae85\n",
      "User: andrej studen CSRF: 83f5c3db2074d5d9b7dd719e9f4a994e\n",
      "User: andrej studen CSRF: 146decf187d1d33fea6b3abeef5548e5\n",
      "User: andrej studen CSRF: 515bd390d54cd0c0b8c081fa1724514f\n",
      "User: andrej studen CSRF: 43f6025f648baee5354aa0df53f6bfda\n",
      "User: andrej studen CSRF: 023742bc7c4c0c59255e2fd701b67eee\n",
      "User: andrej studen CSRF: 45fc7eebd71a4ed262f70458ac84dbf1\n",
      "User: andrej studen CSRF: fb3cea083bfb99bf99a843fa35a3f584\n",
      "User: andrej studen CSRF: b4a68fc60dfda950f2ccb053a0669406\n",
      "User: andrej studen CSRF: b22ec46935c1e3b1068ac71d8af9d450\n",
      "User: andrej studen CSRF: cc3a50145dcbcf49b3e58cf813eb79e4\n",
      "User: andrej studen CSRF: 73a65dc774ff0ff424da8ba0a1d47605\n",
      "User: andrej studen CSRF: 326f8fb52f7df99b1d619328a53f01d4\n",
      "User: andrej studen CSRF: 9e490065265faaea9447dec7b94a10c2\n",
      "User: andrej studen CSRF: 095219a1a967f60b45508b2a29135e97\n",
      "User: andrej studen CSRF: 6931330e958101ddbb648613ce14f21d\n",
      "User: andrej studen CSRF: b2edecbc612d96869a6383b3cefe63f0\n",
      "User: andrej studen CSRF: d174e3245426cb46bc686407d52ca2da\n",
      "User: andrej studen CSRF: 8a97f98ae843f86c3c2720069f61a707\n",
      "User: andrej studen CSRF: 2dcfaca5a78c88d33e30b65465b76c9e\n",
      "User: andrej studen CSRF: 39f3f08f78ca55b36bd2ee0bd40494ca\n",
      "User: andrej studen CSRF: e86d7632906911e63ee9f02d57239d65\n",
      "User: andrej studen CSRF: 05eb304cb9134ac26172a0107b675ade\n",
      "User: andrej studen CSRF: ff521f7f6bf8a91131c7a5f273a2658f\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/usr/lib/python3/dist-packages/urllib3/connection.py:391: SubjectAltNameWarning: Certificate for merlin.fmf.uni-lj.si has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/urllib3/urllib3/issues/497 for details.)\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "User: andrej studen CSRF: 2e38af7626b6925fce5cc8f8ecb05327\n",
      "User: andrej studen CSRF: 560578b7776efa176785e71f5affe64a\n",
      "User: andrej studen CSRF: 66ac63892a0bdbd3991943b6f20e8122\n",
      "User: andrej studen CSRF: adb02cac764e12b1e5b8d06341f2ece0\n",
      "User: andrej studen CSRF: f21b7992ee53374a6c672a927d72ee27\n",
      "User: andrej studen CSRF: 0c4d9d79fb8e3cf7f6d3ae9ec0632bc1\n",
      "User: andrej studen CSRF: f63f9e52e245f09951a9583ff0794b53\n",
      "User: andrej studen CSRF: fba84e2b2764b69f25e9ff1334d48fe2\n",
      "User: andrej studen CSRF: 52e3e3e69cb4315e48c6e0e36cb8878e\n",
      "User: andrej studen CSRF: 0ab05b824973e072cfe06f35e2bc28b1\n",
      "User: andrej studen CSRF: fdc759916abb50dc4328c2b2446c6d37\n",
      "User: andrej studen CSRF: a3a8b7b257967cba1fc25a5b776c4c82\n",
      "User: andrej studen CSRF: b47979417eb3b202049218155b4ab8e4\n",
      "User: andrej studen CSRF: 5a3f7d616b2eb7e892188292c8d26ac2\n",
      "User: andrej studen CSRF: de85c93ff70354f699460b9a4ca35f93\n",
      "User: andrej studen CSRF: c3081f4813387909903b6275bc8d0808\n",
      "User: andrej studen CSRF: 8a38ffb626c4f9a1178e0e3d5717ac0b\n",
      "User: andrej studen CSRF: 9de5599ffbb70ac290c48bdb0f97370f\n",
      "User: andrej studen CSRF: 50ba4d2a280e66ac27339dc668489a67\n",
      "User: andrej studen CSRF: 2417f4f05a12656ec30e44d0eba8c522\n",
      "User: andrej studen CSRF: e72c0c110a6bb5e35c32624fa41fa10d\n",
      "User: andrej studen CSRF: 3da83c52ee16fb0b86f78a4a73e07ea2\n",
      "User: andrej studen CSRF: 10e5be68ed67415f9eb062b370e27a24\n",
      "User: andrej studen CSRF: 6037d2a749d2b375fe693acead7e9c55\n",
      "User: andrej studen CSRF: 64251eb8d11950a5f82629c2e7ef1908\n",
      "User: andrej studen CSRF: 7df87c3a426ac506b533ebb0fb2a5963\n",
      "User: andrej studen CSRF: a68541330bcd2218d5221944f14c78e6\n",
      "User: andrej studen CSRF: 6c5958a39c31eca6d97ce46d444e7806\n",
      "User: andrej studen CSRF: a2f7f8477cdf58ab2103a2ded8611088\n",
      "User: andrej studen CSRF: cbd79e77867df7213df599c9f414551d\n",
      "User: andrej studen CSRF: 9beaefa2142aa9a56ac658f86f7d6eaa\n",
      "User: andrej studen CSRF: 03fd9246d0ede141ca17705064a99d02\n",
      "User: andrej studen CSRF: 501ed8366c629fec23087a3b318bbb40\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/usr/lib/python3/dist-packages/urllib3/connection.py:391: SubjectAltNameWarning: Certificate for merlin.fmf.uni-lj.si has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/urllib3/urllib3/issues/497 for details.)\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "User: andrej studen CSRF: c45d51e4e489b9c4f9b79e28a22237b9\n",
      "User: andrej studen CSRF: 817d8ab209074a6ba50905109a2473d7\n",
      "User: andrej studen CSRF: 1478d24472f2eb4486e3394d66438548\n",
      "User: andrej studen CSRF: dc2d43ed6f367adc97f995eefd4ef41e\n",
      "User: andrej studen CSRF: f101a5cca1a91b9896c397d177c788b5\n",
      "User: andrej studen CSRF: 009cf9a3cb6d2f8654e2bda846f4c0dd\n",
      "User: andrej studen CSRF: 85c07849eeff8182eef4c31d5895e550\n",
      "User: andrej studen CSRF: 3678ea8b9a0308a873232e0624045249\n",
      "User: andrej studen CSRF: 805868d7349b4ffbb9a73bf8eb3ee107\n",
      "User: andrej studen CSRF: 7b2418fa21b644f14ef7a113f25053fd\n",
      "User: andrej studen CSRF: 1089e33cc9bb79515081edf248ec3a3e\n",
      "User: andrej studen CSRF: 45e957fcc25ec860bc320b1680329093\n",
      "User: andrej studen CSRF: d11c8859ec2e5d825759d11f616b8ab4\n",
      "User: andrej studen CSRF: dca16e7729ebae2ffe3a60dea28fe90c\n",
      "User: andrej studen CSRF: 3eec27ff21fab1b1542cd2fa4daf6414\n",
      "User: andrej studen CSRF: 9e6b31d79985e9e23719e7a7eeebd0b0\n",
      "User: andrej studen CSRF: 3bb624f712e0002888f7839afb1c2c64\n",
      "User: andrej studen CSRF: c783e1758f6a025bcecdb7741672783f\n",
      "User: andrej studen CSRF: 71ffd7cd7dffe3c52a39e565f8216a1c\n",
      "User: andrej studen CSRF: 5d2ce6bbda19c0c43e3fc0448e3d53d2\n",
      "User: andrej studen CSRF: 23c6a2c811c47595612d7901037beb39\n",
      "User: andrej studen CSRF: 0a591a332b0da57b64e1a62672e54483\n",
      "User: andrej studen CSRF: aa832a1831321f1d1d639bc3999e46d4\n",
      "User: andrej studen CSRF: d5ff89d7732e1d147c8508a6a0dab8ab\n",
      "User: andrej studen CSRF: 80c1a5852b94cd29c6c8f57a78834aab\n",
      "User: andrej studen CSRF: 430aff3c402caee1535497c096a2fe0d\n",
      "User: andrej studen CSRF: 21f72748a151bc00a36cbdd3a4026d41\n",
      "User: andrej studen CSRF: 40fc32bd62c93eafdb449aafb7878ac0\n",
      "User: andrej studen CSRF: dab04f44606a6885183f6eaebe59cbb3\n",
      "User: andrej studen CSRF: 1d06fa81d66a1759115224c16bc4691c\n",
      "User: andrej studen CSRF: a4a0a541ea55c28f0f17c301156b08e3\n",
      "User: andrej studen CSRF: 0e28be47f325e87def456f1aa4144e6e\n",
      "User: andrej studen CSRF: 16eb002c664d58987988dffbf5322f02\n",
      "User: andrej studen CSRF: 37aed47f655542c1e333791f3e01b9f0\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/usr/lib/python3/dist-packages/urllib3/connection.py:391: SubjectAltNameWarning: Certificate for merlin.fmf.uni-lj.si has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/urllib3/urllib3/issues/497 for details.)\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "User: andrej studen CSRF: 55c5936f1a5caf4adb4f9f06326f23fd\n",
      "User: andrej studen CSRF: e709106beb4c24c374c976c66d6d1e6e\n",
      "User: andrej studen CSRF: 212b53a8465174923bd38a28bd0aa119\n",
      "User: andrej studen CSRF: 653e7da73281a573233a083a22bec0d1\n",
      "User: andrej studen CSRF: 0da76c5de17872b8cfd06a73bbbaad46\n",
      "User: andrej studen CSRF: 8106c02a02e527fc550a6419f9c31e37\n",
      "User: andrej studen CSRF: 495f322029307a12b2c1f898cedfb7ff\n",
      "User: andrej studen CSRF: 442365798864d7e677224643725c55a2\n",
      "User: andrej studen CSRF: f04c4de27ef816016dc7fd4c80cde5cb\n",
      "User: andrej studen CSRF: 97fb42cc7143d12a2d43079a95796688\n",
      "User: andrej studen CSRF: 0ef44b3c4fe3d6e07bd0241838ae05ea\n",
      "User: andrej studen CSRF: 4edd14671dc29520c300095ff249cf51\n",
      "User: andrej studen CSRF: acb73a5ddf5faf4a71dd9a898e198dd1\n",
      "User: andrej studen CSRF: aaa9d385cf1c894e99524560b27023d3\n",
      "User: andrej studen CSRF: df43192dc46e15f9fb6e7cd2664533c2\n",
      "User: andrej studen CSRF: 2d248f22844b72c42f00f7639cacad46\n",
      "User: andrej studen CSRF: 2ce5750fe5804462bd95d4a19b3851a7\n",
      "User: andrej studen CSRF: 2adede0ebc3ca87cbf0441e743313f87\n",
      "User: andrej studen CSRF: f7edbf137cf86916b054ac3c4da1991b\n",
      "User: andrej studen CSRF: 8d913cc470e38a96eeaa7c575f1a24b0\n",
      "User: andrej studen CSRF: 009808172b84e7930d62cbcc3207f780\n",
      "User: andrej studen CSRF: d1af11ddde86bb1e53c3d5297b144c4c\n",
      "User: andrej studen CSRF: 546f58dcfda638c30897007b16be6358\n",
      "User: andrej studen CSRF: 18c692244df76a20c4142cd9bd94b3fd\n",
      "User: andrej studen CSRF: 2a2d37f3c2392b5714d453a5c4e45b1f\n",
      "User: andrej studen CSRF: 129b6697deaf53e9d98150e7abbe0617\n",
      "User: andrej studen CSRF: c85fbd54984e7693ac500bc68ee99edc\n"
     ]
    }
   ],
   "source": [
    "pat=[p for p in patients if p.find('8')!=0]\n",
    "k1=fullSummary(project,locDir,pat,[10],20,0.1,3)\n",
    "storeSummary(db,project,locDir,k1,0.1,3)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 107,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'M': {0: {'mean': 0.005371908478823275, 'std': 0.0005748154115907079, 'median': 0.00504829351328475}, 1: {'mean': 0.00398706780698255, 'std': 0.0008592694250527332, 'median': 0.003388404180814905}, 2: {'mean': 0.0037767548460013053, 'std': 0.0006276175516250823, 'median': 0.004138535106155311}, 3: {'mean': 0.0045120019537560705, 'std': 0.0007593001890057208, 'median': 0.004904191257967345}, 4: {'mean': 0.0031040814064716474, 'std': 0.0001765662651125499, 'median': 0.00301590732317976}, 5: {'mean': 0.0045120019537560705, 'std': 0.0007593001890057208, 'median': 0.004904191257967345}, 6: {'mean': 0.0031040814064716474, 'std': 0.0001765662651125499, 'median': 0.00301590732317976}, 7: {'mean': 0.0031040814064716474, 'std': 0.0001765662651125499, 'median': 0.00301590732317976}, 8: {'mean': 0.0031040814064716474, 'std': 0.0001765662651125499, 'median': 0.00301590732317976}, 9: {'mean': 0.0031040814064716474, 'std': 0.0001765662651125499, 'median': 0.00301590732317976}, 10: {'mean': 0.0034925792443534615, 'std': 0.000712836434502568, 'median': 0.003230836321052485}, 11: {'mean': 0.002942684869416924, 'std': 8.584987083884881e-05, 'median': 0.002954897966504385}, 12: {'mean': 0.002942684869416924, 'std': 8.584987083884881e-05, 'median': 0.002954897966504385}, 13: {'mean': 0.0038874562766629287, 'std': 0.0008528550492831983, 'median': 0.003379357792522795}, 14: {'mean': 0.0031040814064716474, 'std': 0.0001765662651125499, 'median': 0.00301590732317976}, 15: {'mean': 0.002184062672680895, 'std': 4.336506662161737e-05, 'median': 0.00218645043494317}}, 'W': {0: {'mean': 0.005931986370752202, 'std': 0.00019139810809457942, 'median': 0.005930116066388524}, 1: {'mean': 0.003749548513649944, 'std': 0.0002816147776747823, 'median': 0.003861192537029771}, 2: {'mean': 0.003727806875027615, 'std': 0.0003322774172470865, 'median': 0.003940037177277234}, 3: {'mean': 0.004167914310279712, 'std': 0.0003870638820251826, 'median': 0.004406229257514758}, 4: {'mean': 0.003022912024319836, 'std': 6.624420546066359e-05, 'median': 0.0030077717895602004}, 5: {'mean': 0.0041797131569875105, 'std': 0.00046772875608648833, 'median': 0.004479721774912185}, 6: {'mean': 0.003247813763947978, 'std': 5.8068068873377935e-05, 'median': 0.0032274876165731556}, 7: {'mean': 0.0030447606235200955, 'std': 0.00011810157358104187, 'median': 0.00298593361254862}, 8: {'mean': 0.0032165663666835617, 'std': 5.5061408735894747e-05, 'median': 0.0031890549872549408}, 9: {'mean': 0.0033939676098046906, 'std': 4.4627474787750075e-05, 'median': 0.003381235252182444}, 10: {'mean': 0.0034631266888655184, 'std': 0.00011706013950740912, 'median': 0.003482031844177046}, 11: {'mean': 0.00362500279071822, 'std': 0.0001368698874922536, 'median': 0.0036780213624651305}, 12: {'mean': 0.0032147639914663546, 'std': 0.00012959835042494118, 'median': 0.0032326569794918335}, 13: {'mean': 0.003665605915324069, 'std': 0.00017376818980351577, 'median': 0.003724704287518482}, 14: {'mean': 0.0033597397409155273, 'std': 5.3618215779729534e-05, 'median': 0.0033406114442330387}, 15: {'mean': 0.0021692854905642515, 'std': 8.516403911876423e-06, 'median': 0.0021676539137135773}}}\n"
     ]
    }
   ],
   "source": [
    "print(k1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.02223504\n",
      "0.02223504\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/usr/lib/python3/dist-packages/urllib3/connection.py:391: SubjectAltNameWarning: Certificate for merlin.fmf.uni-lj.si has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/urllib3/urllib3/issues/497 for details.)\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.4418241525813627\n",
      "0.34392268845874496\n",
      "0.44668512187675746\n",
      "0.4277373071517828\n",
      "0.3922308796145302\n",
      "0.35643425292374326\n",
      "0.3692802456593414\n",
      "0.31520469737807355\n",
      "0.4654286761032285\n",
      "0.7829711283052362\n",
      "0.29574684452011624\n",
      "0.32465688583552055\n",
      "0.4998691162413557\n",
      "0.45862342417011315\n",
      "0.5354598797118066\n",
      "0.29275341177289665\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 5036 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 6516 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "import matplotlib\n",
    "p='7TMOBR'\n",
    "sy=28\n",
    "realizationId=5\n",
    "nclass=30\n",
    "nu=getIWeights(locDir,p,30,realizationId,4)\n",
    "nim=getPatientNIM(p)\n",
    "cut0=20\n",
    "w0=20\n",
    "cut1=0\n",
    "fw=40\n",
    "idx=[7,28,34]\n",
    "print(nu[7,28,34])\n",
    "print(nu[tuple(idx)])\n",
    "w=getWeights(project,locDir,p,nclass,realizationId,0.1,7)\n",
    "for r in w:\n",
    "    print(numpy.max(w[r]))\n",
    "matplotlib.pyplot.imshow(nu[:,sy,cut0:cut0+w0])\n",
    "matplotlib.pyplot.show()\n",
    "matplotlib.pyplot.imshow(nim[:,sy,cut0:cut0+w0])\n",
    "matplotlib.pyplot.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 93,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/usr/lib/python3/dist-packages/urllib3/connection.py:391: SubjectAltNameWarning: Certificate for merlin.fmf.uni-lj.si has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/urllib3/urllib3/issues/497 for details.)\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "M\n",
      "[10] 20/20\n",
      "[20] 20/20\n",
      "[30] 20/20\n"
     ]
    }
   ],
   "source": [
    "k1=combinePatient(project,locDir,'7TMMIR',[10,20,30],20,4.0,7)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 94,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{0: 0.006172951839546806, 1: 0.0011293802007511504, 2: 0.0034521499735888144, 3: 0.0042544572958967365, 4: 0.0035312206174353085, 5: 0.0042544572958967365, 6: 0.0030514161815550344, 7: 0.0013307214487837872, 8: 0.003330571003684981, 9: 0.0031176179941574842, 10: 0.0020333718489625023, 11: 0.00333907520086298, 12: 0.007351435428832242, 13: 0.0038036462072787995, 14: 0.003625240367164753, 15: 0.0028970199562430546}\n",
      "{0: 0.0006961087295939239, 1: 0.00031228541489592706, 2: 0.0004510546128805069, 3: 0.0005051282237067151, 4: 0.0004762660491350051, 5: 0.0005051282237067151, 6: 0.0005505760968232114, 7: 0.00032581639272840707, 8: 0.0005191027850853616, 9: 0.0007540860325457227, 10: 0.00032310962085205355, 11: 0.00038986355593399486, 12: 0.0027199019036271716, 13: 0.000548794240952012, 14: 0.0005487268424526743, 15: 0.0006667221336658735}\n"
     ]
    }
   ],
   "source": [
    "avgType=['M','W']\n",
    "meanK1={type:{region:numpy.mean(k1[region][type]) for region in k1} for type in avgType}\n",
    "stdK1={type:{region:numpy.std(k1[region][type]) for region in k1} for type in avgType}\n",
    "print(meanK1['M'])\n",
    "print(stdK1['M'])\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 79,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[0.00252038792282219, 0.00151611481573515, 0.00254164182147798, 0.00186663983190471, 0.00404895113316396, 0.0020328762566657, 0.00190085158556521, 0.00249521000442543, 0.00157109119636192, 0.00386999102896687, 0.00282258552513781, 0.00334338605677939, 0.00304450254908494, 0.00187659097886802, 0.00202826225861249, 0.0016204124091652]\n",
      "0.00252038792282219 0 0.00544315853082935\n",
      "0.00151611481573515 8 0.00204586967629601\n",
      "0.00254164182147798 1 0.00249553160944056\n",
      "0.00186663983190471 8 0.00204586967629601\n",
      "0.00404895113316396 7 0.00310949812694919\n",
      "0.0020328762566657 8 0.00204586967629601\n",
      "0.00190085158556521 2 0.0025554273008312\n",
      "0.00249521000442543 7 0.00310949812694919\n",
      "0.00157109119636192 9 0.00148953599268332\n",
      "0.00386999102896687 0 0.00544315853082935\n",
      "0.00282258552513781 7 0.00310949812694919\n",
      "0.00334338605677939 1 0.00249553160944056\n",
      "0.00304450254908494 1 0.00249553160944056\n",
      "0.00187659097886802 2 0.0025554273008312\n",
      "0.00202826225861249 8 0.00204586967629601\n",
      "0.0016204124091652 9 0.00148953599268332\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 8612 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "#k1=combinePatient(project,locDir,'7TMMIR',[10],20,4.0,7)\n",
    "realizationId=3\n",
    "c=10\n",
    "p='7TMOBR'\n",
    "w=getWeights(project,locDir,p,c,realizationId,0.1,3)\n",
    "wc={region:numpy.argmax(w[region]) for region in w}\n",
    "fitPar=getFitParIVF(locDir,p,c,realizationId)\n",
    "qk1=calculateK1(w,fitPar)\n",
    "k1p=getPixelIVF(project,locDir,p,4.0,7)\n",
    "pk=list(k1p.values())\n",
    "print(pk)\n",
    "ck=[qk1[region]['M'] for region in qk1]\n",
    "matplotlib.pyplot.scatter(ck,pk)\n",
    "for region in w:\n",
    "    print('{} {} {}'.format(k1p[region],wc[region],qk1[region]['M']))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 136,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/usr/lib/python3/dist-packages/urllib3/connection.py:391: SubjectAltNameWarning: Certificate for merlin.fmf.uni-lj.si has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/urllib3/urllib3/issues/497 for details.)\n",
      "  warnings.warn(\n"
     ]
    }
   ],
   "source": [
    "k1p=getPixelIVF(project,locDir,'7TMMIR',4.0,7)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 156,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.00252038792282219 0.00821063685487176 0.000769278586995102/0.0003330083431359072\n",
      "0.00151611481573515 3.10567836690838e-05 7.88785113142985e-06/1.9000844446763202e-06\n",
      "0.00254164182147798 3.10567836690838e-05 7.88785113142985e-06/1.9000844446763202e-06\n",
      "0.00186663983190471 0.00821063685487176 0.000769278586995102/0.0001671052167808519\n",
      "0.00404895113316396 0.0122210526169817 0.000769278586995102/0.0001671052167808519\n",
      "0.0020328762566657 0.0329991638607282 0.00219782291835452/0.0009453421745505919\n",
      "0.00190085158556521 3.10567836690838e-05 7.88785113142985e-06/1.9000844446763202e-06\n",
      "0.00249521000442543 0.0170371097144494 0.000769278586995102/0.0001671052167808519\n",
      "0.00157109119636192 3.10567836690838e-05 7.88785113142985e-06/1.9000844446763202e-06\n",
      "0.00386999102896687 0.22232351448649 0.00260465709367942/0.0010770771831046689\n",
      "0.00282258552513781 0.0261881964613408 0.002167764950618855/0.0006606993805304795\n",
      "0.00334338605677939 0.00388464867694823 7.88785113142985e-06/0.0003179710076941252\n",
      "0.00304450254908494 3.10567836690838e-05 7.88785113142985e-06/1.9000844446763202e-06\n",
      "0.00187659097886802 3.10567836690838e-05 7.88785113142985e-06/1.9000844446763202e-06\n",
      "0.00202826225861249 3.10567836690838e-05 0.000769278586995102/0.0007166763218796836\n",
      "0.0016204124091652 0.0261881964613408 0.002167764950618855/0.0007016445972818652\n"
     ]
    }
   ],
   "source": [
    "for r in k1:\n",
    "    print('{} {} {}/{}'.format(k1p[r], qk1[r]['M'] ,numpy.median(k1[r]['M'][10:20]),numpy.std(k1[r]['M'])))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0., 0., 0.])"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "numpy.zeros(3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
