def test_Count(self): eib = mm.Count(self.blocks, self.df_buildings, "bID", "bID").series weib = mm.Count( self.blocks, self.df_buildings, "bID", "bID", weighted=True ).series weis = mm.Count( self.df_streets, self.df_buildings, "nID", "nID", weighted=True ).series check_eib = [13, 14, 8, 26, 24, 17, 23, 19] check_weib = 0.00040170607189453996 assert eib.tolist() == check_eib assert weib.mean() == check_weib assert weis.mean() == 0.020524232642849215
def time_Count(self): mm.Count(self.blocks, self.df_buildings, "bID", "bID")
def time_Count_weighted(self): mm.Count(self.blocks, self.df_buildings, "bID", "bID", weighted=True)
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 blocks["ldkPer"] = mm.Perimeter(blocks).series blocks["lskCCo"] = mm.CircularCompactness(blocks, "ldkAre").series blocks["lskERI"] = mm.EquivalentRectangularIndex(blocks, "ldkAre", "ldkPer").series blocks["lskCWA"] = mm.CompactnessWeightedAxis(blocks, "ldkAre", "ldkPer").series blocks["ltkOri"] = mm.Orientation(blocks).series blo_q1 = libpysal.weights.contiguity.Queen.from_dataframe(blocks, ids="bID") blocks["ltkWNB"] = mm.Neighbors(blocks, blo_q1, "bID", weighted=True).series blocks["likWBB"] = mm.Count(blocks, blg, "bID", "bID", weighted=True).series tess.to_file("files/elements.gpkg", layer="tessellation", driver="GPKG") blg.to_file("files/elements.gpkg", layer="buildings", driver="GPKG") blocks.to_file("files/elements.gpkg", layer="blocks", driver="GPKG") streets.to_file("files/elements.gpkg", layer="streets", driver="GPKG")