diff --git a/examples/Basic_Simulation/initial_conditions.py b/examples/Basic_Simulation/initial_conditions.py index 6ac43c7fd..861556958 100644 --- a/examples/Basic_Simulation/initial_conditions.py +++ b/examples/Basic_Simulation/initial_conditions.py @@ -16,7 +16,7 @@ Input ------ -None +None. Output ------ @@ -38,10 +38,10 @@ # Initialize the simulation object as a variable. Arguments may be defined here or through the sim.run() method. sim = swiftest.Simulation(fragmentation=True, minimum_fragment_mass = 2.5e-11, mtiny=2.5e-8) -# Add the modern planets and the Sun using the JPL Horizons Database +# Add the modern planets and the Sun using the JPL Horizons Database. sim.add_solar_system_body(["Sun","Mercury","Venus","Earth","Mars","Jupiter","Saturn","Uranus","Neptune","Pluto"]) -# Add 5 user-defined massive bodies +# Add 5 user-defined massive bodies. npl = 5 density_pl = 3000.0 / (sim.param['MU2KG'] / sim.param['DU2M'] ** 3) @@ -60,7 +60,7 @@ sim.add_body(name=name_pl, a=a_pl, e=e_pl, inc=inc_pl, capom=capom_pl, omega=omega_pl, capm=capm_pl, Gmass=GM_pl, radius=R_pl, rhill=Rh_pl, Ip=Ip_pl, rot=rot_pl) -# Add 10 user-defined test particles +# Add 10 user-defined test particles. ntp = 10 name_tp = ["TestParticle_01", "TestParticle_02", "TestParticle_03", "TestParticle_04", "TestParticle_05", "TestParticle_06", "TestParticle_07", "TestParticle_08", "TestParticle_09", "TestParticle_10"] @@ -72,7 +72,7 @@ capm_tp = default_rng().uniform(0.0, 360.0, ntp) sim.add_body(name=name_tp, a=a_tp, e=e_tp, inc=inc_tp, capom=capom_tp, omega=omega_tp, capm=capm_tp) -# Display the run configuration parameters +# Display the run configuration parameters. sim.get_parameter() # Run the simulation. Arguments may be defined here or thorugh the swiftest.Simulation() method. diff --git a/examples/Basic_Simulation/output_reader.py b/examples/Basic_Simulation/output_reader.py index 5d7f496b7..a41103ccd 100644 --- a/examples/Basic_Simulation/output_reader.py +++ b/examples/Basic_Simulation/output_reader.py @@ -27,10 +27,10 @@ import xarray as xr import matplotlib.pyplot as plt -# Read in the simulation output and store it as an Xarray dataset +# Read in the simulation output and store it as an Xarray dataset. sim = swiftest.Simulation(read_old_output_file=True) -# Plot of the data and save the output plot +# Plot of the data and save the output plot. colors = ['white' if x == 'Massive Body' else 'black' for x in sim.data['particle_type']] sizes = [100 if x == 'Massive Body' else 10 for x in sim.data['particle_type']] diff --git a/examples/Fragmentation/swiftest_fragmentation.py b/examples/Fragmentation/swiftest_fragmentation.py index 1b6aed2aa..de4e9ba2c 100644 --- a/examples/Fragmentation/swiftest_fragmentation.py +++ b/examples/Fragmentation/swiftest_fragmentation.py @@ -17,7 +17,7 @@ Input ------ -None +None. Output ------ diff --git a/examples/helio_gr_test/helio_gr_test.py b/examples/helio_gr_test/helio_gr_test.py index 1b0033ab1..c627be7f4 100644 --- a/examples/helio_gr_test/helio_gr_test.py +++ b/examples/helio_gr_test/helio_gr_test.py @@ -17,7 +17,7 @@ Input ------ -None +None. Output ------ @@ -50,12 +50,12 @@ # Initialize the simulation object as a variable. Define the directory in which the output will be placed. sim_gr = swiftest.Simulation(simdir="gr") -# Add the modern planets and the Sun using the JPL Horizons Database +# Add the modern planets and the Sun using the JPL Horizons Database. sim_gr.add_solar_system_body(["Sun","Mercury","Venus","Earth","Mars","Jupiter","Saturn","Uranus","Neptune"]) # Initialize the simulation object as a variable. Define the directory in which the output will be placed. sim_nogr = swiftest.Simulation(simdir="nogr") -# Add the modern planets and the Sun using the JPL Horizons Database +# Add the modern planets and the Sun using the JPL Horizons Database. sim_nogr.add_solar_system_body(["Sun","Mercury","Venus","Earth","Mars","Jupiter","Saturn","Uranus","Neptune"]) # Define a set of arguments that apply to both runs. For a list of possible arguments, see the User Manual. @@ -65,13 +65,13 @@ sim_gr.run(**run_args,general_relativity=True) sim_nogr.run(**run_args,general_relativity=False) -# Get the start and end date of the simulation so we can compare with the real solar system +# Get the start and end date of the simulation so we can compare with the real solar system. start_date = sim_gr.ephemeris_date tstop_d = sim_gr.param['TSTOP'] * sim_gr.param['TU2S'] / swiftest.JD2S stop_date = (datetime.datetime.fromisoformat(start_date) + datetime.timedelta(days=tstop_d)).isoformat() -#Get the ephemerides of Mercury for the same timeframe as the simulation +#Get the ephemerides of Mercury for the same timeframe as the simulation. obj = Horizons(id='1', location='@sun', epochs={'start':start_date, 'stop':stop_date, 'step':'10y'}) @@ -87,7 +87,7 @@ dvarpi_nogr = np.diff(varpisim_nogr) * 3600 * 100 / run_args['tstep_out'] dvarpi_obs = np.diff(varpi_obs) / np.diff(t) * 3600 * 100 -# Plot of the data and save the output plot +# Plot of the data and save the output plot. fig, ax = plt.subplots() ax.plot(t, varpi_obs, label="JPL Horizons",linewidth=2.5) diff --git a/examples/whm_gr_test/whm_gr_test.py b/examples/whm_gr_test/whm_gr_test.py index ab397c464..d0d2ade69 100644 --- a/examples/whm_gr_test/whm_gr_test.py +++ b/examples/whm_gr_test/whm_gr_test.py @@ -17,7 +17,7 @@ Input ------ -None +None. Output ------ @@ -63,13 +63,13 @@ sim_gr.run(**run_args,general_relativity=True) sim_nogr.run(**run_args,general_relativity=False) -# Get the start and end date of the simulation so we can compare with the real solar system +# Get the start and end date of the simulation so we can compare with the real solar system. start_date = sim_gr.ephemeris_date tstop_d = sim_gr.param['TSTOP'] * sim_gr.param['TU2S'] / swiftest.JD2S stop_date = (datetime.datetime.fromisoformat(start_date) + datetime.timedelta(days=tstop_d)).isoformat() -#Get the ephemerides of Mercury for the same timeframe as the simulation +#Get the ephemerides of Mercury for the same timeframe as the simulation. obj = Horizons(id='1', location='@sun', epochs={'start':start_date, 'stop':stop_date, 'step':'10y'}) @@ -85,7 +85,7 @@ dvarpi_nogr = np.diff(varpisim_nogr) * 3600 * 100 / run_args['tstep_out'] dvarpi_obs = np.diff(varpi_obs) / np.diff(t) * 3600 * 100 -# Plot of the data and save the output plot +# Plot of the data and save the output plot. fig, ax = plt.subplots() ax.plot(t, varpi_obs, label="JPL Horizons",linewidth=2.5)