Example #1
0
 def setUp(self):
     self.G = {(1,1): {(2,2): 0.125, (3,3): 0.75}, (2,2): {(1,1): 0.125, (4,4): 1.2},
                (3,3): {(1,1): 0.75, (4,4): 0.375},
                (4,4): {(2,2): 1.2, (3,3): 0.375, (5,5): 0.5},
                (5,5): {(4,4): 0.5}, (6,6):{(7,7):1.0}, (7,7):{(6,6):1.0}}
     self.G_meshed = pynet.mesh_network(self.G, 0.1)
     self.points = [((3.6666666666666665, 3.6666666666666665), (3.5, 3.5), 
                      1.8011569244041523e-18, 8.0119209423694433e-18), 
                    ((4.0, 4.0), (3.8333333333333335, 3.8333333333333335), 
                      6.4354219496947843e-18, 1.3190733783852405e-17), 
                    ((6.5999999999999996, 6.5999999999999996), (6.5, 6.5), 
                      8.6525456558003033e-19, 4.0412843678067672e-18)]
     self.proj_points = []
     for p in self.points:
         self.proj_points.append(pynet.proj_pnt_coor(p))
Example #2
0
 def setUp(self):
     self.G = {
         (1, 1): {
             (2, 2): 0.125,
             (3, 3): 0.75
         },
         (2, 2): {
             (1, 1): 0.125,
             (4, 4): 1.2
         },
         (3, 3): {
             (1, 1): 0.75,
             (4, 4): 0.375
         },
         (4, 4): {
             (2, 2): 1.2,
             (3, 3): 0.375,
             (5, 5): 0.5
         },
         (5, 5): {
             (4, 4): 0.5
         },
         (6, 6): {
             (7, 7): 1.0
         },
         (7, 7): {
             (6, 6): 1.0
         }
     }
     self.G_meshed = pynet.mesh_network(self.G, 0.1)
     self.points = [((3.6666666666666665, 3.6666666666666665), (3.5, 3.5),
                     1.8011569244041523e-18, 8.0119209423694433e-18),
                    ((4.0, 4.0), (3.8333333333333335, 3.8333333333333335),
                     6.4354219496947843e-18, 1.3190733783852405e-17),
                    ((6.5999999999999996, 6.5999999999999996), (6.5, 6.5),
                     8.6525456558003033e-19, 4.0412843678067672e-18)]
     self.proj_points = []
     for p in self.points:
         self.proj_points.append(pynet.proj_pnt_coor(p))
Example #3
0
 def test_mesh_network(self):
     graph = pynet.mesh_network(self.G2, 0.1)
     self.assertEqual(len(graph), 41)
Example #4
0
medline = db.medline



parser = argparse.ArgumentParser(description='Construct meshterm network for search criteria.')
parser.add_argument('--query', type=str, required=True)
parser.add_argument('--outfile', type=argparse.FileType('wb'), required=True,
                    default=sys.stdout)
parser.add_argument('--type', type=str, required=False)

if __name__ == '__main__':

      args    = parser.parse_args()
      outfile = args.outfile
      type = args.type
      
      print unicode(args.query)
      
      if args.type:
      	if type=="article":
              G = article_network( medline.find( json.loads(args.query) ) )
        else:
          G = mesh_network( medline.find( json.loads(args.query) ) )
      else:
      	G = mesh_network( medline.find( json.loads(args.query) ) )

      print "nodes: ", len(G.nodes())
    
      pickle.dump(G, outfile)
      outfile.close()
Example #5
0
parser = argparse.ArgumentParser(
    description='Construct meshterm network for search criteria.')
parser.add_argument('--query', type=str, required=True)
parser.add_argument('--outfile',
                    type=argparse.FileType('wb'),
                    required=True,
                    default=sys.stdout)
parser.add_argument('--type', type=str, required=False)

if __name__ == '__main__':

    args = parser.parse_args()
    outfile = args.outfile
    type = args.type

    print unicode(args.query)

    if args.type:
        if type == "article":
            G = article_network(medline.find(json.loads(args.query)))
        else:
            G = mesh_network(medline.find(json.loads(args.query)))
    else:
        G = mesh_network(medline.find(json.loads(args.query)))

    print "nodes: ", len(G.nodes())

    pickle.dump(G, outfile)
    outfile.close()
Example #6
0
 def test_mesh_network(self):
     graph = pynet.mesh_network(self.G2, 0.1)
     self.assertEqual(len(graph), 41)