Improve rtt image generation
This commit is contained in:
parent
1498f0f9be
commit
0a20cae93f
5
ipmap.py
5
ipmap.py
|
@ -98,6 +98,7 @@ def generate_tiles(parquet_path: Path, tiles_dir: Path, *, tile_size = default_t
|
||||||
print("done")
|
print("done")
|
||||||
|
|
||||||
tiles_per_side = int(math.sqrt(0x100000000)) // tile_size
|
tiles_per_side = int(math.sqrt(0x100000000)) // tile_size
|
||||||
|
rtt_div: float = df.get_column("rtt_us").std() / 4
|
||||||
possible_overlaps = 1
|
possible_overlaps = 1
|
||||||
|
|
||||||
write_tile_p = functools.partial(write_tile, alpha = alpha)
|
write_tile_p = functools.partial(write_tile, alpha = alpha)
|
||||||
|
@ -141,7 +142,7 @@ def generate_tiles(parquet_path: Path, tiles_dir: Path, *, tile_size = default_t
|
||||||
|
|
||||||
if not quiet:
|
if not quiet:
|
||||||
print(f"scaling {len(df)} coords down from {prev_tiles_per_side}x{prev_tiles_per_side} tiles to {tiles_per_side}x{tiles_per_side} tiles...", end = " ", flush = True)
|
print(f"scaling {len(df)} coords down from {prev_tiles_per_side}x{prev_tiles_per_side} tiles to {tiles_per_side}x{tiles_per_side} tiles...", end = " ", flush = True)
|
||||||
df = df.with_columns(x = pl.col("x") // scale, y = pl.col("y") // scale).group_by(["x", "y"]).agg(count = pl.sum("count"), rtt_us = pl.mean("rtt_us")) # maybe using median would be better?
|
df = df.with_columns(x = pl.col("x") // scale, y = pl.col("y") // scale).group_by(["x", "y"]).agg(count = pl.sum("count"), rtt_us = pl.median("rtt_us"))
|
||||||
if not quiet:
|
if not quiet:
|
||||||
print(f"done with {len(df)} coords remaining")
|
print(f"done with {len(df)} coords remaining")
|
||||||
|
|
||||||
|
@ -158,7 +159,7 @@ def generate_tiles(parquet_path: Path, tiles_dir: Path, *, tile_size = default_t
|
||||||
if generate_density:
|
if generate_density:
|
||||||
generate_images(colormap, "density", "count", 256 if possible_overlaps == 1 else possible_overlaps)
|
generate_images(colormap, "density", "count", 256 if possible_overlaps == 1 else possible_overlaps)
|
||||||
if generate_rtt:
|
if generate_rtt:
|
||||||
generate_images(colormap, "rtt", "rtt_us", df.get_column("rtt_us").std() / tiles_per_side.bit_length())
|
generate_images(colormap, "rtt", "rtt_us", rtt_div)
|
||||||
if tiles_per_side == 1:
|
if tiles_per_side == 1:
|
||||||
break
|
break
|
||||||
scale_down_coords()
|
scale_down_coords()
|
||||||
|
|
Loading…
Reference in New Issue