Skip to content

Commit ef1d402

Browse files
committed
optimize code
1 parent 98d3896 commit ef1d402

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

deepexo/rockyplanet.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def __init__(self):
2828
"mdn_loss_func": mdn.get_mixture_loss_func(OUTPUT_DIMS, N_MIXES)}, compile=False)
2929
self.model_b_scaler = joblib.load(os.path.join(model_path, "model_b_scaler.save"))
3030

31-
def predict(self, planet_params):
31+
def predict(self, planet_params: object) -> object:
3232
"""Predicts the Water radial fraction, Mantle radial fraction, Core radial fraction, Core mass fraction,
3333
CMB pressure and CMB temperature for the given planetary parameters in terms of planetary mass M [M_Earth],
3434
radius [R_Earth], bulk Fe/(Mg + Si) (molar ratio), and tide Love number k2.
@@ -50,7 +50,7 @@ def predict(self, planet_params):
5050
raise ValueError(
5151
"Invalid number of planet parameters. Expected 3 or 4, but got {}".format(len(planet_params)))
5252

53-
def plot(self, pred, save=False, filename="pred.png"):
53+
def plot(self, pred: object, save: object = False, filename: object = "pred.png") -> object:
5454
"""Plots the predicted distributions for Water radial fraction, Mantle radial fraction, Core radial fraction,
5555
Core mass fraction, CMB pressure and CMB temperature.
5656
Args:

run.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from deepexo.rockyplanet import RockyPlanet
2+
23
# Keplar-78b
34
M = 1.77 # mass in Earth masses
45
R = 1.228 # radius in Earth radii
@@ -17,4 +18,4 @@
1718
save=True, # save to file
1819
filename="pred.png" # save to current directory, filename is pred.png, you can change the extension to eps
1920
# or pdf
20-
)
21+
)

0 commit comments

Comments
 (0)