Skip to content

Commit 34ad169

Browse files
committed
additional updates
1 parent 85af1a9 commit 34ad169

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

src/amuse/examples/2017arXiv170307029H_Fig3.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,20 @@
1313
def plot_radial_distribution(gas, nbin, c, lw):
1414
X = []
1515
Ymean = []
16-
# Ystd = []
16+
# Ystd = []
1717
for gi in range(len(gas)-nbin):
1818
X.append(gas[gi: gi+nbin].r.value_in(units.parsec).mean())
19-
S = (gas[gi+nbin].r**2-gas[gi].r**2)
19+
S = gas[gi+nbin].r**2-gas[gi].r**2
2020
rho = gas[gi: gi+nbin].mass.sum()/S
2121
# if hasattr(gas, "rho"):
2222
# rho = gas[gi: gi+nbin].rho.max()*S.sqrt()
2323
Ymean.append(rho.value_in(units.MSun/units.parsec**2))
2424
plt.plot(X, Ymean, lw=lw)
2525

26-
def plot_radial_density_distribution(gas, stars):
2726

27+
def plot_radial_density_distribution(gas, stars):
2828
com = stars.center_of_mass()
29-
29+
3030
gas.r = ((gas.x-com[0])**2 + (gas.y-com[1])**2).sqrt()
3131
gas = gas.sorted_by_attributes("r")
3232

@@ -50,7 +50,7 @@ def plot_radial_density_distribution(gas, stars):
5050
plt.ylim(1, 1100)
5151
plt.semilogy()
5252
plt.xlabel("R [pc]")
53-
plt.ylabel("$\Sigma$ [M$_\odot$ pc$^{-2}]$")
53+
plt.ylabel(r"$\Sigma$ [M$_\odot$ pc$^{-2}]$")
5454
plt.savefig("2017arXiv170307029H_Fig3")
5555

5656

@@ -118,11 +118,18 @@ def reproduce_2017arXiv170307029H_Fig3(filename=None):
118118
elif "Star" in str(bi.name):
119119
stars.add_particles(bi.copy())
120120

121-
print("Stellar masses:", stars.mass.min().in_(units.MSun), stars.mass.mean().in_(units.MSun), stars.mass.max().in_(units.MSun), stars.mass.median().in_(units.MSun))
121+
print(
122+
"Stellar masses:",
123+
stars.mass.min().in_(units.MSun),
124+
stars.mass.mean().in_(units.MSun),
125+
stars.mass.max().in_(units.MSun),
126+
stars.mass.median().in_(units.MSun),
127+
)
122128

123129
# plot_age_gasdensity(disk, stars)
124130
plot_radial_density_distribution(disk, stars)
125131

132+
126133
def new_argument_parser():
127134
parser = argparse.ArgumentParser(
128135
formatter_class=argparse.ArgumentDefaultsHelpFormatter

0 commit comments

Comments
 (0)