def test_Reached(self): count = mm.Reached(self.df_streets, self.df_buildings, "nID", "nID").series area = mm.Reached( self.df_streets, self.df_buildings, self.df_streets.nID, self.df_buildings.nID, mode="sum", ).series mean = mm.Reached(self.df_streets, self.df_buildings, "nID", "nID", mode="mean").series std = mm.Reached(self.df_streets, self.df_buildings, "nID", "nID", mode="std").series area_v = mm.Reached( self.df_streets, self.df_buildings, "nID", "nID", mode="sum", values="fl_area", ).series mean_v = mm.Reached( self.df_streets, self.df_buildings, "nID", "nID", mode="mean", values="fl_area", ).series std_v = mm.Reached( self.df_streets, self.df_buildings, "nID", "nID", mode="std", values="fl_area", ).series sw = mm.sw_high(k=2, gdf=self.df_streets) count_sw = mm.Reached(self.df_streets, self.df_buildings, "nID", "nID", sw).series assert max(count) == 18 assert max(area) == 18085.45897711331 assert max(count_sw) == 138 assert max(mean) == 1808.5458977113315 assert max(std) == 3153.7019229524785 assert max(area_v) == 79169.31385861784 assert max(mean_v) == 7916.931385861784 assert max(std_v) == 8995.18003493457
def time_Reached_sw(self): mm.Reached(self.df_streets, self.df_buildings, "nID", "nID", self.sws)
blg["mtbSWR"] = mm.SharedWallsRatio(blg, "uID", "sdbPer").series queen_1 = libpysal.weights.contiguity.Queen.from_dataframe(tess, ids="uID") blg["mtbAli"] = mm.Alignment(blg, queen_1, "uID", "stbOri").series blg["mtbNDi"] = mm.NeighbourDistance(blg, queen_1, "uID").series tess["mtcWNe"] = mm.Neighbours(tess, queen_1, "uID", weighted=True).series tess["mdcAre"] = mm.CoveredArea(tess, queen_1, "uID").series str_q1 = libpysal.weights.contiguity.Queen.from_dataframe(streets) streets["misRea"] = mm.Reached(streets, tess, "nID", "nID", spatial_weights=str_q1, mode="count").series streets["mdsAre"] = mm.Reached(streets, tess, "nID", "nID", spatial_weights=str_q1, mode="sum").series blg_q1 = libpysal.weights.contiguity.Queen.from_dataframe(blg) blg["libNCo"] = mm.Courtyards(blg, "bID", blg_q1).series blg["ldbPWL"] = mm.PerimeterWall(blg, blg_q1).series blocks["ldkAre"] = mm.Area(blocks).series
nodes.to_file("files/elements.gpkg", layer="nodes", driver="GPKG") edges.to_file("files/elements.gpkg", layer="edges", driver="GPKG") fo = libpysal.io.open("files/GRnodes.gal", "w") fo.write(sw) fo.close() edges_w3 = mm.sw_high(k=3, gdf=edges) edges["ldsMSL"] = mm.SegmentsLength(edges, spatial_weights=edges_w3, mean=True).series tess = gpd.read_file("files/elements.gpkg", layer="tessellation") edges["ldsRea"] = mm.Reached(edges, tess, "nID", "nID", spatial_weights=edges_w3).series edges["ldsRea"] = mm.Reached(edges, tess, "nID", "nID", spatial_weights=edges_w3, mode="sum", values="sdcAre").series nodes_w5 = mm.sw_high(k=5, weights=sw) nodes["lddNDe"] = mm.NodeDensity(nodes, edges, nodes_w5).series nodes["linWID"] = mm.NodeDensity(nodes, edges, nodes_w5,