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

Commit

Permalink
Merge branch 'debug' into Simulation_API_improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Nov 16, 2022
2 parents 928f3f1 + 0aedbe6 commit 51d0e28
Show file tree
Hide file tree
Showing 9 changed files with 296 additions and 256 deletions.
11 changes: 2 additions & 9 deletions examples/Basic_Simulation/initial_conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,7 @@
Returns
-------
param.in : ASCII text file
Swiftest parameter input file.
pl.in : ASCII text file
Swiftest massive body input file.
tp.in : ASCII text file
Swiftest test particle input file.
cb.in : ASCII text file
Swiftest central body input file.
Updates sim.data with the simulation data
"""

import swiftest
Expand Down Expand Up @@ -72,5 +65,5 @@

sim.add_body(name_tp, a_tp, e_tp, inc_tp, capom_tp, omega_tp, capm_tp)

# Save everything to a set of initial conditions files
# Run the simulation
sim.run()
2 changes: 1 addition & 1 deletion examples/Basic_Simulation/param.in
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ MU2KG 1.988409870698051e+30
TU2S 31557600.0
DU2M 149597870700.0
GMTINY 9.869231602224408e-07
MIN_GMFRAG 9.869231602224408e-10
RESTART NO
CHK_CLOSE YES
GR YES
Expand All @@ -35,3 +34,4 @@ RHILL_PRESENT NO
INTERACTION_LOOPS TRIANGULAR
ENCOUNTER_CHECK TRIANGULAR
TIDES NO
MIN_GMFRAG 9.869231602224408e-10
2 changes: 1 addition & 1 deletion examples/Basic_Simulation/run_from_file.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import swiftest
sim = swiftest.Simulation()
sim.run()
sim.run(tstop=20.0)
159 changes: 159 additions & 0 deletions examples/Basic_Simulation/run_simulation.ipynb

Large diffs are not rendered by default.

143 changes: 0 additions & 143 deletions examples/Basic_Simulation/test_io.ipynb

This file was deleted.

4 changes: 4 additions & 0 deletions python/swiftest/swiftest/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,10 @@ def swiftest2xr(param, verbose=True):
ds = fix_types(ds,ftype=np.float64)
elif param['OUT_TYPE'] == "NETCDF_FLOAT":
ds = fix_types(ds,ftype=np.float32)
# Check if the name variable contains unique values. If so, make name the dimension instead of id
if len(np.unique(ds['name'])) == len(ds['name']):
ds = ds.swap_dims({"id" : "name"})
ds = ds.reset_coords("id")
else:
print(f"Error encountered. OUT_TYPE {param['OUT_TYPE']} not recognized.")
return None
Expand Down
Loading

0 comments on commit 51d0e28

Please sign in to comment.