Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Merge branch 'debug'
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed May 15, 2023
2 parents 997e8ad + 12bc34e commit 7b3ebf8
Show file tree
Hide file tree
Showing 3 changed files with 189 additions and 395 deletions.
16 changes: 9 additions & 7 deletions python/swiftest/swiftest/init_cond.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def vec2xr(param: Dict, **kwargs: Any):
Parameters
----------
param : dict
Swiftest paramuration parameters.
Swiftest simulation parameters.
name : str or array-like of str, optional
Name or names of Bodies. If none passed, name will be "Body<id>"
id : int or array-like of int, optional
Expand All @@ -252,9 +252,9 @@ def vec2xr(param: Dict, **kwargs: Any):
capm : float or array-like of float, optional
mean anomaly for param['IN_FORM'] == "EL"
rh : (n,3) array-like of float, optional
Position vector array. This can be used instead of passing v1, v2, and v3 sepearately for "XV" input format
Position vector array.
vh : (n,3) array-like of float, optional
Velocity vector array. This can be used instead of passing v4, v5, and v6 sepearately for "XV" input format
Velocity vector array.
Gmass : float or array-like of float, optional
G*mass values if these are massive bodies (only one of mass or Gmass can be passed)
radius : float or array-like of float, optional
Expand Down Expand Up @@ -282,10 +282,12 @@ def vec2xr(param: Dict, **kwargs: Any):

# Check for valid keyword arguments
kwargs = {k:kwargs[k] for k,v in kwargs.items() if v is not None}
if "rot" not in kwargs and "Gmass" in kwargs:
kwargs['rot'] = np.zeros((len(kwargs['Gmass']),3))
if "Ip" not in kwargs and "Gmass" in kwargs:
kwargs['Ip'] = np.full((len(kwargs['Gmass']),3), 0.4)

if "rotation" in param and param['rotation'] == True:
if "rot" not in kwargs and "Gmass" in kwargs:
kwargs['rot'] = np.zeros((len(kwargs['Gmass']),3))
if "Ip" not in kwargs and "Gmass" in kwargs:
kwargs['Ip'] = np.full((len(kwargs['Gmass']),3), 0.4)

if "time" not in kwargs:
kwargs["time"] = np.array([0.0])
Expand Down
Loading

0 comments on commit 7b3ebf8

Please sign in to comment.