Skip to content

Commit dbb6d71

Browse files
committed
update gravity_potential
1 parent 34ad169 commit dbb6d71

1 file changed

Lines changed: 14 additions & 15 deletions

File tree

src/amuse/examples/gravity_potential.py

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1-
#from __future__ import print_function
2-
import numpy
1+
"""
2+
Gravity potential example from Astrophysical Recipes
3+
4+
Implements a code simulating the galactic center. As the center itself
5+
does not evolve we only need to define the 'get_gravity_at_point' and
6+
'get_potential_at_point'. Note that both functions get arrays of
7+
points.
8+
"""
39
from amuse.units import units
410
from amuse.units import quantities
511
from amuse.units import constants
@@ -13,14 +19,6 @@
1319
from matplotlib import pyplot as plt
1420
from amuse.ic.kingmodel import new_king_model
1521

16-
plt.style.use('../lib/matplotlibrc')
17-
18-
"""
19-
Implements a code simulating the galactic center. As the center itself
20-
does not evolve we only need to define the 'get_gravity_at_point' and
21-
'get_potential_at_point'. Note that both functions get arrays of
22-
points.
23-
"""
2422

2523
# #BOOKLISTSTART1# #
2624
class GalacticCenterGravityCode(object):
@@ -67,12 +65,13 @@ def make_king_model_cluster(nbodycode, N, W0, Mcluster,
6765
# #BOOKLISTSTOP3# #
6866

6967
def plot_cluster(f, x, y, c):
70-
71-
#from prepare_figure import single_frame, get_distinct
72-
#f = single_frame('X [pc]', 'Y [pc]')
68+
figure = plt.figure()
69+
ax = figure.add_subplot(111)
70+
ax.set_xlabel("X [pc]")
71+
ax.set_ylabel("Y [pc]")
7372
#plt.xlim(-60, 60)
7473
#plt.ylim(-60, 60)
75-
plt.scatter(x,y, c=c, s=50, lw=0, alpha=0.2)
74+
ax.scatter(x, y, c=c, s=50, lw=0, alpha=0.2)
7675

7776
save_file = 'Arches.pdf'
7877
plt.savefig("../figures/"+save_file)
@@ -120,9 +119,9 @@ def evolve_cluster_in_galaxy(N, W0, Rinit, tend, timestep, M, R):
120119
cluster_code.stop()
121120
# #BOOKLISTSTOP2# #
122121

123-
124122
return x, y
125123

124+
126125
if __name__ == "__main__":
127126
N=1024
128127
W0=3

0 commit comments

Comments
 (0)