示例#1
0
 def setUp(self):
     self.ntw = spgh.Network(in_data=examples.get_path('streets.shp'))
     pt_str = 'crimes'
     in_data = examples.get_path('{}.shp'.format(pt_str))
     self.ntw.snapobservations(in_data, pt_str, attribute=True)
     npts = self.ntw.pointpatterns['crimes'].npoints
     self.ntw.simulate_observations(npts)
示例#2
0
 def setUp(self):
     self.path_to_shp = examples.get_path('streets.shp')
     
     # network instantiated from shapefile
     self.ntw_from_shp = spgh.Network(in_data=self.path_to_shp,
                                      weightings=True,
                                      w_components=True)
     self.n_known_arcs, self.n_known_vertices = 303, 230
 def setUp(self):
     path_to_shp = examples.get_path('streets.shp')
     gdf = geopandas.read_file(path_to_shp)
     self.ntw = spgh.Network(in_data=gdf)
     for obs in ['schools', 'crimes']:
         in_data = examples.get_path('{}.shp'.format(obs))
         self.ntw.snapobservations(in_data, obs, attribute=True)
         setattr(self, obs, self.ntw.pointpatterns[obs])
示例#4
0
 def setUp(self):
     path_to_shp = examples.get_path('streets.shp')
     self.ntw = spgh.Network(in_data=path_to_shp)
     self.pt_str = 'schools'
     path_to_shp = examples.get_path('%s.shp' % self.pt_str )
     self.ntw.snapobservations(path_to_shp, self.pt_str , attribute=True)
     npts = self.ntw.pointpatterns[self.pt_str].npoints
     self.ntw.simulate_observations(npts)
     self.test_permutations = 3
     self.test_steps = 5
 def setUp(self):
     path_to_shp = examples.get_path('streets.shp')
     gdf = geopandas.read_file(path_to_shp)
     self.ntw = spgh.Network(in_data=gdf)
     pt_str = 'crimes'
     path_to_shp = examples.get_path('{}.shp'.format(pt_str))
     in_data = geopandas.read_file(path_to_shp)
     self.ntw.snapobservations(in_data, pt_str, attribute=True)
     npts = self.ntw.pointpatterns['crimes'].npoints
     self.ntw.simulate_observations(npts)
示例#6
0
 def setUp(self):
     path_to_shp = examples.get_path("streets.shp")
     self.ntw = spgh.Network(in_data=path_to_shp)
     self.pp1_str = "schools"
     self.pp2_str = "crimes"
     iterator = [(self.pp1_str, "pp1"), (self.pp2_str, "pp2")]
     for (obs, idx) in iterator:
         path_to_shp = examples.get_path("%s.shp" % obs)
         self.ntw.snapobservations(path_to_shp, obs, attribute=True)
         setattr(self, idx, self.ntw.pointpatterns[obs])
     self.known_pp1_npoints = 8
示例#7
0
 def setUp(self):
     path_to_shp = examples.get_path('streets.shp')
     self.ntw = spgh.Network(in_data=path_to_shp)
     self.pp1_str = 'schools'
     self.pp2_str = 'crimes'
     iterator = [(self.pp1_str, 'pp1'),
                 (self.pp2_str, 'pp2')]
     for (obs, idx) in iterator:
         path_to_shp = examples.get_path('%s.shp' % obs)
         self.ntw.snapobservations(path_to_shp, obs, attribute=True)
         setattr(self, idx, self.ntw.pointpatterns[obs])
     self.known_pp1_npoints = 8
示例#8
0
    def test_network_from_geopandas(self):
        # network instantiated from geodataframe
        gdf = geopandas.read_file(self.path_to_shp)
        self.ntw_from_gdf = spgh.Network(in_data=gdf, w_components=True)

        # gdf test against known
        self.assertEqual(len(self.ntw_from_gdf.arcs), self.n_known_arcs)
        self.assertEqual(len(self.ntw_from_gdf.vertices),
                         self.n_known_vertices)

        # shp against gdf
        self.assertEqual(len(self.ntw_from_shp.arcs),
                         len(self.ntw_from_gdf.arcs))
        self.assertEqual(len(self.ntw_from_shp.vertices),
                         len(self.ntw_from_gdf.vertices))
 def setUp(self):
     path_to_shp = examples.get_path('streets.shp')
     gdf = geopandas.read_file(path_to_shp)
     self.ntw = spgh.Network(in_data=gdf)
示例#10
0
 def setUp(self):
     self.ntw = spgh.Network(in_data=examples.get_path('streets.shp'))
示例#11
0
 def setUp(self):
     self.ntw = spgh.Network(in_data=examples.get_path('streets.shp'))
     for obs in ['schools', 'crimes']:
         in_data = examples.get_path('{}.shp'.format(obs))
         self.ntw.snapobservations(in_data, obs, attribute=True)
         setattr(self, obs, self.ntw.pointpatterns[obs])