Commit 9ff45aa9 authored by Amaury BARRAL's avatar Amaury BARRAL

color single bird

parent 81228b9d
......@@ -66,6 +66,7 @@ drawable_to_data = {
"group_size": ["group_size"],
"group_size_avg": ["group_size_avg"],
"group_size_avg_fit": ["group_size_avg_fit"],
"evolution_group_size": ["group_size", "groups"],
}
......@@ -111,6 +112,8 @@ class Visualiser:
self.options["animation"] = True
if "quiver_color_by_group" not in self.options:
self.options["quiver_color_by_group"] = False
if "quiver_color_single" not in self.options:
self.options["quiver_color_single"] = False
if "quiver_draw_by_group" not in self.options:
self.options["quiver_draw_by_group"] = False
if "groups_num_ymin" not in self.options:
......@@ -144,6 +147,7 @@ class Visualiser:
self.to_draw["group_size"] = "group_size" in to_draw
self.to_draw["group_size_avg"] = "group_size_avg" in to_draw
self.to_draw["group_size_avg_fit"] = "group_size_avg_fit" in to_draw
self.to_draw["evolution_group_size"] = "evolution_group_size" in to_draw
keys_to_draw = [k for k, v in self.to_draw.items() if v]
log.info("The following properties will be drawn: %s" % keys_to_draw)
......@@ -364,6 +368,9 @@ class Visualiser:
quiver_colors = []
for bird_group in groups:
quiver_colors.append(self.group_colors[bird_group % len(self.group_colors)])
elif self.options["quiver_color_single"]:
quiver_colors = np.zeros(positions.shape[0])
quiver_colors[0] = 1
else:
quiver_colors = self.norm(angles)
......
......@@ -9,6 +9,7 @@ from God.Bird import Bird
from God.Pandora import NumpyEncoder
from God.Sky import Sky
def read_in_chunks(file_object, chunk_size=1024*1000*100):
"""Lazy function (generator) to read a file piece by piece.
Default chunk size: 100M."""
......@@ -18,6 +19,7 @@ def read_in_chunks(file_object, chunk_size=1024*1000*100):
break
yield data
def make_path_available(path: str) -> None:
pathlib.Path(os.path.dirname(path)).mkdir(parents=True, exist_ok=True)
......
......@@ -47,12 +47,12 @@ Processor().process("simulation_data/test.json", "processing_data/test", verbose
options={"correlations_stochastic_points": 5000})
to_draw = ["avg_speed", "avg_angle", "avg_polar", "correlations", "correlations_fit", "correlation_length",
"group_size", "group_size_avg", "group_size_avg_fit", "quiver"]
"group_size", "group_size_avg", "group_size_avg_fit", "quiver", "evolution_group_size"]
Visualiser("processing_data/test", "visualisations/test.mp4", simulation_data_file="simulation_data/test.json",
verbose_prop=.1,
to_draw=to_draw,
options={"quiver_color_by_group": False, "quiver_draw_by_group": False, "max_group_size": 5000,
options={"quiver_color_by_group": False, "quiver_draw_by_group": False, "quiver_color_single": True, "max_group_size": 5000,
"max_num_groups": 500}).vizualize()
# N = [10000]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment