about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorhanemile <emile.hansmaennel@gmail.com>2017-12-09 17:53:54 +0100
committerhanemile <emile.hansmaennel@gmail.com>2017-12-09 17:53:54 +0100
commit073e28e0e052941cf0913182944df6cf6363764d (patch)
tree8ef85bd87a83bf84bbaa2789ba9523cd9d0d5274 /src
parent785ce2de64d9505bf04ed918518b446b8c196d27 (diff)
fixed some bugs
Diffstat (limited to 'src')
-rwxr-xr-xsrc/coord.py5
-rwxr-xr-xsrc/gen.py66
2 files changed, 3 insertions, 68 deletions
diff --git a/src/coord.py b/src/coord.py
index 4094b25..932cf80 100755
--- a/src/coord.py
+++ b/src/coord.py
@@ -102,11 +102,12 @@ def main():
 
     time_all = whole_time + time_write_file
 
+    time_min = round(time_all / 60, 1)
+
     # print some stats
     print("")
     print("{:<30}{:<30}".format("Time (complete)", str(round(time_all, 4)) + " seconds"))
-    print("{:<30}{:<30}".format("Time (calculate stars)", str(round(whole_time, 4)) + " seconds"))
-    print("{:<30}{:<30}".format("Time (write to file)", str(round(time_write_file, 4)) + " seconds"))
+    print("{:<30}{:<30}".format("Time (complete)", str(round(time_min, 4)) + " minutes"))
     print("{:-<40}".format(""))
     print("{:<20}{:<20}".format("Number of Stars", str(nos)))
     print("{:<20}{:<20}".format("Stars Kicked:", str(stars_kicked)))
diff --git a/src/gen.py b/src/gen.py
deleted file mode 100755
index b4b7933..0000000
--- a/src/gen.py
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/usr/bin/env python
-
-from numpy import genfromtxt
-import numpy as np
-import math
-import os
-import socket
-import time
-import matplotlib.pyplot as plt
-host = socket.gethostname()
-
-listx = []
-listy = []
-
-def gen_stars(stars):
-    stars = int(stars)
-
-    # lists
-    listrho = []
-
-    # create new file for every calculation
-    path = "data/" + str(host) + "_" + str(os.getpid()) + ".csv"
-    print("path: " + str(path))
-
-    # define the size of the galaxy
-    length = 1.5e6
-
-    # define the borders
-    range_min = -int(length)
-    range_max = int(length)
-
-    # define the rho range
-    rand_min = rho(0)
-    rand_max = rho(math.sqrt(length**2 + length**2))
-
-    # create random stars
-    for r in range(0, stars):
-        x = np.random.uniform(range_min, range_max, size=1)
-        y = np.random.uniform(range_min, range_max, size=1)
-        rand_val = np.random.uniform(rand_min, rand_max, size=1)
-        rho_xy = rho(math.sqrt(x**2 + y**2))
-
-        # if the random value is smaller than the rho value, generate a star
-        if rand_val < rho_xy:
-
-            # open a file to write to
-            with open(path, "a") as data:
-
-                # write the data to the file
-                data.write(str(x).strip("[]") + "," + str(y).strip("[]") + "\n")
-                listx.append(x)
-                listy.append(y)
-                print(str(x) + ", " + str(y))
-
-    print("range_min: " + str(range_min))
-    print("range_max: " + str(range_max))
-
-    print("rand_min: " + str(rand_min))
-    print("rand_max: " + str(rand_max))
-
-# generate n stars
-gen_stars(1e6)
-
-# plot the stars coordinates in 2D space
-plt.scatter(listx, listy)
-plt.show()