Commit 29853b3c authored by Quentin LOUIS's avatar Quentin LOUIS

Modified multiple machine script

parent f9fa10f1
......@@ -13,7 +13,7 @@ from God.Sky import Sky
# init dropbox
try:
dbx = dropbox.Dropbox('token ici')
dbx = dropbox.Dropbox('WBOMqrQ2sMAAAAAAAAAA0YgSejHTbbc1ZnZRdZfFDoKd3TqQD7U8lVVTHHLi4GcO')
dbx.users_get_current_account()
except:
print("Dropbox loading failed")
......
......@@ -44,49 +44,48 @@ def launch_two_groups(output_file: str, L: float, n_birds_1: int, n_birds_2: int
Life.simulate(physics, dt, total_time, verbose_prop=.1, output_file=output_file)
def start_experiment(output_name: str, L: float, n_birds: int, eta: float = .5, total_time: float = 100) -> None:
launch_simulation_random(f"simulation_data/{output_name}.json", L=L, n_birds=n_birds, eta=eta,
total_time=total_time)
to_process = ["avg_speed", "avg_angle", "group_size", "group_size_avg", "group_size_avg_fit", "groups",
"correlations",
"correlations_fit", "group_to_size", "group_hulls"]
Processor().process("simulation_data/test-machine.json", "processing_data/test-machine", verbose_prop=.1,
to_process=to_process,
options={"correlations_stochastic_points": 5000})
to_draw = ["avg_speed", "avg_angle", "avg_polar", "angle_pdf", "correlations", "correlations_fit",
"correlation_length",
"group_size", "group_size_avg", "group_size_avg_fit", "group_dimension", "group_dimension_avg", "quiver",
"evolution_group_size"]
Visualiser("processing_data/test-machine", "visualisations/test-machine.mp4",
simulation_data_file="simulation_data/test-machine.json",
verbose_prop=.1,
to_draw=to_draw,
options={"quiver_color_by_group": True, "quiver_draw_by_group": True, "quiver_color_single": True,
"max_group_size": 5000,
"max_num_groups": 50000}).vizualize()
def start_experiment(output_dir: str, L: float, n_birds: int, eta: float = .5, total_time:
float = 100, nb_experiments: int = 1, vel: float = 0.1) -> None:
for i in range(nb_experiments):
name = "N_" + str(n_birds) + "_L_" + str(L) + "_Eta_" + str(eta) + "_angle_vel_" + "pi" + "_T_" + str(total_time) \
+ "_vel_" + str(vel) + "_nb_exp_" + str(nb_experiments)
launch_simulation_random("phy571/simulation_data/" + output_dir + "/" + name + ".json", L=L, n_birds=n_birds, eta=eta,
total_time=total_time, ang_vel= 2*np.pi)
to_process = ["avg_speed", "avg_angle", "group_size", "group_size_avg", "group_size_avg_fit", "groups",
"correlations",
"correlations_fit", "group_to_size", "group_hulls"]
Processor().process("phy571/simulation_data/" + output_dir + "/" + name + ".json", "phy571/processing_data/" +
output_dir + "/" + name, verbose_prop=.1,
to_process=to_process,
options={"correlations_stochastic_points": 5000})
def ssh_experiments():
addresses = ["0000.000.000.00"]
login, passw = "", ""
addresses = ["ablette, anchois, anguille, barbeau, barbue, baudroie, brochet, carrelet, gardon, gymnote, labre, "
"lieu, lotte, mulet, murene, piranha, raie, requin, "
"rouget, roussette, saumon, silure, sole, thon, truite"]
login, passw = "quentin.louis", "Ri6elM1/1"
Ns = [10, 100]
ts = [10, 15]
l = 10
ls = [10, 15]
t = 10
eta = .5
file = "test"
vel = 0.1
nb_exp = 1
current_server = -1
for n in Ns:
for t in ts:
for l in ls:
current_server += 1
current_server_ip = addresses[current_server % len(addresses)]
ssh = paramiko.SSHClient()
ssh.connect(current_server_ip, username=login, password=passw)
ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command(
f"./python3.6 remote.py --n {n} --l {l} --eta {eta} --t {t}")
f"./phy571-birds-flocking/venv/bin/python3.6 remote.py --file {file} --n {n} --l {l} --eta {eta} "
f"--t {t} --nb_exp {nb_exp} --vel {vel}")
log.info(f"server: {current_server_ip}, stdin: {ssh_stdin}, stdout: {ssh_stdout}, stderr: {ssh_stderr}")
......
......@@ -10,14 +10,17 @@ log.setLevel(logging.INFO)
@click.command()
@click.option('--file', help="output_dir", type=str)
@click.option('--n', help="number of birds", type=int)
@click.option('--l', help="size of sky", type=float)
@click.option('--eta', help="noise", type=float)
@click.option('--t', help="simulation time", type=float)
def main(n, l, eta, t):
@click.option('--nb_exp', help="number of experiments", type=int)
@click.option('--vel', help="velocity", type=float)
def main(file, n, l, eta, t, nb_exp, vel):
name = f"N_{n}_L_{l}_Eta_{eta}_T_{t}"
log.info(f"Starting remote experiment {name}")
start_experiment(name, l, n, eta, t)
start_experiment(file, l, n, eta, t, nb_exp, vel)
if __name__ == "__main__":
......
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