From 6f2940947e4d0cb64f343e730502b046ec8aab78 Mon Sep 17 00:00:00 2001 From: Daniel Seiller Date: Wed, 23 Oct 2019 11:36:45 +0200 Subject: [PATCH] chore(formatting): ran black to format sources --- build_gui.py | 2 +- ed_lrr_gui/config.py | 25 +- ed_lrr_gui/gui/main.py | 16 +- ed_lrr_gui/html_export.py | 1026 ++++++++++++++++++++++++++++++++++-- ed_lrr_gui/web/__main__.py | 95 ++-- icon/make.py | 174 +++--- 6 files changed, 1172 insertions(+), 166 deletions(-) diff --git a/build_gui.py b/build_gui.py index 14d87fe..c7aba5e 100644 --- a/build_gui.py +++ b/build_gui.py @@ -12,5 +12,5 @@ for root, folders, files in os.walk(ui_path): outfile, ext = os.path.splitext(file) if ext == ".ui": outfile = outfile + ".py" - print(file,"->",outfile) + print(file, "->", outfile) SP.check_call(["pyuic5", "--from-imports", "-o", outfile, file]) diff --git a/ed_lrr_gui/config.py b/ed_lrr_gui/config.py index 605d3e6..cc8af19 100644 --- a/ed_lrr_gui/config.py +++ b/ed_lrr_gui/config.py @@ -11,22 +11,35 @@ config_file.touch() cfg = profig.Config(str(config_file), strict=True) -cfg.init("history.bodies_url", ["https://www.edsm.net/dump/bodies.json"], "path_list", comment="history of bodies.json urls") -cfg.init("history.systems_url", ["https://www.edsm.net/dump/systemsWithCoordinates.json"], "path_list", comment="history of systems.json urls") +cfg.init( + "history.bodies_url", + ["https://www.edsm.net/dump/bodies.json"], + "path_list", + comment="history of bodies.json urls", +) +cfg.init( + "history.systems_url", + ["https://www.edsm.net/dump/systemsWithCoordinates.json"], + "path_list", + comment="history of systems.json urls", +) cfg.init( "history.bodies_path", - [os.path.join(config_dir, "data","bodies.json")], + [os.path.join(config_dir, "data", "bodies.json")], "path_list", comment="history of bodies.json download paths", ) cfg.init( "history.systems_path", - [os.path.join(config_dir, "data","systemsWithCoordinates.json")], + [os.path.join(config_dir, "data", "systemsWithCoordinates.json")], "path_list", comment="history of systems.json download paths", ) cfg.init( - "history.stars_csv_path", [os.path.join(config_dir, "data","stars.csv")], "path_list", comment="history of paths for stars.csv" + "history.stars_csv_path", + [os.path.join(config_dir, "data", "stars.csv")], + "path_list", + comment="history of paths for stars.csv", ) cfg.init("route.range", 7.56, comment="jump range") cfg.init("route.primary", False, comment="only route through primary stars") @@ -40,7 +53,7 @@ cfg.init("route.prune.steps", 5, comment="number of steps before path gets prune cfg.init("route.greediness", 0.5, comment="A* greediness") cfg.init("folders.data_dir", os.path.join(config_dir, "data"), comment="Data directory") -cfg.init("GUI.theme", 'dark', comment="GUI theme to use") +cfg.init("GUI.theme", "dark", comment="GUI theme to use") cfg.sync() diff --git a/ed_lrr_gui/gui/main.py b/ed_lrr_gui/gui/main.py index 5fe8fa6..6901fa1 100644 --- a/ed_lrr_gui/gui/main.py +++ b/ed_lrr_gui/gui/main.py @@ -114,8 +114,8 @@ class PreprocessJob(Job): self.start() def handle_progess(self, state): - sent=object() - if state.get("return",sent)!=sent: + sent = object() + if state.get("return", sent) != sent: self.progress_dialog.close() return msg = "Processed: {}/{}".format( @@ -142,12 +142,12 @@ class RouterJob(Job): self.progress_dialog.canceled.connect(self.cancel) self.progress_dialog.show() self.start() - self.state={} + self.state = {} def handle_progess(self, state): - sent=object() - if state.get("return",sent)!=sent: - print(state['return']) + sent = object() + if state.get("return", sent) != sent: + print(state["return"]) self.progress_dialog.close() route_win = WRoute(self.main_window, state["return"]) return @@ -249,7 +249,7 @@ class App(QApplication): class WRoute(Ui_diag_route): def __init__(self, main_window, hops): super().__init__() - self.route=hops + self.route = hops dialog = QDialog(main_window) self.setupUi(dialog) for n, item in enumerate(hops): @@ -262,7 +262,7 @@ class WRoute(Ui_diag_route): item["system"], "{body} ({star_type})".format(**item), str(item["distance"]), - "", # Jump distance + "", # Jump distance ], ) item.setFlags(item.flags() & ~Qt.ItemIsDropEnabled) diff --git a/ed_lrr_gui/html_export.py b/ed_lrr_gui/html_export.py index e17bec4..e790e6f 100644 --- a/ed_lrr_gui/html_export.py +++ b/ed_lrr_gui/html_export.py @@ -1,44 +1,1000 @@ import jinja2 import os -tmpl_path=os.path.join(os.path.dirname(__file__),"html_export_template.html.jinja2") -def dist(p1,p2): - s=0 - for c1,c2 in zip(p1,p2): - s+=(c1-c2)**2 - return s**0.5 +tmpl_path = os.path.join(os.path.dirname(__file__), "html_export_template.html.jinja2") -colors={ - 'O': '#0000FF', - 'B': '#140AF0', - 'A': '#3C1EDC', - 'F': '#EEEEEE', - 'G': '#969646', - 'K': '#B43C1E', - 'M': '#FF280A', - 'L': '#FF1E00', - 'T': '#800000', - 'Y': '#800000', - 'White Dwarf':'#5D67EF', - 'Neutron':'#99A0FF', + +def dist(p1, p2): + s = 0 + for c1, c2 in zip(p1, p2): + s += (c1 - c2) ** 2 + return s ** 0.5 + + +colors = { + "O": "#0000FF", + "B": "#140AF0", + "A": "#3C1EDC", + "F": "#EEEEEE", + "G": "#969646", + "K": "#B43C1E", + "M": "#FF280A", + "L": "#FF1E00", + "T": "#800000", + "Y": "#800000", + "White Dwarf": "#5D67EF", + "Neutron": "#99A0FF", } -route=[{'star_type': 'F (White) Star', 'system': 'Ix', 'body': 'Ix', 'distance': 0, 'pos': [-65.21875, 7.75, -111.03125]}, {'star_type': 'Neutron Star', 'system': '18 Camelopardalis', 'body': '18 Camelopardalis C', 'distance': 90212, 'pos': [-57.9375, 31.96875, -122.5625]}, {'star_type': 'K (Yellow-Orange giant) Star', 'system': 'HIP 4024', 'body': 'HIP 4024', 'distance': 0, 'pos': [-22.09375, -122.65625, -15.96875]}, {'star_type': 'M (Red dwarf) Star', 'system': 'Ceti Sector XU-P b5-2', 'body': 'Ceti Sector XU-P b5-2', 'distance': 0, 'pos': [-17.78125, -156.375, 16.0]}, {'star_type': 'Neutron Star', 'system': 'Beta Sculptoris', 'body': 'Beta Sculptoris B', 'distance': 1669, 'pos': [4.875, -164.53125, 56.5625]}, {'star_type': 'Neutron Star', 'system': 'Rukbat', 'body': 'Rukbat B', 'distance': 270382, 'pos': [5.75, -73.0625, 166.375]}, {'star_type': 'Neutron Star', 'system': '53 Sagittarii', 'body': '53 Sagittarii C', 'distance': 39573, 'pos': [-86.75, -116.625, 287.3125]}, {'star_type': 'Neutron Star', 'system': '3 Capricorni', 'body': '3 Capricorni C', 'distance': 9867, 'pos': [-210.53125, -186.59375, 342.40625]}, {'star_type': 'Neutron Star', 'system': '68 Aquilae', 'body': '68 Aquilae B', 'distance': 593, 'pos': [-368.78125, -240.84375, 411.65625]}, {'star_type': 'Neutron Star', 'system': 'HIP 99600', 'body': 'HIP 99600 C', 'distance': 15368, 'pos': [-532.34375, -211.875, 494.375]}, {'star_type': 'Neutron Star', 'system': 'Col 359 Sector CG-O d6-7', 'body': 'Col 359 Sector CG-O d6-7', 'distance': 0, 'pos': [-534.875, -182.375, 667.28125]}, {'star_type': 'Neutron Star', 'system': 'Col 359 Sector IC-M d7-13', 'body': 'Col 359 Sector IC-M d7-13 A', 'distance': 0, 'pos': [-659.6875, -274.84375, 774.15625]}, {'star_type': 'F (White) Star', 'system': 'Swoiwns UK-M d8-16', 'body': 'Swoiwns UK-M d8-16', 'distance': 0, 'pos': [-656.75, -276.25, 963.90625]}, {'star_type': 'Neutron Star', 'system': 'Swoiwns SP-M d8-57', 'body': 'Swoiwns SP-M d8-57 A', 'distance': 0, 'pos': [-665.28125, -238.15625, 991.21875]}, {'star_type': 'M (Red dwarf) Star', 'system': 'Swoiwns WC-K b41-2', 'body': 'Swoiwns WC-K b41-2', 'distance': 0, 'pos': [-814.75, -266.4375, 1104.25]}, {'star_type': 'Neutron Star', 'system': 'HD 184180', 'body': 'HD 184180 B', 'distance': 27, 'pos': [-847.53125, -250.84375, 1108.9375]}, {'star_type': 'Neutron Star', 'system': 'HD 187168', 'body': 'HD 187168 B', 'distance': 1901, 'pos': [-883.84375, -357.0625, 1118.0]}, {'star_type': 'A (Blue-White) Star', 'system': 'Swoiwns GT-G d11-7', 'body': 'Swoiwns GT-G d11-7 A', 'distance': 0, 'pos': [-970.25, -496.8125, 1179.34375]}, {'star_type': 'F (White) Star', 'system': 'Swoiwns IO-G d11-13', 'body': 'Swoiwns IO-G d11-13', 'distance': 0, 'pos': [-987.3125, -538.09375, 1181.4375]}, {'star_type': 'M (Red dwarf) Star', 'system': 'Swoiwns QC-N c22-3', 'body': 'Swoiwns QC-N c22-3 A', 'distance': 0, 'pos': [-1007.375, -576.59375, 1177.5]}, {'star_type': 'Neutron Star', 'system': 'Swoiwns KJ-G d11-14', 'body': 'Swoiwns KJ-G d11-14', 'distance': 0, 'pos': [-989.90625, -595.34375, 1199.25]}, {'star_type': 'Neutron Star', 'system': 'Swoiwns KE-G d11-6', 'body': 'Swoiwns KE-G d11-6 A', 'distance': 0, 'pos': [-1112.3125, -719.0, 1231.59375]}, {'star_type': 'Neutron Star', 'system': 'Swoiwns SA-E d12-6', 'body': 'Swoiwns SA-E d12-6 A', 'distance': 0, 'pos': [-1140.4375, -880.90625, 1285.375]}, {'star_type': 'Neutron Star', 'system': 'Swoiwns VQ-D d12-1', 'body': 'Swoiwns VQ-D d12-1 A', 'distance': 0, 'pos': [-1239.5, -1007.59375, 1331.21875]}, {'star_type': 'Neutron Star', 'system': 'Prooe Drye RD-A d14-3', 'body': 'Prooe Drye RD-A d14-3', 'distance': 0, 'pos': [-1401.78125, -1061.375, 1415.75]}, {'star_type': 'Neutron Star', 'system': 'Aucopp HP-A d6', 'body': 'Aucopp HP-A d6', 'distance': 0, 'pos': [-1554.03125, -1057.09375, 1525.875]}, {'star_type': 'Neutron Star', 'system': 'Aucopp IL-Y e0', 'body': 'Aucopp IL-Y e0 B', 'distance': 236942, 'pos': [-1635.21875, -1118.84375, 1661.21875]}, {'star_type': 'Neutron Star', 'system': 'Aucopp RH-V d2-7', 'body': 'Aucopp RH-V d2-7', 'distance': 0, 'pos': [-1741.25, -1040.6875, 1778.28125]}, {'star_type': 'Neutron Star', 'system': 'Aucopp ZO-R d4-5', 'body': 'Aucopp ZO-R d4-5 A', 'distance': 0, 'pos': [-1840.09375, -1076.59375, 1911.125]}, {'star_type': 'Neutron Star', 'system': 'Aucopp OX-U e2-0', 'body': 'Aucopp OX-U e2-0', 'distance': 0, 'pos': [-1849.09375, -1103.5625, 2097.09375]}, {'star_type': 'Neutron Star', 'system': 'Aucopp MS-K d8-0', 'body': 'Aucopp MS-K d8-0 A', 'distance': 0, 'pos': [-1979.75, -1052.34375, 2226.71875]}, {'star_type': 'Neutron Star', 'system': 'Aucopp VZ-G d10-3', 'body': 'Aucopp VZ-G d10-3 A', 'distance': 0, 'pos': [-2057.65625, -1127.40625, 2381.375]}, {'star_type': 'Neutron Star', 'system': 'Aucopp CM-D d12-0', 'body': 'Aucopp CM-D d12-0 A', 'distance': 0, 'pos': [-2136.03125, -1135.1875, 2547.53125]}, {'star_type': 'Neutron Star', 'system': 'Aucopp JY-Z d13-6', 'body': 'Aucopp JY-Z d13-6', 'distance': 0, 'pos': [-2222.65625, -1104.75, 2714.71875]}, {'star_type': 'Neutron Star', 'system': 'Drojeae CV-Y d8', 'body': 'Drojeae CV-Y d8', 'distance': 0, 'pos': [-2290.5, -1060.5, 2881.40625]}, {'star_type': 'Neutron Star', 'system': 'Drojeae LC-V d2-0', 'body': 'Drojeae LC-V d2-0 A', 'distance': 0, 'pos': [-2377.71875, -1131.625, 3024.8125]}, {'star_type': 'Neutron Star', 'system': 'Drojeae SO-R d4-1', 'body': 'Drojeae SO-R d4-1', 'distance': 0, 'pos': [-2424.40625, -1067.625, 3199.59375]}, {'star_type': 'Neutron Star', 'system': 'Drojeae XF-O d6-1', 'body': 'Drojeae XF-O d6-1', 'distance': 0, 'pos': [-2542.5625, -1061.3125, 3343.25]}, {'star_type': 'Neutron Star', 'system': 'Drojo VN-K d8-5', 'body': 'Drojo VN-K d8-5', 'distance': 0, 'pos': [-2628.125, -1074.40625, 3511.4375]}, {'star_type': 'Neutron Star', 'system': 'Drojeae PZ-G d10-3', 'body': 'Drojeae PZ-G d10-3 A', 'distance': 0, 'pos': [-2535.71875, -1121.9375, 3664.3125]}, {'star_type': 'Neutron Star', 'system': 'Drojeae UQ-D d12-4', 'body': 'Drojeae UQ-D d12-4 A', 'distance': 0, 'pos': [-2574.0, -1062.40625, 3836.1875]}, {'star_type': 'Neutron Star', 'system': 'Drojeae EY-Z d13-3', 'body': 'Drojeae EY-Z d13-3 A', 'distance': 0, 'pos': [-2570.65625, -1081.65625, 4024.4375]}, {'star_type': 'Neutron Star', 'system': 'Blae Drye YU-Y d5', 'body': 'Blae Drye YU-Y d5', 'distance': 0, 'pos': [-2614.1875, -1046.90625, 4185.125]}, {'star_type': 'Neutron Star', 'system': 'Thailoi VH-V d2-6', 'body': 'Thailoi VH-V d2-6', 'distance': 0, 'pos': [-2664.0625, -1044.5625, 4366.71875]}, {'star_type': 'Neutron Star', 'system': 'Thailoi DP-R d4-8', 'body': 'Thailoi DP-R d4-8', 'distance': 0, 'pos': [-2796.4375, -1080.375, 4491.90625]}, {'star_type': 'Neutron Star', 'system': 'Thailoi MB-O d6-5', 'body': 'Thailoi MB-O d6-5 A', 'distance': 0, 'pos': [-2758.75, -1096.5625, 4672.21875]}, {'star_type': 'Neutron Star', 'system': 'Thailoi XT-I d9-1', 'body': 'Thailoi XT-I d9-1 A', 'distance': 0, 'pos': [-2788.84375, -1115.1875, 4858.53125]}, {'star_type': 'Neutron Star', 'system': 'Thailoi GG-F d11-3', 'body': 'Thailoi GG-F d11-3', 'distance': 0, 'pos': [-2731.46875, -1093.25, 5034.46875]}, {'star_type': 'Neutron Star', 'system': 'Thailoi MX-B d13-14', 'body': 'Thailoi MX-B d13-14', 'distance': 0, 'pos': [-2761.1875, -1059.65625, 5217.21875]}, {'star_type': 'Neutron Star', 'system': 'Pyraleau IP-A d5', 'body': 'Pyraleau IP-A d5', 'distance': 0, 'pos': [-2757.46875, -1030.96875, 5406.625]}, {'star_type': 'Neutron Star', 'system': 'Pyraleau WC-V d2-8', 'body': 'Pyraleau WC-V d2-8 A', 'distance': 0, 'pos': [-2783.15625, -1084.0, 5588.78125]}, {'star_type': 'Neutron Star', 'system': 'Pyraleau DP-R d4-3', 'body': 'Pyraleau DP-R d4-3', 'distance': 0, 'pos': [-2836.5, -1111.5, 5757.3125]}, {'star_type': 'Neutron Star', 'system': 'Pyraleau KB-O d6-10', 'body': 'Pyraleau KB-O d6-10', 'distance': 0, 'pos': [-2897.9375, -1096.4375, 5928.53125]}, {'star_type': 'Neutron Star', 'system': 'Pyraleau SN-K d8-0', 'body': 'Pyraleau SN-K d8-0', 'distance': 0, 'pos': [-2925.28125, -1123.90625, 6106.71875]}, {'star_type': 'Neutron Star', 'system': 'Pyraleau ZZ-G d10-7', 'body': 'Pyraleau ZZ-G d10-7', 'distance': 0, 'pos': [-2950.84375, -1113.15625, 6289.15625]}, {'star_type': 'Neutron Star', 'system': 'Pyraleau GM-D d12-8', 'body': 'Pyraleau GM-D d12-8 A', 'distance': 0, 'pos': [-3073.53125, -1138.15625, 6431.0625]}, {'star_type': 'Neutron Star', 'system': 'Pyraleau PT-Z d13-8', 'body': 'Pyraleau PT-Z d13-8', 'distance': 0, 'pos': [-3143.46875, -1154.5, 6599.71875]}, {'star_type': 'Neutron Star', 'system': 'Nyeajaae KL-Y d1', 'body': 'Nyeajaae KL-Y d1', 'distance': 0, 'pos': [-3228.375, -1173.59375, 6757.78125]}, {'star_type': 'Neutron Star', 'system': 'Nyeajaae UI-T d3-1', 'body': 'Nyeajaae UI-T d3-1 A', 'distance': 0, 'pos': [-3250.09375, -1137.59375, 6936.71875]}, {'star_type': 'Neutron Star', 'system': 'Nyeajaae WO-R d4-0', 'body': 'Nyeajaae WO-R d4-0', 'distance': 0, 'pos': [-3354.8125, -1108.34375, 7094.65625]}, {'star_type': 'Neutron Star', 'system': 'Nyeajaae IH-M d7-5', 'body': 'Nyeajaae IH-M d7-5 A', 'distance': 0, 'pos': [-3417.0, -1139.09375, 7260.09375]}, {'star_type': 'Neutron Star', 'system': 'Nyeajaae PT-I d9-3', 'body': 'Nyeajaae PT-I d9-3', 'distance': 0, 'pos': [-3485.6875, -1144.21875, 7430.28125]}, {'star_type': 'Neutron Star', 'system': 'Nyeajaae VF-F d11-2', 'body': 'Nyeajaae VF-F d11-2 A', 'distance': 0, 'pos': [-3600.21875, -1137.9375, 7582.625]}, {'star_type': 'Neutron Star', 'system': 'Nyeajaae YL-D d12-12', 'body': 'Nyeajaae YL-D d12-12 A', 'distance': 0, 'pos': [-3735.65625, -1133.53125, 7716.8125]}, {'star_type': 'Neutron Star', 'system': 'Nyeajaae EY-Z d13-0', 'body': 'Nyeajaae EY-Z d13-0', 'distance': 0, 'pos': [-3858.5625, -1090.625, 7851.875]}, {'star_type': 'Neutron Star', 'system': 'Flyiedge PQ-Y d8', 'body': 'Flyiedge PQ-Y d8 A', 'distance': 0, 'pos': [-3909.71875, -1078.46875, 8035.65625]}, {'star_type': 'Neutron Star', 'system': 'Flyiedge XC-V d2-16', 'body': 'Flyiedge XC-V d2-16 A', 'distance': 0, 'pos': [-3984.84375, -1092.5, 8204.46875]}, {'star_type': 'Neutron Star', 'system': 'Flyiedge EP-R d4-3', 'body': 'Flyiedge EP-R d4-3', 'distance': 0, 'pos': [-4055.96875, -1086.71875, 8366.0625]}, {'star_type': 'Neutron Star', 'system': 'Flyiedge PH-M d7-17', 'body': 'Flyiedge PH-M d7-17 A', 'distance': 0, 'pos': [-4091.84375, -1074.125, 8547.46875]}, {'star_type': 'Neutron Star', 'system': 'Flyiedge SN-K d8-20', 'body': 'Flyiedge SN-K d8-20', 'distance': 0, 'pos': [-4213.84375, -1107.21875, 8686.3125]}, {'star_type': 'Neutron Star', 'system': 'Flyiedge DG-F d11-22', 'body': 'Flyiedge DG-F d11-22', 'distance': 0, 'pos': [-4267.0625, -1139.0625, 8859.75]}, {'star_type': 'Neutron Star', 'system': 'Flyiedge KS-B d13-53', 'body': 'Flyiedge KS-B d13-53 A', 'distance': 0, 'pos': [-4305.25, -1101.15625, 9041.0]}, {'star_type': 'Neutron Star', 'system': 'Skaude GK-A d17', 'body': 'Skaude GK-A d17 A', 'distance': 0, 'pos': [-4329.59375, -1097.03125, 9222.90625]}, {'star_type': 'Neutron Star', 'system': 'Skaude LB-X d1-27', 'body': 'Skaude LB-X d1-27', 'distance': 0, 'pos': [-4429.28125, -1046.4375, 9374.21875]}, {'star_type': 'Neutron Star', 'system': 'Skaude KR-W e1-5', 'body': 'Skaude KR-W e1-5', 'distance': 0, 'pos': [-4494.875, -1064.8125, 9548.1875]}, {'star_type': 'Neutron Star', 'system': 'Skaude AA-Q d5-60', 'body': 'Skaude AA-Q d5-60 A', 'distance': 0, 'pos': [-4528.8125, -1059.53125, 9734.78125]}, {'star_type': 'Neutron Star', 'system': 'Skaude LS-K d8-0', 'body': 'Skaude LS-K d8-0 A', 'distance': 0, 'pos': [-4611.90625, -1064.71875, 9902.3125]}, {'star_type': 'Neutron Star', 'system': 'Skaude SE-H d10-0', 'body': 'Skaude SE-H d10-0 A', 'distance': 0, 'pos': [-4697.96875, -1051.0625, 10069.53125]}, {'star_type': 'Neutron Star', 'system': 'Skaude YQ-D d12-11', 'body': 'Skaude YQ-D d12-11', 'distance': 0, 'pos': [-4788.53125, -1064.34375, 10235.8125]}, {'star_type': 'Neutron Star', 'system': 'Skaude FD-A d14-51', 'body': 'Skaude FD-A d14-51 A', 'distance': 0, 'pos': [-4896.46875, -1063.03125, 10394.53125]}, {'star_type': 'Neutron Star', 'system': 'Preia Phoe AV-Y d54', 'body': 'Preia Phoe AV-Y d54', 'distance': 0, 'pos': [-4988.53125, -1028.5, 10557.59375]}, {'star_type': 'Neutron Star', 'system': 'Preia Phoe CL-Y e7', 'body': 'Preia Phoe CL-Y e7 A', 'distance': 0, 'pos': [-5111.71875, -1079.0, 10695.0]}, {'star_type': 'Neutron Star', 'system': 'Prua Phoe ZN-T d3-51', 'body': 'Prua Phoe ZN-T d3-51 A', 'distance': 0, 'pos': [-5260.4375, -1044.625, 10804.71875]}, {'star_type': 'Neutron Star', 'system': 'Prua Phoe RX-U e2-10', 'body': 'Prua Phoe RX-U e2-10', 'distance': 0, 'pos': [-5333.375, -1048.625, 10974.53125]}, {'star_type': 'Neutron Star', 'system': 'Prua Phoe NM-M d7-96', 'body': 'Prua Phoe NM-M d7-96', 'distance': 0, 'pos': [-5364.96875, -1005.46875, 11158.21875]}, {'star_type': 'Neutron Star', 'system': 'Prua Phoe UY-I d9-118', 'body': 'Prua Phoe UY-I d9-118', 'distance': 0, 'pos': [-5457.6875, -1013.25, 11325.3125]}, {'star_type': 'Neutron Star', 'system': 'Prua Phoe BL-F d11-40', 'body': 'Prua Phoe BL-F d11-40 A', 'distance': 0, 'pos': [-5546.8125, -1021.5625, 11494.65625]}, {'star_type': 'Neutron Star', 'system': 'Prua Phoe MD-A d14-112', 'body': 'Prua Phoe MD-A d14-112 A', 'distance': 0, 'pos': [-5610.78125, -1003.90625, 11671.0]}, {'star_type': 'Neutron Star', 'system': 'Clooku HV-Y d70', 'body': 'Clooku HV-Y d70', 'distance': 0, 'pos': [-5685.59375, -990.4375, 11841.84375]}, {'star_type': 'Neutron Star', 'system': 'Clooku PH-V d2-70', 'body': 'Clooku PH-V d2-70', 'distance': 0, 'pos': [-5742.4375, -986.3125, 12017.6875]}, {'star_type': 'Neutron Star', 'system': 'Clooku VT-R d4-64', 'body': 'Clooku VT-R d4-64', 'distance': 0, 'pos': [-5844.5, -1003.53125, 12178.5625]}, {'star_type': 'Neutron Star', 'system': 'Clooku CG-O d6-62', 'body': 'Clooku CG-O d6-62', 'distance': 0, 'pos': [-5947.96875, -990.6875, 12336.15625]}, {'star_type': 'Neutron Star', 'system': 'Clooku JS-K d8-209', 'body': 'Clooku JS-K d8-209 A', 'distance': 0, 'pos': [-6040.5625, -1003.03125, 12503.03125]}, {'star_type': 'Neutron Star', 'system': 'Clooku QE-H d10-213', 'body': 'Clooku QE-H d10-213', 'distance': 0, 'pos': [-6136.1875, -1019.96875, 12668.0]}, {'star_type': 'Neutron Star', 'system': 'Clooku XQ-D d12-40', 'body': 'Clooku XQ-D d12-40', 'distance': 0, 'pos': [-6220.71875, -1014.1875, 12838.8125]}, {'star_type': 'Neutron Star', 'system': 'Clooku ED-A d14-159', 'body': 'Clooku ED-A d14-159', 'distance': 0, 'pos': [-6292.6875, -1042.96875, 13010.40625]}, {'star_type': 'Neutron Star', 'system': 'Nuekuae CL-Y e121', 'body': 'Nuekuae CL-Y e121', 'distance': 0, 'pos': [-6378.90625, -1062.1875, 13176.46875]}, {'star_type': 'Neutron Star', 'system': 'Nuekuae MI-T d3-319', 'body': 'Nuekuae MI-T d3-319', 'distance': 0, 'pos': [-6447.75, -1075.625, 13347.625]}, {'star_type': 'Neutron Star', 'system': 'Stuelou HA-Q d5-181', 'body': 'Stuelou HA-Q d5-181', 'distance': 0, 'pos': [-6533.59375, -1062.875, 13513.9375]}, {'star_type': 'Neutron Star', 'system': 'Stuelou OM-M d7-64', 'body': 'Stuelou OM-M d7-64', 'distance': 0, 'pos': [-6622.1875, -1051.3125, 13678.375]}, {'star_type': 'Neutron Star', 'system': 'Stuelou UY-I d9-13', 'body': 'Stuelou UY-I d9-13 A', 'distance': 0, 'pos': [-6724.65625, -1050.875, 13839.84375]}, {'star_type': 'Neutron Star', 'system': 'Stuelou DG-F d11-114', 'body': 'Stuelou DG-F d11-114 A', 'distance': 0, 'pos': [-6808.03125, -1092.25, 14004.40625]}, {'star_type': 'Neutron Star', 'system': 'Stuelou IX-B d13-188', 'body': 'Stuelou IX-B d13-188', 'distance': 0, 'pos': [-6875.40625, -1043.1875, 14176.4375]}, {'star_type': 'Neutron Star', 'system': 'Blua Eaec DP-A d53', 'body': 'Blua Eaec DP-A d53 A', 'distance': 0, 'pos': [-6961.6875, -1032.90625, 14342.40625]}, {'star_type': 'Neutron Star', 'system': 'Blua Eaec LB-X d1-92', 'body': 'Blua Eaec LB-X d1-92 A', 'distance': 0, 'pos': [-7011.84375, -1031.78125, 14525.3125]}, {'star_type': 'Neutron Star', 'system': 'Blua Eaec SN-T d3-478', 'body': 'Blua Eaec SN-T d3-478', 'distance': 0, 'pos': [-7100.375, -1016.5625, 14689.59375]}, {'star_type': 'Neutron Star', 'system': 'Blua Eaec NX-U e2-714', 'body': 'Blua Eaec NX-U e2-714 A', 'distance': 0, 'pos': [-7158.40625, -1024.6875, 14872.375]}, {'star_type': 'Neutron Star', 'system': 'Blua Eaec KS-K d8-157', 'body': 'Blua Eaec KS-K d8-157 A', 'distance': 0, 'pos': [-7251.0625, -1051.09375, 15035.46875]}, {'star_type': 'Neutron Star', 'system': 'Blua Eaec RE-H d10-125', 'body': 'Blua Eaec RE-H d10-125', 'distance': 0, 'pos': [-7327.90625, -1008.21875, 15204.4375]}, {'star_type': 'Neutron Star', 'system': 'Blua Eaec YQ-D d12-203', 'body': 'Blua Eaec YQ-D d12-203', 'distance': 0, 'pos': [-7417.40625, -1001.15625, 15373.3125]}, {'star_type': 'Neutron Star', 'system': 'Blua Eaec BW-N e6-503', 'body': 'Blua Eaec BW-N e6-503', 'distance': 0, 'pos': [-7493.4375, -1021.5, 15545.5]}, {'star_type': 'Neutron Star', 'system': 'Boelts AV-Y d430', 'body': 'Boelts AV-Y d430 A', 'distance': 0, 'pos': [-7572.5, -1026.59375, 15719.5]}, {'star_type': 'Neutron Star', 'system': 'Boelts CL-Y e45', 'body': 'Boelts CL-Y e45', 'distance': 0, 'pos': [-7660.03125, -1005.0, 15888.65625]}, {'star_type': 'Neutron Star', 'system': 'Boeph RX-U e2-1248', 'body': 'Boeph RX-U e2-1248', 'distance': 0, 'pos': [-7750.6875, -997.90625, 16057.0]}, {'star_type': 'Neutron Star', 'system': 'Boeph VD-T e3-102', 'body': 'Boeph VD-T e3-102 A', 'distance': 0, 'pos': [-7797.46875, -1012.0, 16242.21875]}, {'star_type': 'Neutron Star', 'system': 'Boeph WY-I d9-1143', 'body': 'Boeph WY-I d9-1143 A', 'distance': 0, 'pos': [-7877.125, -1004.78125, 16415.46875]}, {'star_type': 'Neutron Star', 'system': 'Boeph DL-F d11-417', 'body': 'Boeph DL-F d11-417 A', 'distance': 0, 'pos': [-7960.5, -1006.8125, 16588.21875]}, {'star_type': 'Neutron Star', 'system': 'Boeph KX-B d13-683', 'body': 'Boeph KX-B d13-683 A', 'distance': 0, 'pos': [-8040.15625, -1036.3125, 16758.71875]}, {'star_type': 'Neutron Star', 'system': 'Eoch Flyuae FP-A d1295', 'body': 'Eoch Flyuae FP-A d1295 A', 'distance': 0, 'pos': [-8115.34375, -1056.625, 16933.96875]}, {'star_type': 'Neutron Star', 'system': 'Eoch Flyuae LB-X d1-742', 'body': 'Eoch Flyuae LB-X d1-742', 'distance': 0, 'pos': [-8236.34375, -1028.09375, 17079.65625]}, {'star_type': 'Neutron Star', 'system': 'Eoch Flyuae SN-T d3-36', 'body': 'Eoch Flyuae SN-T d3-36 A', 'distance': 0, 'pos': [-8330.71875, -1019.21875, 17246.40625]}, {'star_type': 'Neutron Star', 'system': 'Eoch Flyuae FG-Y f36', 'body': 'Eoch Flyuae FG-Y f36 C', 'distance': 349, 'pos': [-8422.96875, -1020.75, 17414.34375]}, {'star_type': 'Neutron Star', 'system': 'Eoch Flyuae KS-K d8-435', 'body': 'Eoch Flyuae KS-K d8-435', 'distance': 0, 'pos': [-8483.0, -1027.125, 17592.71875]}, {'star_type': 'Neutron Star', 'system': 'Eoch Flyuae UJ-R e4-63', 'body': 'Eoch Flyuae UJ-R e4-63', 'distance': 0, 'pos': [-8577.1875, -1042.1875, 17756.625]}, {'star_type': 'Neutron Star', 'system': 'Eoch Flyuae YQ-D d12-33', 'body': 'Eoch Flyuae YQ-D d12-33 A', 'distance': 0, 'pos': [-8634.96875, -1042.5625, 17939.46875]}, {'star_type': 'Neutron Star', 'system': 'Eoch Flyuae GD-A d14-337', 'body': 'Eoch Flyuae GD-A d14-337', 'distance': 0, 'pos': [-8697.9375, -1036.625, 18120.125]}, {'star_type': 'Neutron Star', 'system': 'Dryio Flyuae AV-Y d1681', 'body': 'Dryio Flyuae AV-Y d1681 A', 'distance': 0, 'pos': [-8792.0, -1020.15625, 18286.46875]}, {'star_type': 'Neutron Star', 'system': 'Dryio Flyuae HH-V d2-2139', 'body': 'Dryio Flyuae HH-V d2-2139 A', 'distance': 0, 'pos': [-8900.59375, -1012.96875, 18444.03125]}, {'star_type': 'Neutron Star', 'system': 'Dryio Flyuae GR-W e1-1731', 'body': 'Dryio Flyuae GR-W e1-1731', 'distance': 0, 'pos': [-8995.875, -1031.875, 18609.625]}, {'star_type': 'Neutron Star', 'system': 'Dryooe Flyou PM-M d7-558', 'body': 'Dryooe Flyou PM-M d7-558', 'distance': 0, 'pos': [-9071.84375, -997.625, 18782.28125]}, {'star_type': 'Neutron Star', 'system': 'Dryooe Flyou WY-I d9-403', 'body': 'Dryooe Flyou WY-I d9-403 A', 'distance': 0, 'pos': [-9136.875, -996.84375, 18961.5625]}, {'star_type': 'Neutron Star', 'system': 'Dryooe Flyou DL-F d11-719', 'body': 'Dryooe Flyou DL-F d11-719', 'distance': 0, 'pos': [-9221.8125, -1015.71875, 19131.40625]}, {'star_type': 'Neutron Star', 'system': 'Dryooe Flyou KX-B d13-614', 'body': 'Dryooe Flyou KX-B d13-614 A', 'distance': 0, 'pos': [-9307.0625, -1013.84375, 19300.375]}, {'star_type': 'Neutron Star', 'system': 'Eol Prou FP-A d1088', 'body': 'Eol Prou FP-A d1088', 'distance': 0, 'pos': [-9394.15625, -1010.34375, 19471.1875]}, {'star_type': 'Neutron Star', 'system': 'Eol Prou MB-X d1-871', 'body': 'Eol Prou MB-X d1-871 A', 'distance': 0, 'pos': [-9458.4375, -992.8125, 19650.71875]}, {'star_type': 'F (White) Star', 'system': 'Colonia', 'body': 'Colonia', 'distance': 0, 'pos': [-9530.5, -910.28125, 19808.125]}] -entries=[] -prev=route[0] -num=1 +route = [ + { + "star_type": "F (White) Star", + "system": "Ix", + "body": "Ix", + "distance": 0, + "pos": [-65.21875, 7.75, -111.03125], + }, + { + "star_type": "Neutron Star", + "system": "18 Camelopardalis", + "body": "18 Camelopardalis C", + "distance": 90212, + "pos": [-57.9375, 31.96875, -122.5625], + }, + { + "star_type": "K (Yellow-Orange giant) Star", + "system": "HIP 4024", + "body": "HIP 4024", + "distance": 0, + "pos": [-22.09375, -122.65625, -15.96875], + }, + { + "star_type": "M (Red dwarf) Star", + "system": "Ceti Sector XU-P b5-2", + "body": "Ceti Sector XU-P b5-2", + "distance": 0, + "pos": [-17.78125, -156.375, 16.0], + }, + { + "star_type": "Neutron Star", + "system": "Beta Sculptoris", + "body": "Beta Sculptoris B", + "distance": 1669, + "pos": [4.875, -164.53125, 56.5625], + }, + { + "star_type": "Neutron Star", + "system": "Rukbat", + "body": "Rukbat B", + "distance": 270382, + "pos": [5.75, -73.0625, 166.375], + }, + { + "star_type": "Neutron Star", + "system": "53 Sagittarii", + "body": "53 Sagittarii C", + "distance": 39573, + "pos": [-86.75, -116.625, 287.3125], + }, + { + "star_type": "Neutron Star", + "system": "3 Capricorni", + "body": "3 Capricorni C", + "distance": 9867, + "pos": [-210.53125, -186.59375, 342.40625], + }, + { + "star_type": "Neutron Star", + "system": "68 Aquilae", + "body": "68 Aquilae B", + "distance": 593, + "pos": [-368.78125, -240.84375, 411.65625], + }, + { + "star_type": "Neutron Star", + "system": "HIP 99600", + "body": "HIP 99600 C", + "distance": 15368, + "pos": [-532.34375, -211.875, 494.375], + }, + { + "star_type": "Neutron Star", + "system": "Col 359 Sector CG-O d6-7", + "body": "Col 359 Sector CG-O d6-7", + "distance": 0, + "pos": [-534.875, -182.375, 667.28125], + }, + { + "star_type": "Neutron Star", + "system": "Col 359 Sector IC-M d7-13", + "body": "Col 359 Sector IC-M d7-13 A", + "distance": 0, + "pos": [-659.6875, -274.84375, 774.15625], + }, + { + "star_type": "F (White) Star", + "system": "Swoiwns UK-M d8-16", + "body": "Swoiwns UK-M d8-16", + "distance": 0, + "pos": [-656.75, -276.25, 963.90625], + }, + { + "star_type": "Neutron Star", + "system": "Swoiwns SP-M d8-57", + "body": "Swoiwns SP-M d8-57 A", + "distance": 0, + "pos": [-665.28125, -238.15625, 991.21875], + }, + { + "star_type": "M (Red dwarf) Star", + "system": "Swoiwns WC-K b41-2", + "body": "Swoiwns WC-K b41-2", + "distance": 0, + "pos": [-814.75, -266.4375, 1104.25], + }, + { + "star_type": "Neutron Star", + "system": "HD 184180", + "body": "HD 184180 B", + "distance": 27, + "pos": [-847.53125, -250.84375, 1108.9375], + }, + { + "star_type": "Neutron Star", + "system": "HD 187168", + "body": "HD 187168 B", + "distance": 1901, + "pos": [-883.84375, -357.0625, 1118.0], + }, + { + "star_type": "A (Blue-White) Star", + "system": "Swoiwns GT-G d11-7", + "body": "Swoiwns GT-G d11-7 A", + "distance": 0, + "pos": [-970.25, -496.8125, 1179.34375], + }, + { + "star_type": "F (White) Star", + "system": "Swoiwns IO-G d11-13", + "body": "Swoiwns IO-G d11-13", + "distance": 0, + "pos": [-987.3125, -538.09375, 1181.4375], + }, + { + "star_type": "M (Red dwarf) Star", + "system": "Swoiwns QC-N c22-3", + "body": "Swoiwns QC-N c22-3 A", + "distance": 0, + "pos": [-1007.375, -576.59375, 1177.5], + }, + { + "star_type": "Neutron Star", + "system": "Swoiwns KJ-G d11-14", + "body": "Swoiwns KJ-G d11-14", + "distance": 0, + "pos": [-989.90625, -595.34375, 1199.25], + }, + { + "star_type": "Neutron Star", + "system": "Swoiwns KE-G d11-6", + "body": "Swoiwns KE-G d11-6 A", + "distance": 0, + "pos": [-1112.3125, -719.0, 1231.59375], + }, + { + "star_type": "Neutron Star", + "system": "Swoiwns SA-E d12-6", + "body": "Swoiwns SA-E d12-6 A", + "distance": 0, + "pos": [-1140.4375, -880.90625, 1285.375], + }, + { + "star_type": "Neutron Star", + "system": "Swoiwns VQ-D d12-1", + "body": "Swoiwns VQ-D d12-1 A", + "distance": 0, + "pos": [-1239.5, -1007.59375, 1331.21875], + }, + { + "star_type": "Neutron Star", + "system": "Prooe Drye RD-A d14-3", + "body": "Prooe Drye RD-A d14-3", + "distance": 0, + "pos": [-1401.78125, -1061.375, 1415.75], + }, + { + "star_type": "Neutron Star", + "system": "Aucopp HP-A d6", + "body": "Aucopp HP-A d6", + "distance": 0, + "pos": [-1554.03125, -1057.09375, 1525.875], + }, + { + "star_type": "Neutron Star", + "system": "Aucopp IL-Y e0", + "body": "Aucopp IL-Y e0 B", + "distance": 236942, + "pos": [-1635.21875, -1118.84375, 1661.21875], + }, + { + "star_type": "Neutron Star", + "system": "Aucopp RH-V d2-7", + "body": "Aucopp RH-V d2-7", + "distance": 0, + "pos": [-1741.25, -1040.6875, 1778.28125], + }, + { + "star_type": "Neutron Star", + "system": "Aucopp ZO-R d4-5", + "body": "Aucopp ZO-R d4-5 A", + "distance": 0, + "pos": [-1840.09375, -1076.59375, 1911.125], + }, + { + "star_type": "Neutron Star", + "system": "Aucopp OX-U e2-0", + "body": "Aucopp OX-U e2-0", + "distance": 0, + "pos": [-1849.09375, -1103.5625, 2097.09375], + }, + { + "star_type": "Neutron Star", + "system": "Aucopp MS-K d8-0", + "body": "Aucopp MS-K d8-0 A", + "distance": 0, + "pos": [-1979.75, -1052.34375, 2226.71875], + }, + { + "star_type": "Neutron Star", + "system": "Aucopp VZ-G d10-3", + "body": "Aucopp VZ-G d10-3 A", + "distance": 0, + "pos": [-2057.65625, -1127.40625, 2381.375], + }, + { + "star_type": "Neutron Star", + "system": "Aucopp CM-D d12-0", + "body": "Aucopp CM-D d12-0 A", + "distance": 0, + "pos": [-2136.03125, -1135.1875, 2547.53125], + }, + { + "star_type": "Neutron Star", + "system": "Aucopp JY-Z d13-6", + "body": "Aucopp JY-Z d13-6", + "distance": 0, + "pos": [-2222.65625, -1104.75, 2714.71875], + }, + { + "star_type": "Neutron Star", + "system": "Drojeae CV-Y d8", + "body": "Drojeae CV-Y d8", + "distance": 0, + "pos": [-2290.5, -1060.5, 2881.40625], + }, + { + "star_type": "Neutron Star", + "system": "Drojeae LC-V d2-0", + "body": "Drojeae LC-V d2-0 A", + "distance": 0, + "pos": [-2377.71875, -1131.625, 3024.8125], + }, + { + "star_type": "Neutron Star", + "system": "Drojeae SO-R d4-1", + "body": "Drojeae SO-R d4-1", + "distance": 0, + "pos": [-2424.40625, -1067.625, 3199.59375], + }, + { + "star_type": "Neutron Star", + "system": "Drojeae XF-O d6-1", + "body": "Drojeae XF-O d6-1", + "distance": 0, + "pos": [-2542.5625, -1061.3125, 3343.25], + }, + { + "star_type": "Neutron Star", + "system": "Drojo VN-K d8-5", + "body": "Drojo VN-K d8-5", + "distance": 0, + "pos": [-2628.125, -1074.40625, 3511.4375], + }, + { + "star_type": "Neutron Star", + "system": "Drojeae PZ-G d10-3", + "body": "Drojeae PZ-G d10-3 A", + "distance": 0, + "pos": [-2535.71875, -1121.9375, 3664.3125], + }, + { + "star_type": "Neutron Star", + "system": "Drojeae UQ-D d12-4", + "body": "Drojeae UQ-D d12-4 A", + "distance": 0, + "pos": [-2574.0, -1062.40625, 3836.1875], + }, + { + "star_type": "Neutron Star", + "system": "Drojeae EY-Z d13-3", + "body": "Drojeae EY-Z d13-3 A", + "distance": 0, + "pos": [-2570.65625, -1081.65625, 4024.4375], + }, + { + "star_type": "Neutron Star", + "system": "Blae Drye YU-Y d5", + "body": "Blae Drye YU-Y d5", + "distance": 0, + "pos": [-2614.1875, -1046.90625, 4185.125], + }, + { + "star_type": "Neutron Star", + "system": "Thailoi VH-V d2-6", + "body": "Thailoi VH-V d2-6", + "distance": 0, + "pos": [-2664.0625, -1044.5625, 4366.71875], + }, + { + "star_type": "Neutron Star", + "system": "Thailoi DP-R d4-8", + "body": "Thailoi DP-R d4-8", + "distance": 0, + "pos": [-2796.4375, -1080.375, 4491.90625], + }, + { + "star_type": "Neutron Star", + "system": "Thailoi MB-O d6-5", + "body": "Thailoi MB-O d6-5 A", + "distance": 0, + "pos": [-2758.75, -1096.5625, 4672.21875], + }, + { + "star_type": "Neutron Star", + "system": "Thailoi XT-I d9-1", + "body": "Thailoi XT-I d9-1 A", + "distance": 0, + "pos": [-2788.84375, -1115.1875, 4858.53125], + }, + { + "star_type": "Neutron Star", + "system": "Thailoi GG-F d11-3", + "body": "Thailoi GG-F d11-3", + "distance": 0, + "pos": [-2731.46875, -1093.25, 5034.46875], + }, + { + "star_type": "Neutron Star", + "system": "Thailoi MX-B d13-14", + "body": "Thailoi MX-B d13-14", + "distance": 0, + "pos": [-2761.1875, -1059.65625, 5217.21875], + }, + { + "star_type": "Neutron Star", + "system": "Pyraleau IP-A d5", + "body": "Pyraleau IP-A d5", + "distance": 0, + "pos": [-2757.46875, -1030.96875, 5406.625], + }, + { + "star_type": "Neutron Star", + "system": "Pyraleau WC-V d2-8", + "body": "Pyraleau WC-V d2-8 A", + "distance": 0, + "pos": [-2783.15625, -1084.0, 5588.78125], + }, + { + "star_type": "Neutron Star", + "system": "Pyraleau DP-R d4-3", + "body": "Pyraleau DP-R d4-3", + "distance": 0, + "pos": [-2836.5, -1111.5, 5757.3125], + }, + { + "star_type": "Neutron Star", + "system": "Pyraleau KB-O d6-10", + "body": "Pyraleau KB-O d6-10", + "distance": 0, + "pos": [-2897.9375, -1096.4375, 5928.53125], + }, + { + "star_type": "Neutron Star", + "system": "Pyraleau SN-K d8-0", + "body": "Pyraleau SN-K d8-0", + "distance": 0, + "pos": [-2925.28125, -1123.90625, 6106.71875], + }, + { + "star_type": "Neutron Star", + "system": "Pyraleau ZZ-G d10-7", + "body": "Pyraleau ZZ-G d10-7", + "distance": 0, + "pos": [-2950.84375, -1113.15625, 6289.15625], + }, + { + "star_type": "Neutron Star", + "system": "Pyraleau GM-D d12-8", + "body": "Pyraleau GM-D d12-8 A", + "distance": 0, + "pos": [-3073.53125, -1138.15625, 6431.0625], + }, + { + "star_type": "Neutron Star", + "system": "Pyraleau PT-Z d13-8", + "body": "Pyraleau PT-Z d13-8", + "distance": 0, + "pos": [-3143.46875, -1154.5, 6599.71875], + }, + { + "star_type": "Neutron Star", + "system": "Nyeajaae KL-Y d1", + "body": "Nyeajaae KL-Y d1", + "distance": 0, + "pos": [-3228.375, -1173.59375, 6757.78125], + }, + { + "star_type": "Neutron Star", + "system": "Nyeajaae UI-T d3-1", + "body": "Nyeajaae UI-T d3-1 A", + "distance": 0, + "pos": [-3250.09375, -1137.59375, 6936.71875], + }, + { + "star_type": "Neutron Star", + "system": "Nyeajaae WO-R d4-0", + "body": "Nyeajaae WO-R d4-0", + "distance": 0, + "pos": [-3354.8125, -1108.34375, 7094.65625], + }, + { + "star_type": "Neutron Star", + "system": "Nyeajaae IH-M d7-5", + "body": "Nyeajaae IH-M d7-5 A", + "distance": 0, + "pos": [-3417.0, -1139.09375, 7260.09375], + }, + { + "star_type": "Neutron Star", + "system": "Nyeajaae PT-I d9-3", + "body": "Nyeajaae PT-I d9-3", + "distance": 0, + "pos": [-3485.6875, -1144.21875, 7430.28125], + }, + { + "star_type": "Neutron Star", + "system": "Nyeajaae VF-F d11-2", + "body": "Nyeajaae VF-F d11-2 A", + "distance": 0, + "pos": [-3600.21875, -1137.9375, 7582.625], + }, + { + "star_type": "Neutron Star", + "system": "Nyeajaae YL-D d12-12", + "body": "Nyeajaae YL-D d12-12 A", + "distance": 0, + "pos": [-3735.65625, -1133.53125, 7716.8125], + }, + { + "star_type": "Neutron Star", + "system": "Nyeajaae EY-Z d13-0", + "body": "Nyeajaae EY-Z d13-0", + "distance": 0, + "pos": [-3858.5625, -1090.625, 7851.875], + }, + { + "star_type": "Neutron Star", + "system": "Flyiedge PQ-Y d8", + "body": "Flyiedge PQ-Y d8 A", + "distance": 0, + "pos": [-3909.71875, -1078.46875, 8035.65625], + }, + { + "star_type": "Neutron Star", + "system": "Flyiedge XC-V d2-16", + "body": "Flyiedge XC-V d2-16 A", + "distance": 0, + "pos": [-3984.84375, -1092.5, 8204.46875], + }, + { + "star_type": "Neutron Star", + "system": "Flyiedge EP-R d4-3", + "body": "Flyiedge EP-R d4-3", + "distance": 0, + "pos": [-4055.96875, -1086.71875, 8366.0625], + }, + { + "star_type": "Neutron Star", + "system": "Flyiedge PH-M d7-17", + "body": "Flyiedge PH-M d7-17 A", + "distance": 0, + "pos": [-4091.84375, -1074.125, 8547.46875], + }, + { + "star_type": "Neutron Star", + "system": "Flyiedge SN-K d8-20", + "body": "Flyiedge SN-K d8-20", + "distance": 0, + "pos": [-4213.84375, -1107.21875, 8686.3125], + }, + { + "star_type": "Neutron Star", + "system": "Flyiedge DG-F d11-22", + "body": "Flyiedge DG-F d11-22", + "distance": 0, + "pos": [-4267.0625, -1139.0625, 8859.75], + }, + { + "star_type": "Neutron Star", + "system": "Flyiedge KS-B d13-53", + "body": "Flyiedge KS-B d13-53 A", + "distance": 0, + "pos": [-4305.25, -1101.15625, 9041.0], + }, + { + "star_type": "Neutron Star", + "system": "Skaude GK-A d17", + "body": "Skaude GK-A d17 A", + "distance": 0, + "pos": [-4329.59375, -1097.03125, 9222.90625], + }, + { + "star_type": "Neutron Star", + "system": "Skaude LB-X d1-27", + "body": "Skaude LB-X d1-27", + "distance": 0, + "pos": [-4429.28125, -1046.4375, 9374.21875], + }, + { + "star_type": "Neutron Star", + "system": "Skaude KR-W e1-5", + "body": "Skaude KR-W e1-5", + "distance": 0, + "pos": [-4494.875, -1064.8125, 9548.1875], + }, + { + "star_type": "Neutron Star", + "system": "Skaude AA-Q d5-60", + "body": "Skaude AA-Q d5-60 A", + "distance": 0, + "pos": [-4528.8125, -1059.53125, 9734.78125], + }, + { + "star_type": "Neutron Star", + "system": "Skaude LS-K d8-0", + "body": "Skaude LS-K d8-0 A", + "distance": 0, + "pos": [-4611.90625, -1064.71875, 9902.3125], + }, + { + "star_type": "Neutron Star", + "system": "Skaude SE-H d10-0", + "body": "Skaude SE-H d10-0 A", + "distance": 0, + "pos": [-4697.96875, -1051.0625, 10069.53125], + }, + { + "star_type": "Neutron Star", + "system": "Skaude YQ-D d12-11", + "body": "Skaude YQ-D d12-11", + "distance": 0, + "pos": [-4788.53125, -1064.34375, 10235.8125], + }, + { + "star_type": "Neutron Star", + "system": "Skaude FD-A d14-51", + "body": "Skaude FD-A d14-51 A", + "distance": 0, + "pos": [-4896.46875, -1063.03125, 10394.53125], + }, + { + "star_type": "Neutron Star", + "system": "Preia Phoe AV-Y d54", + "body": "Preia Phoe AV-Y d54", + "distance": 0, + "pos": [-4988.53125, -1028.5, 10557.59375], + }, + { + "star_type": "Neutron Star", + "system": "Preia Phoe CL-Y e7", + "body": "Preia Phoe CL-Y e7 A", + "distance": 0, + "pos": [-5111.71875, -1079.0, 10695.0], + }, + { + "star_type": "Neutron Star", + "system": "Prua Phoe ZN-T d3-51", + "body": "Prua Phoe ZN-T d3-51 A", + "distance": 0, + "pos": [-5260.4375, -1044.625, 10804.71875], + }, + { + "star_type": "Neutron Star", + "system": "Prua Phoe RX-U e2-10", + "body": "Prua Phoe RX-U e2-10", + "distance": 0, + "pos": [-5333.375, -1048.625, 10974.53125], + }, + { + "star_type": "Neutron Star", + "system": "Prua Phoe NM-M d7-96", + "body": "Prua Phoe NM-M d7-96", + "distance": 0, + "pos": [-5364.96875, -1005.46875, 11158.21875], + }, + { + "star_type": "Neutron Star", + "system": "Prua Phoe UY-I d9-118", + "body": "Prua Phoe UY-I d9-118", + "distance": 0, + "pos": [-5457.6875, -1013.25, 11325.3125], + }, + { + "star_type": "Neutron Star", + "system": "Prua Phoe BL-F d11-40", + "body": "Prua Phoe BL-F d11-40 A", + "distance": 0, + "pos": [-5546.8125, -1021.5625, 11494.65625], + }, + { + "star_type": "Neutron Star", + "system": "Prua Phoe MD-A d14-112", + "body": "Prua Phoe MD-A d14-112 A", + "distance": 0, + "pos": [-5610.78125, -1003.90625, 11671.0], + }, + { + "star_type": "Neutron Star", + "system": "Clooku HV-Y d70", + "body": "Clooku HV-Y d70", + "distance": 0, + "pos": [-5685.59375, -990.4375, 11841.84375], + }, + { + "star_type": "Neutron Star", + "system": "Clooku PH-V d2-70", + "body": "Clooku PH-V d2-70", + "distance": 0, + "pos": [-5742.4375, -986.3125, 12017.6875], + }, + { + "star_type": "Neutron Star", + "system": "Clooku VT-R d4-64", + "body": "Clooku VT-R d4-64", + "distance": 0, + "pos": [-5844.5, -1003.53125, 12178.5625], + }, + { + "star_type": "Neutron Star", + "system": "Clooku CG-O d6-62", + "body": "Clooku CG-O d6-62", + "distance": 0, + "pos": [-5947.96875, -990.6875, 12336.15625], + }, + { + "star_type": "Neutron Star", + "system": "Clooku JS-K d8-209", + "body": "Clooku JS-K d8-209 A", + "distance": 0, + "pos": [-6040.5625, -1003.03125, 12503.03125], + }, + { + "star_type": "Neutron Star", + "system": "Clooku QE-H d10-213", + "body": "Clooku QE-H d10-213", + "distance": 0, + "pos": [-6136.1875, -1019.96875, 12668.0], + }, + { + "star_type": "Neutron Star", + "system": "Clooku XQ-D d12-40", + "body": "Clooku XQ-D d12-40", + "distance": 0, + "pos": [-6220.71875, -1014.1875, 12838.8125], + }, + { + "star_type": "Neutron Star", + "system": "Clooku ED-A d14-159", + "body": "Clooku ED-A d14-159", + "distance": 0, + "pos": [-6292.6875, -1042.96875, 13010.40625], + }, + { + "star_type": "Neutron Star", + "system": "Nuekuae CL-Y e121", + "body": "Nuekuae CL-Y e121", + "distance": 0, + "pos": [-6378.90625, -1062.1875, 13176.46875], + }, + { + "star_type": "Neutron Star", + "system": "Nuekuae MI-T d3-319", + "body": "Nuekuae MI-T d3-319", + "distance": 0, + "pos": [-6447.75, -1075.625, 13347.625], + }, + { + "star_type": "Neutron Star", + "system": "Stuelou HA-Q d5-181", + "body": "Stuelou HA-Q d5-181", + "distance": 0, + "pos": [-6533.59375, -1062.875, 13513.9375], + }, + { + "star_type": "Neutron Star", + "system": "Stuelou OM-M d7-64", + "body": "Stuelou OM-M d7-64", + "distance": 0, + "pos": [-6622.1875, -1051.3125, 13678.375], + }, + { + "star_type": "Neutron Star", + "system": "Stuelou UY-I d9-13", + "body": "Stuelou UY-I d9-13 A", + "distance": 0, + "pos": [-6724.65625, -1050.875, 13839.84375], + }, + { + "star_type": "Neutron Star", + "system": "Stuelou DG-F d11-114", + "body": "Stuelou DG-F d11-114 A", + "distance": 0, + "pos": [-6808.03125, -1092.25, 14004.40625], + }, + { + "star_type": "Neutron Star", + "system": "Stuelou IX-B d13-188", + "body": "Stuelou IX-B d13-188", + "distance": 0, + "pos": [-6875.40625, -1043.1875, 14176.4375], + }, + { + "star_type": "Neutron Star", + "system": "Blua Eaec DP-A d53", + "body": "Blua Eaec DP-A d53 A", + "distance": 0, + "pos": [-6961.6875, -1032.90625, 14342.40625], + }, + { + "star_type": "Neutron Star", + "system": "Blua Eaec LB-X d1-92", + "body": "Blua Eaec LB-X d1-92 A", + "distance": 0, + "pos": [-7011.84375, -1031.78125, 14525.3125], + }, + { + "star_type": "Neutron Star", + "system": "Blua Eaec SN-T d3-478", + "body": "Blua Eaec SN-T d3-478", + "distance": 0, + "pos": [-7100.375, -1016.5625, 14689.59375], + }, + { + "star_type": "Neutron Star", + "system": "Blua Eaec NX-U e2-714", + "body": "Blua Eaec NX-U e2-714 A", + "distance": 0, + "pos": [-7158.40625, -1024.6875, 14872.375], + }, + { + "star_type": "Neutron Star", + "system": "Blua Eaec KS-K d8-157", + "body": "Blua Eaec KS-K d8-157 A", + "distance": 0, + "pos": [-7251.0625, -1051.09375, 15035.46875], + }, + { + "star_type": "Neutron Star", + "system": "Blua Eaec RE-H d10-125", + "body": "Blua Eaec RE-H d10-125", + "distance": 0, + "pos": [-7327.90625, -1008.21875, 15204.4375], + }, + { + "star_type": "Neutron Star", + "system": "Blua Eaec YQ-D d12-203", + "body": "Blua Eaec YQ-D d12-203", + "distance": 0, + "pos": [-7417.40625, -1001.15625, 15373.3125], + }, + { + "star_type": "Neutron Star", + "system": "Blua Eaec BW-N e6-503", + "body": "Blua Eaec BW-N e6-503", + "distance": 0, + "pos": [-7493.4375, -1021.5, 15545.5], + }, + { + "star_type": "Neutron Star", + "system": "Boelts AV-Y d430", + "body": "Boelts AV-Y d430 A", + "distance": 0, + "pos": [-7572.5, -1026.59375, 15719.5], + }, + { + "star_type": "Neutron Star", + "system": "Boelts CL-Y e45", + "body": "Boelts CL-Y e45", + "distance": 0, + "pos": [-7660.03125, -1005.0, 15888.65625], + }, + { + "star_type": "Neutron Star", + "system": "Boeph RX-U e2-1248", + "body": "Boeph RX-U e2-1248", + "distance": 0, + "pos": [-7750.6875, -997.90625, 16057.0], + }, + { + "star_type": "Neutron Star", + "system": "Boeph VD-T e3-102", + "body": "Boeph VD-T e3-102 A", + "distance": 0, + "pos": [-7797.46875, -1012.0, 16242.21875], + }, + { + "star_type": "Neutron Star", + "system": "Boeph WY-I d9-1143", + "body": "Boeph WY-I d9-1143 A", + "distance": 0, + "pos": [-7877.125, -1004.78125, 16415.46875], + }, + { + "star_type": "Neutron Star", + "system": "Boeph DL-F d11-417", + "body": "Boeph DL-F d11-417 A", + "distance": 0, + "pos": [-7960.5, -1006.8125, 16588.21875], + }, + { + "star_type": "Neutron Star", + "system": "Boeph KX-B d13-683", + "body": "Boeph KX-B d13-683 A", + "distance": 0, + "pos": [-8040.15625, -1036.3125, 16758.71875], + }, + { + "star_type": "Neutron Star", + "system": "Eoch Flyuae FP-A d1295", + "body": "Eoch Flyuae FP-A d1295 A", + "distance": 0, + "pos": [-8115.34375, -1056.625, 16933.96875], + }, + { + "star_type": "Neutron Star", + "system": "Eoch Flyuae LB-X d1-742", + "body": "Eoch Flyuae LB-X d1-742", + "distance": 0, + "pos": [-8236.34375, -1028.09375, 17079.65625], + }, + { + "star_type": "Neutron Star", + "system": "Eoch Flyuae SN-T d3-36", + "body": "Eoch Flyuae SN-T d3-36 A", + "distance": 0, + "pos": [-8330.71875, -1019.21875, 17246.40625], + }, + { + "star_type": "Neutron Star", + "system": "Eoch Flyuae FG-Y f36", + "body": "Eoch Flyuae FG-Y f36 C", + "distance": 349, + "pos": [-8422.96875, -1020.75, 17414.34375], + }, + { + "star_type": "Neutron Star", + "system": "Eoch Flyuae KS-K d8-435", + "body": "Eoch Flyuae KS-K d8-435", + "distance": 0, + "pos": [-8483.0, -1027.125, 17592.71875], + }, + { + "star_type": "Neutron Star", + "system": "Eoch Flyuae UJ-R e4-63", + "body": "Eoch Flyuae UJ-R e4-63", + "distance": 0, + "pos": [-8577.1875, -1042.1875, 17756.625], + }, + { + "star_type": "Neutron Star", + "system": "Eoch Flyuae YQ-D d12-33", + "body": "Eoch Flyuae YQ-D d12-33 A", + "distance": 0, + "pos": [-8634.96875, -1042.5625, 17939.46875], + }, + { + "star_type": "Neutron Star", + "system": "Eoch Flyuae GD-A d14-337", + "body": "Eoch Flyuae GD-A d14-337", + "distance": 0, + "pos": [-8697.9375, -1036.625, 18120.125], + }, + { + "star_type": "Neutron Star", + "system": "Dryio Flyuae AV-Y d1681", + "body": "Dryio Flyuae AV-Y d1681 A", + "distance": 0, + "pos": [-8792.0, -1020.15625, 18286.46875], + }, + { + "star_type": "Neutron Star", + "system": "Dryio Flyuae HH-V d2-2139", + "body": "Dryio Flyuae HH-V d2-2139 A", + "distance": 0, + "pos": [-8900.59375, -1012.96875, 18444.03125], + }, + { + "star_type": "Neutron Star", + "system": "Dryio Flyuae GR-W e1-1731", + "body": "Dryio Flyuae GR-W e1-1731", + "distance": 0, + "pos": [-8995.875, -1031.875, 18609.625], + }, + { + "star_type": "Neutron Star", + "system": "Dryooe Flyou PM-M d7-558", + "body": "Dryooe Flyou PM-M d7-558", + "distance": 0, + "pos": [-9071.84375, -997.625, 18782.28125], + }, + { + "star_type": "Neutron Star", + "system": "Dryooe Flyou WY-I d9-403", + "body": "Dryooe Flyou WY-I d9-403 A", + "distance": 0, + "pos": [-9136.875, -996.84375, 18961.5625], + }, + { + "star_type": "Neutron Star", + "system": "Dryooe Flyou DL-F d11-719", + "body": "Dryooe Flyou DL-F d11-719", + "distance": 0, + "pos": [-9221.8125, -1015.71875, 19131.40625], + }, + { + "star_type": "Neutron Star", + "system": "Dryooe Flyou KX-B d13-614", + "body": "Dryooe Flyou KX-B d13-614 A", + "distance": 0, + "pos": [-9307.0625, -1013.84375, 19300.375], + }, + { + "star_type": "Neutron Star", + "system": "Eol Prou FP-A d1088", + "body": "Eol Prou FP-A d1088", + "distance": 0, + "pos": [-9394.15625, -1010.34375, 19471.1875], + }, + { + "star_type": "Neutron Star", + "system": "Eol Prou MB-X d1-871", + "body": "Eol Prou MB-X d1-871 A", + "distance": 0, + "pos": [-9458.4375, -992.8125, 19650.71875], + }, + { + "star_type": "F (White) Star", + "system": "Colonia", + "body": "Colonia", + "distance": 0, + "pos": [-9530.5, -910.28125, 19808.125], + }, +] +entries = [] +prev = route[0] +num = 1 for hop in route[1:]: - prev['jump_dist']="{:.2f} Ly".format(dist(hop['pos'],prev['pos'])) - prev['num']=num - prev['color']=colors.get(prev['star_type'].split()[0],'#eee') - prev['distance']="{} Ls".format(prev['distance']) + prev["jump_dist"] = "{:.2f} Ly".format(dist(hop["pos"], prev["pos"])) + prev["num"] = num + prev["color"] = colors.get(prev["star_type"].split()[0], "#eee") + prev["distance"] = "{} Ls".format(prev["distance"]) entries.append(prev) - prev=hop - num+=1 -prev['jump_dist']="0 Ly" -prev['distance']="{} Ls".format(prev['distance']) -prev['num']=num -prev['color']=colors.get(prev['star_type'].split()[0],'#eee') + prev = hop + num += 1 +prev["jump_dist"] = "0 Ly" +prev["distance"] = "{} Ls".format(prev["distance"]) +prev["num"] = num +prev["color"] = colors.get(prev["star_type"].split()[0], "#eee") entries.append(prev) -tmpl=jinja2.Template(open(tmpl_path).read()) -open("route.html","w").write(tmpl.render(route=entries)) \ No newline at end of file +tmpl = jinja2.Template(open(tmpl_path).read()) +open("route.html", "w").write(tmpl.render(route=entries)) diff --git a/ed_lrr_gui/web/__main__.py b/ed_lrr_gui/web/__main__.py index 56b20c9..01e5af5 100644 --- a/ed_lrr_gui/web/__main__.py +++ b/ed_lrr_gui/web/__main__.py @@ -1,38 +1,39 @@ -from flask import Flask,jsonify +from flask import Flask, jsonify import uuid import json -from webargs import fields,validate +from webargs import fields, validate from webargs.flaskparser import use_args from flask_sqlalchemy import SQLAlchemy -from sqlalchemy_utils import Timestamp,generic_repr +from sqlalchemy_utils import Timestamp, generic_repr from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import scoped_session, sessionmaker, relationship, backref -from sqlalchemy.types import Float,String,Boolean +from sqlalchemy.types import Float, String, Boolean -app=Flask(__name__) -app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///jobs.db' -app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False +app = Flask(__name__) +app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///jobs.db" +app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False + +db = SQLAlchemy(app) -db=SQLAlchemy(app) @generic_repr -class Job(db.Model,Timestamp): - id = db.Column(db.String,default=lambda :str(uuid.uuid4()),primary_key=True) - jump_range = db.Column(db.Float,nullable=False) - mode = db.Column(db.String,default="bfs") +class Job(db.Model, Timestamp): + id = db.Column(db.String, default=lambda: str(uuid.uuid4()), primary_key=True) + jump_range = db.Column(db.Float, nullable=False) + mode = db.Column(db.String, default="bfs") systems = db.Column(db.String) - permute= db.Column(db.String,default=None,nullable=True) - primary= db.Column(db.Boolean,default=False) - factor = db.Column(db.Float,default=0.5) - done = db.Column(db.DateTime,nullable=True,default=None) - started = db.Column(db.DateTime,nullable=True,default=None) - progress = db.Column(db.Float,default=0.0) + permute = db.Column(db.String, default=None, nullable=True) + primary = db.Column(db.Boolean, default=False) + factor = db.Column(db.Float, default=0.5) + done = db.Column(db.DateTime, nullable=True, default=None) + started = db.Column(db.DateTime, nullable=True, default=None) + progress = db.Column(db.Float, default=0.0) - #============================================================ + # ============================================================ @classmethod - def new(cls,**kwargs): - obj=cls(**kwargs) + def new(cls, **kwargs): + obj = cls(**kwargs) db.session.add(obj) db.session.commit() print(obj) @@ -40,19 +41,21 @@ class Job(db.Model,Timestamp): @property def dict(self): - ret={} + ret = {} for col in self.__table__.columns: - ret[col.name]=getattr(self,col.name) - ret['systems']=json.loads(ret['systems']) + ret[col.name] = getattr(self, col.name) + ret["systems"] = json.loads(ret["systems"]) return ret @dict.setter - def set_dict(self,*args,**kwargs): + def set_dict(self, *args, **kwargs): raise NotImplementedError + db.create_all() db.session.commit() + @app.errorhandler(422) @app.errorhandler(400) def handle_error(err): @@ -63,25 +66,35 @@ def handle_error(err): else: return jsonify({"errors": messages}), err.code -@app.route("/route",methods=["GET","POST"]) -@use_args({ - "jump_range":fields.Float(required=True), - "mode": fields.String(missing="bfs",validate=validate.OneOf(["bfs","greedy","a-star"])), - "systems": fields.DelimitedList(fields.String,required=True), - "permute": fields.String(missing=None,validate=validate.OneOf(["all", "keep_first", "keep_last", "keep_both"])), - "primary": fields.Boolean(missing=False), - "factor": fields.Float(missing=0.5) -}) + +@app.route("/route", methods=["GET", "POST"]) +@use_args( + { + "jump_range": fields.Float(required=True), + "mode": fields.String( + missing="bfs", validate=validate.OneOf(["bfs", "greedy", "a-star"]) + ), + "systems": fields.DelimitedList(fields.String, required=True), + "permute": fields.String( + missing=None, + validate=validate.OneOf(["all", "keep_first", "keep_last", "keep_both"]), + ), + "primary": fields.Boolean(missing=False), + "factor": fields.Float(missing=0.5), + } +) def route(args): - args['systems']=json.dumps(args['systems']) - for k,v in args.items(): - print(k,v) - return jsonify({'id':Job.new(**args).id}) + args["systems"] = json.dumps(args["systems"]) + for k, v in args.items(): + print(k, v) + return jsonify({"id": Job.new(**args).id}) + @app.route("/status/") def status(job_id): - job=db.session.query(Job).get_or_404(str(job_id)) + job = db.session.query(Job).get_or_404(str(job_id)) return jsonify(job.dict) -if __name__=="__main__": - app.run(host="0.0.0.0",port=3777,debug=True) \ No newline at end of file + +if __name__ == "__main__": + app.run(host="0.0.0.0", port=3777, debug=True) diff --git a/icon/make.py b/icon/make.py index 1c0a8ce..5e67641 100644 --- a/icon/make.py +++ b/icon/make.py @@ -1,109 +1,133 @@ import svgwrite import random import time -from math import factorial,sin,cos,pi +from math import factorial, sin, cos, pi from itertools import permutations import tsp as m_tsp -def dist(p1,p2): - return dist2(p1,p2)**0.5 + +def dist(p1, p2): + return dist2(p1, p2) ** 0.5 -def dist2(p1,p2): - diff=0 - for a,b in zip(p1,p2): - diff+=(a-b)**2 +def dist2(p1, p2): + diff = 0 + for a, b in zip(p1, p2): + diff += (a - b) ** 2 return diff def tsp(points): - res=[] + res = [] for idx in m_tsp.tsp(points)[1]: res.append(points[idx]) return res -def make_points(n,size,min_dist=0): - min_dist*=min_dist - points=[] - while len(points)0.8: - dwg.add(dwg.circle((px,py),r=base_r+random.random()*base_r,stroke_width=w,stroke='#0ae')).fill('#0ae') + x1 /= sd + x2 /= sd + y1 /= sd + y2 /= sd + line = dwg.add(dwg.line((x1, y1), (x2, y2), stroke_width=w, stroke=color)) + + for (px, py) in pos: + base_r = 3 + if small: + base_r = 5 + px /= sd + py /= sd + if random.random() > 0.8: + dwg.add( + dwg.circle( + (px, py), + r=base_r + random.random() * base_r, + stroke_width=w, + stroke="#0ae", + ) + ).fill("#0ae") else: - dwg.add(dwg.circle((px,py),r=base_r+random.random()*base_r,stroke_width=w,stroke=color)).fill(color) - r=base_r - for _ in range(random.randint(1,max_rings)): + dwg.add( + dwg.circle( + (px, py), + r=base_r + random.random() * base_r, + stroke_width=w, + stroke=color, + ) + ).fill(color) + r = base_r + for _ in range(random.randint(1, max_rings)): if small: random.random() random.random() random.random() continue - r+=ring_step(random.random()) - ring_col=color - if random.random()>0.75: - ring_col="#ea0" - circ=dwg.add(dwg.circle((px,py),r=r,stroke_width=w,stroke=ring_col)) - circ.fill(color,opacity=0) - d=random.random()*pi*2 - dx=cos(d) - dy=sin(d) - m=random.random() - moon=dwg.add(dwg.circle((px+dx*r,py+dy*r),r=2+2*m,stroke_width=w,stroke=ring_col)) + r += ring_step(random.random()) + ring_col = color + if random.random() > 0.75: + ring_col = "#ea0" + circ = dwg.add(dwg.circle((px, py), r=r, stroke_width=w, stroke=ring_col)) + circ.fill(color, opacity=0) + d = random.random() * pi * 2 + dx = cos(d) + dy = sin(d) + m = random.random() + moon = dwg.add( + dwg.circle( + (px + dx * r, py + dy * r), + r=2 + 2 * m, + stroke_width=w, + stroke=ring_col, + ) + ) moon.fill(ring_col) dwg.save() -seed=-4 -generate(seed,"icon_1",small=False) -generate(seed,"icon_1_small",small=True) +seed = -4 +generate(seed, "icon_1", small=False) +generate(seed, "icon_1_small", small=True)