Modified main to work with new simulator interface
This commit is contained in:
parent
9beda2231d
commit
37edb9a6e9
55
sw/main.py
55
sw/main.py
@ -7,7 +7,19 @@ from decoders import proximal, maximum_likelihood
|
|||||||
from utility import simulation, codes
|
from utility import simulation, codes
|
||||||
|
|
||||||
|
|
||||||
def simulate_new(sim_mgr: simulation.SimulationManager) -> None:
|
def main():
|
||||||
|
Path("sim_results").mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
|
sim_name = "test"
|
||||||
|
|
||||||
|
sim_mgr = simulation.SimulationManager(results_dir="sim_results", save_dir="sim_saves")
|
||||||
|
|
||||||
|
if sim_mgr.unfinished_simulation_present(sim_name):
|
||||||
|
print("Found unfinished simulation. Picking up where it was left of")
|
||||||
|
|
||||||
|
sim_mgr.load_unfinished(sim_name=sim_name)
|
||||||
|
sim_mgr.simulate()
|
||||||
|
else:
|
||||||
# H = codes.read_alist_file("res/204.3.486.alist")
|
# H = codes.read_alist_file("res/204.3.486.alist")
|
||||||
# H = codes.read_alist_file("res/204.55.187.alist")
|
# H = codes.read_alist_file("res/204.55.187.alist")
|
||||||
# H = codes.read_alist_file("res/96.3.965.alist")
|
# H = codes.read_alist_file("res/96.3.965.alist")
|
||||||
@ -25,41 +37,16 @@ def simulate_new(sim_mgr: simulation.SimulationManager) -> None:
|
|||||||
proximal.ProximalDecoder(H, gamma=0.15)
|
proximal.ProximalDecoder(H, gamma=0.15)
|
||||||
]
|
]
|
||||||
|
|
||||||
sim = simulation.Simulator(n=n, k=k, decoders=decoders, target_frame_errors=100, SNRs=np.arange(1, 6, 0.5))
|
labels = [
|
||||||
sim_mgr.set_simulator(sim)
|
"proximal $\\gamma = 0.01$",
|
||||||
sim_mgr.start()
|
"proximal $\\gamma = 0.05$",
|
||||||
|
"proximal $\\gamma = 0.15$"
|
||||||
|
]
|
||||||
|
|
||||||
SNRs, BERs = sim_mgr.get_current_results()
|
sim = simulation.Simulator(n=n, k=k, decoders=decoders, target_frame_errors=3, SNRs=np.arange(1, 6, 0.5))
|
||||||
|
|
||||||
df = pd.DataFrame({"SNR": SNRs})
|
sim_mgr.configure_simulation(simulator=sim, name=sim_name, column_labels=labels)
|
||||||
df["BER_prox_0_01"] = BERs[0]
|
sim_mgr.simulate()
|
||||||
df["BER_prox_0_05"] = BERs[1]
|
|
||||||
df["BER_prox_0_15"] = BERs[2]
|
|
||||||
|
|
||||||
df.to_csv(f"sim_results/816.1A4.845.csv")
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
Path("sim_results").mkdir(parents=True, exist_ok=True)
|
|
||||||
|
|
||||||
sim_mgr = simulation.SimulationManager(results_dir="sim_results", save_dir="sim_saves")
|
|
||||||
|
|
||||||
if sim_mgr.unfinished_simulation_present():
|
|
||||||
print("Found unfinished simulation. Picking up where it was left of")
|
|
||||||
sim_mgr.load_unfinished()
|
|
||||||
sim_mgr.start()
|
|
||||||
|
|
||||||
SNRs, BERs = sim_mgr.get_current_results()
|
|
||||||
|
|
||||||
df = pd.DataFrame({"SNR": SNRs})
|
|
||||||
# df["ML"] = BERs[0]
|
|
||||||
df["decoder0"] = BERs[0]
|
|
||||||
df["decoder1"] = BERs[1]
|
|
||||||
df["decoder2"] = BERs[2]
|
|
||||||
|
|
||||||
df.to_csv(f"sim_results/paused.csv")
|
|
||||||
else:
|
|
||||||
simulate_new(sim_mgr)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user