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

Commit

Permalink
Updated the io reader to be able to read in a case with no cartesian …
Browse files Browse the repository at this point in the history
…coordinates or orbital elements (a central body only)
  • Loading branch information
daminton committed Feb 27, 2024
1 parent b91616e commit 17521da
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions swiftest/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -858,9 +858,15 @@ def select_active_from_frame(ds, param, framenum=-1):
# Select only the active particles at this time step
# Remove the inactive particles
if param['OUT_FORM'] == 'XV' or param['OUT_FORM'] == 'XVEL':
iactive = iframe[count_dim].where((~np.isnan(iframe['Gmass'])) | (~np.isnan(iframe['rh'].isel(space=0))), drop=True)[count_dim]
if 'rh' in iframe:
iactive = iframe[count_dim].where((~np.isnan(iframe['Gmass'])) | (~np.isnan(iframe['rh'].isel(space=0))), drop=True)[count_dim]
else:
iactive = iframe[count_dim].where(~np.isnan(iframe['Gmass']))
else:
iactive = iframe[count_dim].where((~np.isnan(iframe['Gmass'])) | (~np.isnan(iframe['a'])), drop = True)[count_dim]
if 'a' in iframe:
iactive = iframe[count_dim].where((~np.isnan(iframe['Gmass'])) | (~np.isnan(iframe['a'])), drop = True)[count_dim]
else:
iactive = iframe[count_dim].where(~np.isnan(iframe['Gmass']))
if count_dim == "id":
frame = frame.sel(id=iactive.values)
elif count_dim == "name":
Expand Down

0 comments on commit 17521da

Please sign in to comment.