[med-svn] [Git][med-team/epigrass][master] part 2

Michael R. Crusoe gitlab at salsa.debian.org
Fri Mar 1 23:24:18 GMT 2019


Michael R. Crusoe pushed to branch master at Debian Med / epigrass


Commits:
3b027aa0 by Michael R. Crusoe at 2019-03-01T23:24:08Z
part 2

- - - - -


1 changed file:

- debian/patches/py3


Changes:

=====================================
debian/patches/py3
=====================================
@@ -20,6 +20,17 @@ Description: Py3 compatability courtesy of 2to3 + QT5
  
  """
  Library of discrete time Epidemic models
+@@ -49,8 +49,8 @@
+     """
+     Defines a library of discrete time population models
+     """
+-    @cython.locals(geocode='long', modtype='bytes', parallel='bint')
+-    def __init__(self, geocode, modtype=b'', parallel=True):
++    @cython.locals(geocode='long', modtype='str', parallel='bint')
++    def __init__(self, geocode, modtype=u'', parallel=True):
+         """
+         defines which models a given site will use
+         and set variable names accordingly.
 @@ -78,9 +78,9 @@
          theta = int(nan_to_num(float(redisclient.get("{}:theta".format(self.geocode)))))
          npass = int(float(redisclient.get("{}:npass".format(self.geocode))))
@@ -32,6 +43,15 @@ Description: Py3 compatability courtesy of 2to3 + QT5
          values = [float(i) for i in redisclient.lrange("{}:values".format(self.geocode), 0, -1)]
          return inits, simstep, totpop, theta, npass, bi, bp, values
  
+@@ -106,7 +106,7 @@
+             # self.parentGraph.epipath.append((self.parentGraph.simstep, self.geocode, self.infector))
+             # TODO: have infector be stated in terms of geocodes
+ 
+- at cython.locals(Type='bytes')
++ at cython.locals(Type='str')
+ def selectModel(Type):
+     """
+     Sets the model engine
 @@ -157,7 +157,7 @@
  
              return CustomModel.Model
@@ -1063,15 +1083,20 @@ Description: Py3 compatability courtesy of 2to3 + QT5
          return self
  
      def createModel(self, modtype='', name='model1', v=[], bi=None, bp=None):
-@@ -105,7 +106,7 @@
-         """
-        # Init = init  # deprecated
-         N = self.totpop
--        self.modtype = modtype
-+        self.modtype = modtype.encode('utf-8')
+@@ -109,11 +110,11 @@
          self.values = v
          self.bi = bi
          self.bp = bp
+-        self.model = epimodels.Epimodel(self.geocode, modtype)
++        self.model = epimodels.Epimodel(self.geocode, self.modtype)
+         self.vnames = epimodels.vnames[modtype]
+         try:
+             # self.ts = [[bi[vn.lower()] for vn in self.vnames]]
+-            self.ts.append(list(bi.values()))  # This is fine since bi is an OrderedDict
++            self.ts.append(bi.values())  # This is fine since bi is an OrderedDict
+         except KeyError as ke:
+             if self.vnames == ['Exposed', 'Infectious', 'Susceptible']:
+                 self.ts = [[bi[vn] for vn in ['e', 'i', 's']]]
 @@ -1155,9 +1156,9 @@
          Length -- Length in kilometers of this route
          """
@@ -1084,18 +1109,6 @@ Description: Py3 compatability courtesy of 2to3 + QT5
          self.dest = dest
          self.source = source
          self.sites = [source, dest]
-@@ -1207,9 +1208,9 @@
-         self.name = graph_name
-         self.digraph = digraph
-         self.site_dict = {} #geocode as keys
--        self.site_list = property(fget=lambda self: self.site_dict.values()) #only for backwards compatibility
-+        self.site_list = property(fget=lambda self: list(self.site_dict.values())) #only for backwards compatibility
-         self.edge_dict = {} #geocode tuple as key
--        self.edge_list = property(fget=lambda self: self.edge_dict.values()) #only for backwards compatibility
-+        self.edge_list = property(fget=lambda self: list(self.edge_dict.values())) #only for backwards compatibility
-         self.speed = 0 # speed of the transportation system
-         self.simstep = 1 #current step in the simulation
-         self.maxstep = 100 #maximum number of steps in the simulation
 @@ -1251,7 +1252,7 @@
          """
  
@@ -1133,27 +1146,15 @@ Description: Py3 compatability courtesy of 2to3 + QT5
  
          return sitenames
  
-@@ -1512,9 +1512,9 @@
+@@ -1512,7 +1512,7 @@
          dm = zeros((d, d), float)
          ap = zeros((d, d), float)
          i = 0
 -        for sitei in g.iterkeys():
 +        for sitei in g.keys():
              j = 0
--            for sitej in g.keys()[:i]: #calculates only the lower triangle
-+            for sitej in list(g.keys())[:i]: #calculates only the lower triangle
+             for sitej in g.keys()[:i]: #calculates only the lower triangle
                  sp = self.shortestPath(g, sitei, sitej)
-                 lsp = self.getShortestPathLength(sitei, sp) #length of the shortestpath
-                 self.shortPathList.append((sitei, sitej, sp, lsp))
-@@ -1557,7 +1557,7 @@
-             pass
-         if not self.graphdict: #this generates site neighbors lists
-             self.getGraphdict()
--        site_list = self.site_dict.values()
-+        site_list = list(self.site_dict.values())
-         nsites = len(self.site_dict)
-         cm = zeros((nsites, nsites), float)
-         for i, sitei in enumerate(site_list):
 @@ -1636,7 +1636,7 @@
          The weight of all nodes in the graph (W(G)) is the summation
          of each node's order (o) multiplied by 2 for all orders above 1.
@@ -1221,15 +1222,6 @@ Description: Py3 compatability courtesy of 2to3 + QT5
              self.__heap.sort()  # builtin sort likely faster than O(n) heapify
          else:
              newPair = (val, key)
-@@ -1953,7 +1953,7 @@
-             heap[insertionPoint] = newPair
- 
-     def update(self, other):
--        for key in other.keys():
-+        for key in list(other.keys()):
-             self[key] = other[key]
- 
-     def setdefault(self, key, val):
 --- epigrass.orig/Epigrass/primitives.py
 +++ epigrass/Epigrass/primitives.py
 @@ -9,7 +9,16 @@
@@ -1241,7 +1233,7 @@ Description: Py3 compatability courtesy of 2to3 + QT5
 +    gluNewQuadric, glColor4f, glPushMatrix, glTranslatef, glBegin, GL_POINTS,
 +    glVertex3f, glEnd, glPopMatrix, GLU_FILL, glRotatef, gluQuadricDrawStyle,
 +    gluDisk, gluPartialDisk, glEnable, GL_LINE_STIPPLE, glLineStipple,
-+    glLineWidth, GL_LINE_LOOP, GL_QUADS, GL_POLYGON, GL_TRIANGLES, glDisable
++    glLineWidth, GL_LINE_LOOP, GL_QUADS, GL_POLYGON, GL_TRIANGLES, glDisable,
 +    GLfloat, GL_LINES, glVertex2i, GLU_MAP1_TRIM_2, gluNewNurbsRenderer,
 +    gluNurbsProperty, GLU_SAMPLING_TOLERANCE, GLU_DISPLAY_MODE, gluBeginCurve, 
 +    gluNurbsCurve, GL_MAP1_VERTEX_3, gluEndCurve, GL_BLEND, glBlendFunc, 
@@ -1259,6 +1251,15 @@ Description: Py3 compatability courtesy of 2to3 + QT5
                  return
          self.members = olist
      def getX(self) : 
+@@ -458,7 +467,7 @@
+     right = property(getRight, setRight)
+     
+     def setBottom(self,x):
+-        self.rect = self.x, y-self.width*0.5, self.width, self.height
++        self.rect = self.x, self.y-self.width*0.5, self.width, self.height
+     def getBottom(self): return self.rect[3]
+     bottom = property(getBottom, setBottom)
+ 
 @@ -506,7 +515,7 @@
          win.dispatch_events()
          mvmt = random.randint(-10, 10)
@@ -2322,6 +2323,17 @@ Description: Py3 compatability courtesy of 2to3 + QT5
 -        self.actionGML.setText(QtGui.QApplication.translate("MainWindow", "GML", None, QtGui.QApplication.UnicodeUTF8))
 -        self.actionPajek.setText(QtGui.QApplication.translate("MainWindow", "Pajek", None, QtGui.QApplication.UnicodeUTF8))
 -        self.actionYAML.setText(QtGui.QApplication.translate("MainWindow", "YAML", None, QtGui.QApplication.UnicodeUTF8))
+-
+-import epigrass_rc
+-
+-if __name__ == "__main__":
+-    import sys
+-    app = QtGui.QApplication(sys.argv)
+-    MainWindow = QtGui.QMainWindow()
+-    ui = Ui_MainWindow()
+-    ui.setupUi(MainWindow)
+-    MainWindow.show()
+-    sys.exit(app.exec_())
 +        self.dataPanel.setTabText(self.dataPanel.indexOf(self.Edges), _translate("MainWindow", "Edges"))
 +        self.menuFile.setTitle(_translate("MainWindow", "&File"))
 +        self.menu_Export.setTitle(_translate("MainWindow", "&Export"))
@@ -2343,17 +2355,7 @@ Description: Py3 compatability courtesy of 2to3 + QT5
 +        self.actionPajek.setText(_translate("MainWindow", "Pajek"))
 +        self.actionYAML.setText(_translate("MainWindow", "YAML"))
  
- import epigrass_rc
--
--if __name__ == "__main__":
--    import sys
--    app = QtGui.QApplication(sys.argv)
--    MainWindow = QtGui.QMainWindow()
--    ui = Ui_MainWindow()
--    ui.setupUi(MainWindow)
--    MainWindow.show()
--    sys.exit(app.exec_())
--
++from . import epigrass_rc
 --- epigrass.orig/Epigrass/dataObject.py
 +++ epigrass/Epigrass/dataObject.py
 @@ -62,13 +62,13 @@
@@ -2758,8 +2760,8 @@ Description: Py3 compatability courtesy of 2to3 + QT5
 -from PyQt4 import QtCore, QtGui
 -from PyQt4.QtGui import QMainWindow
 -from PyQt4.QtCore import pyqtSignature
-+from PyQt5 import QtCore, QtGui
-+from PyQt5.QtGui import QMainWindow
++from PyQt5 import QtCore, QtGui, QtWidgets
++from PyQt5.QtWidgets import QMainWindow
 +from PyQt5.QtCore import pyqtSlot
  from types import MethodType
 -from Ui_neteditor import Ui_MainWindow
@@ -2820,7 +2822,7 @@ Description: Py3 compatability courtesy of 2to3 + QT5
          pass
      
 -    @pyqtSignature("")
-+    @pyqtSlot
++    @pyqtSlot()
      def on_edgeTable_itemSelectionChanged(self):
          """
          Slot documentation goes here.
@@ -3318,16 +3320,18 @@ Description: Py3 compatability courtesy of 2to3 + QT5
  #    app.setMainWidget(w)
 --- epigrass.orig/Epigrass/report.py
 +++ epigrass/Epigrass/report.py
-@@ -2,7 +2,7 @@
+@@ -2,7 +2,9 @@
  This module generates a report of the network simulation model
  using LaTeX.
  """
 -import os, sys, commands, string, time, matplotlib, codecs
 +import os, sys, subprocess, string, time, matplotlib, codecs
++from matplotlib.pyplot import close, savefig, bar, ylabel, xlabel, colorbar, title, pcolor, hist
++from numpy import mean
  #matplotlib.use("Agg")
  
  #from pylab import *
-@@ -24,8 +24,8 @@
+@@ -24,8 +26,8 @@
      """
      def __init__(self, simulation):
          self.workdir = os.getcwd()
@@ -3338,7 +3342,7 @@ Description: Py3 compatability courtesy of 2to3 + QT5
          if pltx.startswith('which:'):
              self.latex = 0
          else:
-@@ -348,12 +348,12 @@
+@@ -348,12 +350,12 @@
          cuminc=[sum(incidence[:i]) for i in range(len(incidence))]
          
          infc = site.thetahist
@@ -3353,7 +3357,7 @@ Description: Py3 compatability courtesy of 2to3 + QT5
          xlabel('Time')
          ylabel('Infectious individuous')
          savefig('inf.png')
-@@ -382,7 +382,7 @@
+@@ -382,7 +384,7 @@
          """
          epistats = self.sim.g.getEpistats()
          cumcities = [sum(epistats[1][:i]) for i in range(len(epistats[1]))]
@@ -3362,7 +3366,7 @@ Description: Py3 compatability courtesy of 2to3 + QT5
          ylabel=('Number of infected cities')
          xlabel=('Time')
          savefig('sp.png')
-@@ -439,7 +439,7 @@
+@@ -439,7 +441,7 @@
          Path = Path.replace(' ','-')
          os.system('mkdir '+Path)
          os.chdir(Path)
@@ -3371,7 +3375,7 @@ Description: Py3 compatability courtesy of 2to3 + QT5
          
          sitehead = r"""
                  \chapter{Site Specific Analyses}"
-@@ -476,7 +476,7 @@
+@@ -476,7 +478,7 @@
                      latexsrc += self.siteReport(site)
              latexsrc += tail
              timer = time.clock()-start
@@ -3380,7 +3384,7 @@ Description: Py3 compatability courtesy of 2to3 + QT5
              if self.sim.gui:
                  self.sim.gui.textEdit1.insertParagraph('Time to generate Network report: %s seconds.'% timer,-1)
              self.savenBuild('Netreport',latexsrc)
-@@ -489,7 +489,7 @@
+@@ -489,7 +491,7 @@
                      latexsrc += self.genSiteEpi(site)
              latexsrc +=  tail
              timer = time.clock()-start
@@ -3389,7 +3393,7 @@ Description: Py3 compatability courtesy of 2to3 + QT5
              if self.sim.gui:
                  self.sim.gui.textEdit1.insertParagraph('Time to generate epidemiological report: %s seconds.'% timer,-1)
              self.savenBuild('epireport',latexsrc)
-@@ -508,7 +508,7 @@
+@@ -508,7 +510,7 @@
                      latexsrc += self.genSiteEpi(site)
              latexsrc += tail
              timer = time.clock()-start
@@ -3398,7 +3402,7 @@ Description: Py3 compatability courtesy of 2to3 + QT5
              if self.sim.gui:
                  self.sim.gui.textEdit1.insertParagraph('Time to generate full report: %s seconds.'% timer,-1)
              self.savenBuild('fullreport',latexsrc)
-@@ -520,7 +520,7 @@
+@@ -520,7 +522,7 @@
          if self.sim.gui:
              self.sim.gui.textEdit1.insertParagraph(string,-1)
          else:
@@ -3409,7 +3413,7 @@ Description: Py3 compatability courtesy of 2to3 + QT5
          """
 --- epigrass.orig/Epigrass/spread.py
 +++ epigrass/Epigrass/spread.py
-@@ -1,10 +1,6 @@
+@@ -1,14 +1,8 @@
  #coding: utf8
  #spread display and analisys
  #
@@ -3417,10 +3421,14 @@ Description: Py3 compatability courtesy of 2to3 + QT5
 -#    from PyQt4.QtGui import *
 -#except ImportError: 
 -#    print "Please install PyQT 4"
- #from qt import *
+-#from qt import *
  from xml.dom import minidom, Node
  import os, json
-@@ -38,7 +34,7 @@
+-from numpy import *
+ import networkx as nx
+ from networkx.readwrite import  json_graph
+ import codecs
+@@ -38,7 +32,7 @@
              infected = self.g.site_dict[n[1]]
              infectors = n[-1]
              self.nxg.add_node(n[1],name=infected.sitename,time=n[0])
@@ -3429,7 +3437,7 @@ Description: Py3 compatability courtesy of 2to3 + QT5
                  self.nxg.add_edge(n[1],i.geocode,weight=float(c))
  
  
-@@ -62,7 +58,7 @@
+@@ -62,7 +56,7 @@
          Spread.writeENGML(f,tree) #calling as a class method
          f.write(']')
          f.close()
@@ -3438,7 +3446,7 @@ Description: Py3 compatability courtesy of 2to3 + QT5
      writeGML = classmethod(writeGML)
          
      def writeENGML(self,fobj,tree):
-@@ -72,10 +68,10 @@
+@@ -72,10 +66,10 @@
          f=fobj
          #Create dictionary of node IDs, and eliminate possible node duplicates.
          nodes = dict([(i[1],n) for n,i in enumerate(tree)])



View it on GitLab: https://salsa.debian.org/med-team/epigrass/commit/3b027aa02eb2f6b1d39ce69c598cba46917cc976

-- 
View it on GitLab: https://salsa.debian.org/med-team/epigrass/commit/3b027aa02eb2f6b1d39ce69c598cba46917cc976
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20190301/238c47de/attachment-0001.html>


More information about the debian-med-commit mailing list