Remove unneeded split
This commit is contained in:
parent
d54c95347f
commit
decedf5731
2 changed files with 2 additions and 4 deletions
2
data.py
2
data.py
|
@ -15,7 +15,7 @@ def parse_csv(filename: str):
|
||||||
for i, [x, y, vx, vy, r] in enumerate(map(lambda l: map(float, l.split(',')), lines)):
|
for i, [x, y, vx, vy, r] in enumerate(map(lambda l: map(float, l.split(',')), lines)):
|
||||||
pos[i] = [x, y]
|
pos[i] = [x, y]
|
||||||
vel[i] = [vx, vy]
|
vel[i] = [vx, vy]
|
||||||
rad[i] = [r]
|
rad[i] = r
|
||||||
return pos, vel, rad
|
return pos, vel, rad
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,9 +7,7 @@ G = 6.674e-11
|
||||||
def rotations(a: np.ndarray):
|
def rotations(a: np.ndarray):
|
||||||
a2 = np.concatenate((a, a))
|
a2 = np.concatenate((a, a))
|
||||||
for i in range(1, len(a)):
|
for i in range(1, len(a)):
|
||||||
yield np.split(a2, [i, i + len(a)])[1]
|
yield a2[i: i + len(a)]
|
||||||
# TODO: Compare performance
|
|
||||||
# yield np.roll(a, i)
|
|
||||||
|
|
||||||
|
|
||||||
def n_body(pos: np.ndarray, vel: np.ndarray, mass: np.ndarray):
|
def n_body(pos: np.ndarray, vel: np.ndarray, mass: np.ndarray):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue