def setUp(self): self.network = copy.deepcopy(network_empirical_simplified_wcm) # empirical origins obs1 = tigernet.testing_data("CensusBlocks_Leon_FL_2010") # empirical destinations obs2 = tigernet.testing_data("WeightedParcels_Leon_FL_2010") # associate origins with the network args = self.network, obs1.copy() kwargs = {"df_name": "obs1", "df_key": "GEOID", "snap_to": "nodes"} self.net_obs1 = tigernet.Observations(*args, **kwargs) # associate destinations with the network args = self.network, obs2.copy() kwargs = {"df_name": "obs2", "df_key": "PARCEL_ID", "snap_to": "nodes"} self.net_obs2 = tigernet.Observations(*args, **kwargs)
def setUp(self): network = copy.deepcopy(network_empirical_simplified) # generate synthetic observations obs = tigernet.testing_data("WeightedParcels_Leon_FL_2010") # associate observations with the network args = network, obs.copy() kwargs = {"df_name": "obs1", "df_key": "PARCEL_ID"} self.net_obs = tigernet.Observations(*args, **kwargs)
def test_no_cost_matrix(self): network = copy.deepcopy(network_lattice_1x1_geomelem) pts = [Point(1, 1), Point(3, 1), Point(1, 3), Point(3, 3)] od_data = {"obs_id": ["a", "b", "c", "d"]} obs = geopandas.GeoDataFrame(od_data, geometry=pts) args = network, obs.copy() kwargs = {"df_name": "obs1", "df_key": "obs_id"} observations = tigernet.Observations(*args, **kwargs) with self.assertRaises(AttributeError): tigernet.obs2obs_cost_matrix(observations, network)
def setUp(self): self.network = copy.deepcopy(network_empirical_simplified_wcm) # empirical observations obs = tigernet.testing_data("CensusBlocks_Leon_FL_2010") # associate observations with the network args = self.network, obs.copy() kwargs = {"df_name": "obs1", "df_key": "GEOID"} self.net_obs = tigernet.Observations(*args, **kwargs)
def setUp(self): self.network = copy.deepcopy(network_lattice_1x1_small) # generate synthetic origins obs1 = tigernet.generate_obs(5, self.network.s_data) obs1["obs_id"] = ["a", "b", "c", "d", "e"] # generate synthetic destinations obs2 = tigernet.generate_obs(3, self.network.s_data, seed=1) obs2["obs_id"] = ["z", "y", "x"] # associate origins with the network args = self.network, obs1.copy() kwargs = {"df_name": "obs1", "df_key": "obs_id", "snap_to": "nodes"} self.net_obs1 = tigernet.Observations(*args, **kwargs) # associate destinations with the network args = self.network, obs2.copy() kwargs = {"df_name": "obs2", "df_key": "obs_id", "snap_to": "nodes"} self.net_obs2 = tigernet.Observations(*args, **kwargs)
def setUp(self): network = copy.deepcopy(network_empirical_simplified) # generate synthetic observations obs = tigernet.generate_obs(500, network.s_data) obs["obs_id"] = obs.index # associate observations with the network args = network, obs.copy() kwargs = {"df_name": "obs1", "df_key": "obs_id", "snap_to": "nodes"} self.net_obs = tigernet.Observations(*args, **kwargs)
def setUp(self): network = copy.deepcopy(network_lattice_1x1_geomelem) # generate synthetic observations obs = tigernet.generate_obs(5, network.s_data) obs["obs_id"] = ["a", "b", "c", "d", "e"] # associate observations with the network args = network, obs.copy() kwargs = {"df_name": "obs1", "df_key": "obs_id"} self.net_obs = tigernet.Observations(*args, **kwargs)
def setUp(self): network = copy.deepcopy(network_empirical_simplified) # generate synthetic observations obs = tigernet.testing_data("WeightedParcels_Leon_FL_2010") # associate observations with the network args = network, obs.copy() kwargs = {"df_name": "obs1", "df_key": "PARCEL_ID", "snap_to": "nodes"} kwargs.update({"restrict_col": "MTFCC"}) kwargs.update({"remove_restricted": ["S1100", "S1630", "S1640"]}) self.net_obs = tigernet.Observations(*args, **kwargs)
def setUp(self): self.network = copy.deepcopy(network_lattice_1x1_small) # generate synthetic observations pts = [Point(1, 1), Point(3, 1), Point(1, 3), Point(3, 3)] obs = geopandas.GeoDataFrame({"obs_id": ["a", "b", "c", "d"]}, geometry=pts) # associate observations with the network args = self.network, obs.copy() kwargs = {"df_name": "obs1", "df_key": "obs_id"} self.net_obs = tigernet.Observations(*args, **kwargs)
def setUp(self): network = copy.deepcopy(network_empirical_simplified) # generate synthetic observations ---------------------------------------- 1 self.obs1 = tigernet.testing_data("WeightedParcels_Leon_FL_2010") # associate observations with the network args = network, self.obs1.copy() kwargs = {"df_name": "obs1", "df_key": "PARCEL_ID", "snap_to": "segments"} kwargs.update({"obs_pop": "SUM_EST_PO", "restrict_col": "MTFCC"}) kwargs.update({"remove_restricted": ["S1100", "S1630", "S1640"]}) self.net_obs1 = tigernet.Observations(*args, **kwargs) # generate synthetic observations ---------------------------------------- 2 self.obs2 = tigernet.testing_data("CensusBlocks_Leon_FL_2010") # associate observations with the network args = network, self.obs2.copy() kwargs = {"df_name": "obs2", "df_key": "GEOID", "snap_to": "segments"} kwargs.update({"obs_pop": "POP100", "restrict_col": "MTFCC"}) kwargs.update({"remove_restricted": ["S1100", "S1630", "S1640"]}) self.net_obs2 = tigernet.Observations(*args, **kwargs)
def setUp(self): network = copy.deepcopy(network_empirical_simplified) # generate synthetic observations obs = tigernet.generate_obs(500, network.s_data) obs["obs_id"] = obs.index # associate observations with the network args = network, obs.copy() kwargs = {"df_name": "obs1", "df_key": "obs_id", "snap_to": "nodes"} kwargs.update({"restrict_col": "MTFCC"}) kwargs.update({"remove_restricted": ["S1100", "S1630", "S1640"]}) self.net_obs = tigernet.Observations(*args, **kwargs)
def setUp(self): network = copy.deepcopy(network_lattice_1x1_geomelem) network.s_data.loc[1, "MTFCC"] = "S1100" network.s_data.loc[3, "MTFCC"] = "S1100" # generate synthetic observations obs = tigernet.generate_obs(5, network.s_data) obs["obs_id"] = ["a", "b", "c", "d", "e"] # associate observations with the network args = network, obs.copy() kwargs = {"df_name": "obs1", "df_key": "obs_id", "snap_to": "nodes"} kwargs.update({"restrict_col": "MTFCC"}) kwargs.update({"remove_restricted": ["S1100", "S1630", "S1640"]}) self.net_obs = tigernet.Observations(*args, **kwargs)
def test_bad_snap_to(self): network = copy.deepcopy(network_lattice_1x1_geomelem) with self.assertRaises(ValueError): tigernet.Observations(network, None, None, snap_to="network")
def test_no_segm2geom(self): network = copy.deepcopy(network_lattice_1x1_no_args) with self.assertRaises(AttributeError): tigernet.Observations(network, None, None)