Skip to content

Commit 34f4736

Browse files
authored
Update keywords for protodisk.py (#1139)
1 parent 9d01e65 commit 34f4736

File tree

1 file changed

+36
-7
lines changed

1 file changed

+36
-7
lines changed

src/amuse/ext/protodisk.py

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import numpy
2-
2+
import warnings
33
from amuse.ext.evrard_test import body_centered_grid_unit_cube
44
from amuse.ext.evrard_test import regular_grid_unit_cube
55
from amuse.ext.evrard_test import uniform_random_unit_cube
@@ -44,17 +44,46 @@ def make_xyz(self):
4444
return self.cutout_cylinder(*(self.base_grid(self.estimatedN)).make_xyz())
4545

4646

47-
class ProtoPlanetaryDisk(object):
47+
class ProtoPlanetaryDisk:
48+
49+
def __init__(
50+
self, targetN, convert_nbody=None, discfraction=0.1,
51+
densitypower=1., thermalpower=0.5, radius_min=1, radius_max=100,
52+
gamma=1.,q_out=2.,base_grid=None, Rmin=None, Rmax=None,
53+
):
54+
if Rmin is not None:
55+
warnings.warn(
56+
"Rmin is deprecated, use radius_min instead",
57+
category=FutureWarning,
58+
)
59+
if radius_min is not None and radius_min != Rmin:
60+
raise ValueError(
61+
"Rmin and radius_min have different values, "
62+
"this is only allowed if one of them is None"
63+
)
64+
radius_min = Rmin
65+
if radius_min is None:
66+
raise ValueError("radius_min must be set")
67+
if Rmax is not None:
68+
warnings.warn(
69+
"Rmax is deprecated, use radius_max instead",
70+
category=FutureWarning,
71+
)
72+
if radius_max is not None and radius_max != Rmax:
73+
raise ValueError(
74+
"Rmax and radius_max have different values, "
75+
"this is only allowed if one of them is None"
76+
)
77+
radius_max = Rmax
78+
if radius_max is None:
79+
raise ValueError("radius_max must be set")
4880

49-
def __init__(self, targetN, convert_nbody = None, discfraction=0.1,
50-
densitypower=1., thermalpower=0.5, Rmin=1,Rmax=100,
51-
gamma=1.,q_out=2.,base_grid=None):
5281
self.targetN=targetN
5382
self.convert_nbody=convert_nbody
5483
self.densitypower=densitypower
5584
self.thermalpower=thermalpower
56-
self.Rmin=Rmin
57-
self.Rmax=Rmax
85+
self.Rmin=radius_min
86+
self.Rmax=radius_max
5887
self.gamma=gamma
5988
self.q_out=q_out
6089
self.discfraction=discfraction

0 commit comments

Comments
 (0)