ascl_id
stringclasses
752 values
repo_url
stringclasses
737 values
file_path
stringlengths
4
194
content
large_stringlengths
1
1M
language
stringclasses
29 values
license_type
stringclasses
24 values
size
int64
1
1M
[ascl:1110.016]
https://github.com/hannorein/rebound
rebound/tests/test_fpcontract.py
import rebound import unittest from ctypes import c_int class TestFPContract(unittest.TestCase): def test_fp_off(self): cl = rebound.clibrebound cl.reb_check_fp_contract.res_type = c_int fp_contract = cl.reb_check_fp_contract() # make sure floating point contraction are off ...
Python
Unknown
407
[ascl:1110.016]
https://github.com/hannorein/rebound
rebound/tests/test_serialize.py
import rebound import unittest class TestSerialize(unittest.TestCase): def setUp(self): self.sim = rebound.Simulation() self.sim.t = 1.246 self.sim.add(m=1.) self.sim.add(a=1.) def tearDown(self): self.sim = None def test_serialize(self): try: ...
Python
Unknown
2,026
[ascl:1110.016]
https://github.com/hannorein/rebound
rebound/tests/test_leapfrog.py
import rebound import unittest import math import rebound.data class TestIntegrator(unittest.TestCase): def setUp(self): self.sim = rebound.Simulation() rebound.data.add_outer_solar_system(self.sim) self.sim.move_to_com() def tearDown(self): self.sim = None def tes...
Python
Unknown
1,929
[ascl:1110.016]
https://github.com/hannorein/rebound
rebound/tests/test_trace.py
import rebound import unittest import numpy as np import math import sys import warnings import os from datetime import datetime def chaotic_exchange_sim(): sim = rebound.Simulation() # Setup using xyz instead of orbital elements for # machine independent test star_m = 1; jup_m = 0.01 / (star_m - ...
Python
Unknown
17,042
[ascl:1110.016]
https://github.com/hannorein/rebound
rebound/tests/test_trace_basic.py
import rebound import unittest class TestIntegratorTraceBasic(unittest.TestCase): def test_trace_encounter_condition(self): sim = rebound.Simulation() sim.add(m=1) sim.add(m=1e-3,a=1) sim.add(m=1e-3,a=1.1,f=0.25) # First step will be rejected. sim.add(m=1e-3,a=3.1) ...
Python
Unknown
1,798
[ascl:1110.016]
https://github.com/hannorein/rebound
rebound/tests/test_shearingsheet.py
import rebound import unittest import math import random class TestShearingSheet(unittest.TestCase): def test_saturnsrings(self): sim = rebound.Simulation() OMEGA = 0.00013143527 # [1/s] sim.ri_sei.OMEGA = OMEGA surface_density = 400. # kg/m^2 particle_density = ...
Python
Unknown
2,361
[ascl:1110.016]
https://github.com/hannorein/rebound
rebound/tests/test_collisions.py
import rebound import unittest import math import random class TestLineTreeCollisions(unittest.TestCase): def test_linetree_find(self): # Should find the collision sim = rebound.Simulation() sim.integrator = "leapfrog" sim.collision = "linetree" sim.configure_box(100)...
Python
Unknown
6,869
[ascl:1110.016]
https://github.com/hannorein/rebound
rebound/tests/test_bs.py
import rebound import unittest import math import rebound.data def derivatives_ho(ode, yDot, y, t): m = 1. k = 100. yDot[0] = y[1] yDot[1] = -k/m*y[0] class TestIntegratorBSHarmonic(unittest.TestCase): def test_bs_harmonic_only(self): sim = rebound.Simulation() sim.integrator = "B...
Python
Unknown
13,794
[ascl:1110.016]
https://github.com/hannorein/rebound
rebound/tests/test_random.py
import rebound from ctypes import c_double, byref import unittest from time import sleep class TestRandom(unittest.TestCase): def test_uniform(self): rebound.clibrebound.reb_random_uniform.restype = c_double simulation = rebound.Simulation() for simp in [0, byref(simulation)]: f...
Python
Unknown
2,794
[ascl:1110.016]
https://github.com/hannorein/rebound
rebound/tests/test_horizons.py
import rebound import unittest import socket import warnings class TestHorizons(unittest.TestCase): def setUp(self): self.sim = rebound.Simulation() def tearDown(self): self.sim = None def test_earth(self): try: with warnings.catch_warnings(record=True) as w: ...
Python
Unknown
1,220
[ascl:1110.016]
https://github.com/hannorein/rebound
rebound/tests/test_simulationarchive.py
import rebound import unittest import os import warnings class TestSimulationarchive(unittest.TestCase): def test_sa_step(self): sim = rebound.Simulation() sim.add(m=1) sim.add(m=1e-3,a=1,e=0.1,omega=0.1,M=0.1,inc=0.1,Omega=0.1) sim.add(m=1e-3,a=-2,e=1.1,omega=0.1,M=0.1,inc=0.1,Omeg...
Python
Unknown
21,397
[ascl:1110.016]
https://github.com/hannorein/rebound
rebound/tests/test_rotations.py
import rebound import unittest import math class TestRotations(unittest.TestCase): def test_init(self): r = rebound.Rotation(angle=math.pi/2, axis=[0,0,1.]) res = r*[1,0,0] self.assertAlmostEqual(res[0], 0, delta=1e-15) self.assertAlmostEqual(res[1], 1, delta=1e-15) self.as...
Python
Unknown
7,131
[ascl:1110.016]
https://github.com/hannorein/rebound
rebound/tests/test_orbital_elements.py
import rebound import math import unittest class TestOrbitalElements(unittest.TestCase): def test_add_errors(self): sim = rebound.Simulation() with self.assertRaises(ValueError): sim.add(a=1) sim.add(m=1.) with self.assertRaises(ValueError): sim.add(a=1, e=1)...
Python
Unknown
17,384
[ascl:1110.016]
https://github.com/hannorein/rebound
rebound/tests/test_modify_orbital_parameters.py
import rebound import unittest d = 1e-14 # precision. some orbit transformations are not well behaved class TestOrbitalElements(unittest.TestCase): def test_P(self): sim = rebound.Simulation() sim.add(m=1) sim.add(m=1e-3,a=1,e=0.1,omega=0.2,Omega=0.3,inc=0.4,f=0.5) sim.add(m=1e-3,a...
Python
Unknown
8,039
[ascl:1110.016]
https://github.com/hannorein/rebound
rebound/tests/test_megno.py
import rebound import unittest import math class TestMegno(unittest.TestCase): def setUp(self): self.sim = rebound.Simulation() def tearDown(self): self.sim = None def test_ias15(self): self.sim.integrator = "ias15" self.sim.add(m=1) self.sim.add(m=1e-3,a=...
Python
Unknown
3,445
[ascl:1110.016]
https://github.com/hannorein/rebound
rebound/tests/test_boundary.py
import rebound import unittest class TestBoundary(unittest.TestCase): def test_open(self): for gravity in ["basic", "tree"]: sim = rebound.Simulation() sim.boundary = "open" sim.integrator = "leapfrog" sim.gravity = gravity sim.configure_box...
Python
Unknown
2,790
[ascl:1110.016]
https://github.com/hannorein/rebound
rebound/integrators/__init__.py
# Integrators
Python
Unknown
14
[ascl:1110.016]
https://github.com/hannorein/rebound
rebound/integrators/custom.py
import ctypes class IntegratorCustom(ctypes.Structure): """ This class is an abstraction of the C-struct reb_integrator. It controls the behaviour of a custom, user-provided integrator. """ _fields_ = [("step", ctypes.c_void_p), ("synchronize", ctypes.c_void_p), ("re...
Python
Unknown
454
[ascl:1110.016]
https://github.com/hannorein/rebound
rebound/integrators/eos.py
import ctypes EOS_TYPES = { "lf": 0x00, "lf4": 0x01, "lf6": 0x02, "lf8": 0x03, "lf4_2": 0x04, "lf8_6_4": 0x05, "plf7_6_4": 0x06, "pmlf4": 0x07, "pmlf6": 0x08, } class IntegratorEOS(ctypes.Structure): """ This class is an abstrac...
Python
Unknown
2,951
[ascl:1110.016]
https://github.com/hannorein/rebound
rebound/integrators/mercurius.py
import ctypes from .. import clibrebound from ..simulation import Simulation from ..particle import Particle from ..vectors import Vec3dBasic class IntegratorMercurius(ctypes.Structure): """ This class is an abstraction of the C-struct reb_integrator_mercurius. It controls the behaviour of the MERCURIUS i...
Python
Unknown
2,848
[ascl:1110.016]
https://github.com/hannorein/rebound
rebound/integrators/sei.py
import ctypes class IntegratorSEI(ctypes.Structure): """ This class is an abstraction of the C-struct reb_integrator_sei. It controls the behaviour of the symplectic SEI integrator for shearing sheet calculations. It is described in Rein and Tremaine (2011). This struct should be accessed via ...
Python
Unknown
1,201
[ascl:1110.016]
https://github.com/hannorein/rebound
rebound/integrators/saba.py
import ctypes SABA_TYPES = { "1": 0x0, "2": 0x1, "3": 0x2, "4": 0x3, "cm1": 0x100, "cm2": 0x101, "cm3": 0x102, "cm4": 0x103, "cl1": 0x200, "cl2": 0x201, "cl3": 0x202, "cl4": 0x203, "10,4": 0x4, "8,6,4": 0x5, "10,6,4": 0x6, "h8,4,4": 0x7, "h8,6,4": 0x8, "h10,6,4": 0x9, } ...
Python
Unknown
2,376
[ascl:1110.016]
https://github.com/hannorein/rebound
rebound/integrators/janus.py
import ctypes class ParticleInt(ctypes.Structure): """ Used for Janus integrator only """ _fields_ = [ ("x", ctypes.c_int64), ("y", ctypes.c_int64), ("z", ctypes.c_int64), ("vx", ctypes.c_int64), ("vy", ctypes.c_int64), ...
Python
Unknown
766
[ascl:1110.016]
https://github.com/hannorein/rebound
rebound/integrators/trace.py
import ctypes from ctypes import cast from .. import clibrebound from ..simulation import Simulation from ..particle import Particle from ..vectors import Vec3dBasic TRACE_PERI_MODES = {"FULL_BS": 1, "PARTIAL_BS": 0, "FULL_IAS15": 2} class IntegratorTRACE(ctypes.Structure): """ This class is an abstraction o...
Python
Unknown
5,052
[ascl:1110.016]
https://github.com/hannorein/rebound
rebound/integrators/bs.py
from ctypes import c_uint, c_double, c_void_p, CFUNCTYPE, POINTER, c_int, Structure from .. import clibrebound class ODE(Structure): @property def derivatives(self): raise AttributeError("You can only set C function pointers from python.") @derivatives.setter def derivatives(self, func): ...
Python
Unknown
2,606
[ascl:1110.016]
https://github.com/hannorein/rebound
rebound/integrators/whfast512.py
import ctypes from ..particle import Particle class IntegratorWHFast512(ctypes.Structure): _fields_ = [("gr_potential", ctypes.c_uint), ("N_systems", ctypes.c_uint), ("keep_unsynchronized", ctypes.c_uint), ("is_synchronized", ctypes.c_uint), ("_N_all...
Python
Unknown
496
[ascl:1110.016]
https://github.com/hannorein/rebound
rebound/integrators/ias15.py
import ctypes IAS15_ADAPTIVE_MODES = {"individual": 0, "global": 1, "prs23": 2, "aarseth85": 3} class reb_dp7(ctypes.Structure): _fields_ = [("p0", ctypes.POINTER(ctypes.c_double)), ("p1", ctypes.POINTER(ctypes.c_double)), ("p2", ctypes.POINTER(ctypes.c_double)), ("...
Python
Unknown
4,176
[ascl:1110.016]
https://github.com/hannorein/rebound
rebound/integrators/whfast.py
import ctypes from ..particle import Particle WHFAST_KERNELS = {"default": 0, "modifiedkick": 1, "composition": 2, "lazy": 3} WHFAST_COORDINATES = {"jacobi": 0, "democraticheliocentric": 1, "whds": 2, "barycentric": 3} class IntegratorWHFast(ctypes.Structure): """ This class is an abstraction of the C-struct ...
Python
Unknown
5,513
[ascl:1110.016]
https://github.com/hannorein/rebound
rebound/integrators/leapfrog.py
import ctypes class IntegratorLeapfrog(ctypes.Structure): """ This class is an abstraction of the C-struct reb_integrator_leapfrog. It controls the order of the Leapfrog integrator. >>> sim = rebound.Simulation() >>> sim.ri_leapfrog.order = 4 # default is 2 :ivar int order Sets th...
Python
Unknown
453
[ascl:1110.016]
https://github.com/hannorein/rebound
legacy/gravity_grape.c
/** * @file gravity.c * @brief Gravity calculation using GRAPE. * @author Hanno Rein <hanno@hanno-rein.de> * * @details GRAPE is a special purpose hardware to accelerate * N-body simulations. This routine calculates self gravity using * a GRAPE 7 card. * * * @section LICENSE * Copyright (c) 2011 Hanno ...
C
Unknown
4,638
[ascl:1110.016]
https://github.com/hannorein/rebound
legacy/ocl_macros.h
#if !defined OCL_MACROS_H #define OCL_MACROS_H #define LOG_OCL_ERROR(x, STRING ) if(x!=CL_SUCCESS) {printf( "\nLine No: %d ", __LINE__ ); printf(STRING); printf("\n Error= %d\n",x); exit(-1); } #define LOG_OCL_COMPILER_ERROR(PROGRAM, DEVICE) \ { ...
C/C++ Header
Unknown
6,839
[ascl:1110.016]
https://github.com/hannorein/rebound
legacy/gravity_fft.c
/** * @file gravity.c * @brief Gravity calculation on a grid using an FFT. * @author Hanno Rein <hanno@hanno-rein.de>, Geoffroy Lesur <geoffroy.lesur@obs.ujf-grenoble.fr> * * @details This is a 2D FFT poisson solver for periodic and shearing sheet boxes. * It has not been well tested yet, so use with cautio...
C
Unknown
17,671
[ascl:1110.016]
https://github.com/hannorein/rebound
legacy/collisions_sweepphi.c
/** * @file collisions.c * @brief Collision search using a line sweep algorithm, O(N log(N)). * @author Hanno Rein <hanno@hanno-rein.de> * * @details The routines in this file implement a collision detection * method called line sweep. It is very fast if all dimensions except one * are small. The algorithm ...
C
Unknown
13,062
[ascl:1110.016]
https://github.com/hannorein/rebound
legacy/gravity_opencl.c
/** * @file gravity.c * @brief Direct gravity calculation, O(N^2). * @author Hanno Rein <hanno@hanno-rein.de> * * @details This is the crudest implementation of an N-body code * which sums up every pair of particles. It is only useful very small * particle numbers (N<~100) as it scales as O(N^2). Note that ...
C
Unknown
8,362
[ascl:1110.016]
https://github.com/hannorein/rebound
legacy/collisions_sweep.c
/** * @file collisions.c * @brief Collision search using a line sweep algorithm, O(N log(N)). * @author Hanno Rein <hanno@hanno-rein.de> * * @details The routines in this file implement a collision detection * method called line sweep. It is very fast if all dimensions except one * are small. The algorithm ...
C
Unknown
12,982
[ascl:1110.016]
https://github.com/hannorein/rebound
legacy/shearing_sheet_fft/problem.c
/** * @file problem.c * @brief Example problem: shearing sheet. * @author Hanno Rein <hanno@hanno-rein.de> * @detail This problem is identical to the other shearing * sheet examples but uses an FFT based gravity solver. * To run this example, you need to install the FFTW library. * Collisions are detected ...
C
Unknown
3,857
[ascl:1110.016]
https://github.com/hannorein/rebound
legacy/shearing_sheet_grape/problem.c
/** * @file problem.c * @brief Example problem: shearing sheet. * @author Hanno Rein <hanno@hanno-rein.de> * @detail This is yet another shearing sheet example, * it uses a GRAPE to calculate gravity. Note that you need to have * a physical GRAPE card installed in your computer to run this * simulation. P...
C
Unknown
4,555
[ascl:1110.016]
https://github.com/hannorein/rebound
legacy/opencl/problem.c
/** * @file problem.c * @brief Example problem: opencl. * @author Hanno Rein <hanno@hanno-rein.de> * @detail A self-gravitating disc is integrated using * the OpenCL direct gravity summation module. * * This is a very simple implementation (see `gravity_opencl.c`). * Currently it only supports floating poi...
C
Unknown
3,159
[ascl:1110.016]
https://github.com/hannorein/rebound
legacy/restricted_threebody_mpi/problem.c
/** * @file problem.c * @brief Example problem: Restricted three body problem and MPI. * @author Hanno Rein <hanno@hanno-rein.de> * @detail This problem uses MPI to calculate the restricted three * body problem. Active particles are copied to all nodes. All other * particles only exist on one node and are no...
C
Unknown
4,071
[ascl:1110.016]
https://github.com/hannorein/rebound
legacy/selfgravity_disc_grape/problem.c
/** * @file problem.c * @brief Example problem: self-gravity disc. * @author Hanno Rein <hanno@hanno-rein.de> * @detail A self-gravitating disc is integrated using * the leap frog integrator. This example is using the GRAPE * module to calculate the self-gravity. You need to have a physical * GRAPE card in y...
C
Unknown
2,793
[ascl:1110.016]
https://github.com/hannorein/rebound
web_client/problem.c
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> #include <emscripten/fetch.h> #include "rebound.h" #include "fmemopen.h" #include "display.h" #include "input.h" int first = 1; double reconnect_delay = 1.; void request_frame_from_server(struct reb_simulation* r); EM_JS(void, reb_hide_cons...
C
Unknown
5,498
[ascl:1110.016]
https://github.com/hannorein/rebound
ipython_examples/Horizons.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Adding particles using NASA JPL Horizons system\n", "\n", "REBOUND can add particles to simulations by obtaining ephemerides from NASA's powerful HORIZONS database. HORIZONS supports many different options, and we will certa...
Jupyter Notebook
Unknown
14,176
[ascl:1110.016]
https://github.com/hannorein/rebound
ipython_examples/SimulationarchiveRestart.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Using the Simulationarchive to restart a simulation\n", "The Simulationarchive (SA) is a binary file that can be used to restart a simulation. This can be useful when running a long simulation. REBOUND can restart simulation *exa...
Jupyter Notebook
Unknown
6,784
[ascl:1110.016]
https://github.com/hannorein/rebound
ipython_examples/Units.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Unit convenience functions" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "For convenience, REBOUND offers simple functionality for converting units. One implicitly sets the units for the simulation...
Jupyter Notebook
Unknown
7,456
[ascl:1110.016]
https://github.com/hannorein/rebound
ipython_examples/Churyumov-Gerasimenko.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# The comet 67P/Churyumov–Gerasimenko\n", "\n", "This tutorial teaches you how to use the IAS15 integrator (Rein and Spiegel, 2015) to simulate the orbit of 67P/Churyumov–Gerasimenko. We will download the data from NASA Horizon...
Jupyter Notebook
Unknown
146,364
[ascl:1110.016]
https://github.com/hannorein/rebound
ipython_examples/RealtimeVisualizations.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Real-time Visualization Widget\n", "\n", "\n", "REBOUND comes with built-in real-time 3D visualizations. This feature can be used without python. This notebookbook describes how you can access real time visualizations dir...
Jupyter Notebook
Unknown
8,860
[ascl:1110.016]
https://github.com/hannorein/rebound
ipython_examples/HighOrderSymplectic.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# High Order Symplectic Integrators\n", "\n", "These notebooks show how to use the high order symplectic integrators of Wisdom et al. (1996) and Laskar & Robutel (2001) with REBOUND. See Rein, Tamayo & Brown (2019) for an over...
Jupyter Notebook
Unknown
166,413
[ascl:1110.016]
https://github.com/hannorein/rebound
ipython_examples/OrbitalElements.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Orbital Elements\n", "\n", "**Note: All angles for orbital elements are in radians**\n", "\n", "We can add particles to a simulation by specifying cartesian components:" ] }, { "cell_type": "code", "exec...
Jupyter Notebook
Unknown
143,842
[ascl:1110.016]
https://github.com/hannorein/rebound
ipython_examples/Simulationarchive.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Simulationarchive\n", "A Simulationarchive (Rein & Tamayo 2017) is useful when one runs long simulations. With the Simulationarchive, one can easily take snapshots of the simulation, and then later restart and analyze it. Since S...
Jupyter Notebook
Unknown
64,782
[ascl:1110.016]
https://github.com/hannorein/rebound
ipython_examples/PoincareMap.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Poincare Map\n", "This example shows how to calculate a simple Poincare Map with REBOUND. A Poincare Map (or sometimes called Poincare Section) can be helpful to understand dynamical systems." ] }, { "cell_type": "code"...
Jupyter Notebook
Unknown
232,155
[ascl:1110.016]
https://github.com/hannorein/rebound
ipython_examples/Holmberg.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Holmberg\n", "In 1941, Erik Holmberg performed arguably the first N-body simulation on the dynamics of interacting galaxies. He used light bulbs to simulate the gravitational interaction of stars as both gravitational force and l...
Jupyter Notebook
Unknown
227,125
[ascl:1110.016]
https://github.com/hannorein/rebound
ipython_examples/TransitTimingVariations.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Calculating Transit Timing Variations (TTV) with REBOUND\n", "The following code finds the transit times in a two planet system. The transit times of the inner planet are not exactly periodic, due to planet-planet interactions." ...
Jupyter Notebook
Unknown
23,896
[ascl:1110.016]
https://github.com/hannorein/rebound
ipython_examples/EmbeddedOperatorSplittingMethods.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Embedded Operator Splitting (EOS) Methods\n", "\n", "This examples shows how to use the Embedded Operator Splitting (EOS) Methods described in Rein (2019). The idea is to embedded one operator splitting method inside another....
Jupyter Notebook
Unknown
349,180
[ascl:1110.016]
https://github.com/hannorein/rebound
ipython_examples/HybridIntegrationsWithTRACE.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Hybrid integrations with TRACE\n", "REBOUND comes with several integrators, each of which has its own advantages and disadvantages. TRACE is a time-reversible hybrid integrator (Lu, Hernandez & Rein 2024) that is an improvement o...
Jupyter Notebook
Unknown
48,241
[ascl:1110.016]
https://github.com/hannorein/rebound
ipython_examples/Checkpoints.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Checkpoints\n", "You can easily save and load a REBOUND simulation to a binary file. The binary file includes all information about the particles (mass, position, velocity, etc), as well as the current simulation settings such as...
Jupyter Notebook
Unknown
3,656
[ascl:1110.016]
https://github.com/hannorein/rebound
ipython_examples/VariationalEquationsWithChainRule.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Using Variational Equations With the Chain Rule\n", "\n", "For a complete introduction to variational equations, please read the paper by Rein and Tamayo (2016).\n", "\n", "Variational equations can be used to calcula...
Jupyter Notebook
Unknown
13,384
[ascl:1110.016]
https://github.com/hannorein/rebound
ipython_examples/Cheartbeat.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Using a C Heartbeat function\n", "The heartbeat function of a REBOUND simulation gets called after every timestep. There are many different things you can do in a heartbeat function, for example creating outputs, adding particles...
Jupyter Notebook
Unknown
8,461
[ascl:1110.016]
https://github.com/hannorein/rebound
ipython_examples/Megno.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Stability map with MEGNO and WHFast\n", "In this tutorial, we'll create a stability map of a two planet system using the chaos indicator MEGNO (Mean Exponential Growth of Nearby Orbits) and the symplectic integrator WHFast (Rein ...
Jupyter Notebook
Unknown
61,410
[ascl:1110.016]
https://github.com/hannorein/rebound
ipython_examples/VariationalEquations.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Variational Equations\n", "For a complete introduction to variational equations, please read the paper by Rein and Tamayo (2016).\n", "\n", "For this tutorial, we work with a two planet system. We vary the initial semi-ma...
Jupyter Notebook
Unknown
122,325
[ascl:1110.016]
https://github.com/hannorein/rebound
ipython_examples/CloseEncounters.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Catching close encounters using exceptions\n", "Sometimes one is interested in catching a close encounter between two planets. This can easily be done with REBOUND. What you do when a close encounter happens is up to you.\n", ...
Jupyter Notebook
Unknown
52,891
[ascl:1110.016]
https://github.com/hannorein/rebound
ipython_examples/SaturnsRings.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Simulating Saturn's rings\n", "\n", "In this example, we will simulate a small patch of Saturn's rings. The simulation is similar to the C example in `examples/shearing_sheet`.\n", "\n", "We first import REBOUND and n...
Jupyter Notebook
Unknown
624,678
[ascl:1110.016]
https://github.com/hannorein/rebound
ipython_examples/PoincareSurfaceOfSection.ipynb
{ "cells": [ { "cell_type": "markdown", "id": "e5684d15", "metadata": {}, "source": [ "# Poincare surface of section\n", "This example uses `rebound` to create a [Poincare surface of section](https://en.wikipedia.org/wiki/Poincaré_map) of the restricted circular three body problem (RC3BP). First,...
Jupyter Notebook
Unknown
87,231
[ascl:1110.016]
https://github.com/hannorein/rebound
ipython_examples/Starman.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Starman" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This notebook integrates the orbit of Elon Musk's Tesla and Starman. " ] }, { "cell_type": "code", "execution_count": 1, "metad...
Jupyter Notebook
Unknown
356,522
[ascl:1110.016]
https://github.com/hannorein/rebound
ipython_examples/ipynb2py.py
import json import sys exec("import matplotlib as mpl") exec("mpl.use(\"Agg\")") if len(sys.argv)!=2: print("Usage: ipynb2py.py FILENAME") exit(1) with open(sys.argv[1]) as data_file: ipynb = json.load(data_file) code = "" for c in ipynb["cells"]: if c["cell_type"] == "code": source = c["s...
Python
Unknown
643
[ascl:1110.016]
https://github.com/hannorein/rebound
ipython_examples/EscapingParticles.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": { "collapsed": true }, "source": [ "# Escaping particles\n", "\n", "Sometimes we are not interested in particles that get too far from the central body. Here we will define a radius beyond which we remove particles from the simulation. ...
Jupyter Notebook
Unknown
27,227
[ascl:1110.016]
https://github.com/hannorein/rebound
ipython_examples/Testparticles.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Test particles\n", "In this tutorial, we run a simulation with many test particles. A simulation with test particles can be much faster, because it scales as $\\mathcal{O}(N)$ compared to a simulation with massive particles, whic...
Jupyter Notebook
Unknown
186,827
[ascl:1110.016]
https://github.com/hannorein/rebound
ipython_examples/User_Defined_Collision_Resolve.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# User Defined Rebound Collision Resolutions\n", "\n", "In the [CloseEncounter](https://rebound.hanno-rein.de/ipython_examples/CloseEncounters/) example, we discuss methods for resolving collisions in REBOUND through exceptions...
Jupyter Notebook
Unknown
40,256
[ascl:1110.016]
https://github.com/hannorein/rebound
ipython_examples/HyperbolicOrbits.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Loading Hyperbolic Orbits into REBOUND\n", "\n", "Imagine we have a table of orbital elements for comets (kindly provided by Toni Engelhardt)." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {},...
Jupyter Notebook
Unknown
112,678
[ascl:1110.016]
https://github.com/hannorein/rebound
ipython_examples/EccentricComets.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Integrating eccentric Comets with TRACE\n", "In this example, we study highly eccentric comets which interact with a Neptune mass planet.\n", "\n", "TRACE is a hybrid integration scheme which combines the WHFAST and BS al...
Jupyter Notebook
Unknown
133,126
[ascl:1110.016]
https://github.com/hannorein/rebound
ipython_examples/AdvWHFast.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": { "deletable": true, "editable": true }, "source": [ "# Advanced settings for WHFast: Extra speed, accuracy, and additional forces\n", "\n", "There are several performance enhancements one can make to WHFast. However, each one has ...
Jupyter Notebook
Unknown
19,619
[ascl:1110.016]
https://github.com/hannorein/rebound
ipython_examples/FourierSpectrum.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Fourier analysis & resonances\n", "\n", "A great benefit of being able to call rebound from within python is the ability to directly apply sophisticated analysis tools from scipy and other python libraries. Here we will do a...
Jupyter Notebook
Unknown
222,990
[ascl:1110.016]
https://github.com/hannorein/rebound
ipython_examples/Rotations.ipynb
{ "cells": [ { "cell_type": "markdown", "id": "ba32220e", "metadata": {}, "source": [ "# Rotations\n", "\n", "This gives an introduction to REBOUND's built-in rotations framework, with a focus on rotations typically encountered in celestial mechanics.\n", "\n", "REBOUND has a general ...
Jupyter Notebook
Unknown
95,068
[ascl:1110.016]
https://github.com/hannorein/rebound
ipython_examples/PrimordialEarth.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Primordial Earth\n", "There are a wide variety of problems in the context of the Solar System requiring accurate integration of N-bodies undergoing close encounters and/or collisions. Standard integrators such as IAS15 and WHFast...
Jupyter Notebook
Unknown
83,463
[ascl:1110.016]
https://github.com/hannorein/rebound
ipython_examples/UniquelyIdentifyingParticlesWithHashes.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Uniquely Identifying Particles With Hashes\n", "\n", "In many cases, one can just identify particles by their position in the particle array, e.g. using ``sim.particles[5]``. However, in cases where particles might get reorde...
Jupyter Notebook
Unknown
13,085
[ascl:1110.016]
https://github.com/hannorein/rebound
ipython_examples/RemovingParticlesFromSimulation.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Removing particles from the simulation\n", "\n", "This tutorial shows the different ways to remove particles from a REBOUND simulation. Let us start by setting up a simple simulation with 10 bodies, and assign them unique has...
Jupyter Notebook
Unknown
55,945
[ascl:1110.016]
https://github.com/hannorein/rebound
ipython_examples/OrbitPlot.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Orbit Plot\n", "*Note that OrbitPlot has changed from being a function to a class in REBOUND version 3.22.* \n", "\n", "REBOUND comes with a simple way to plot instantaneous orbits of planetary systems. To show how this w...
Jupyter Notebook
Unknown
601,273
[ascl:1110.016]
https://github.com/hannorein/rebound
ipython_examples/FrequencyAnalysis.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Frequency Analysis\n", "This examples shows how to perform a Modified Fourier Transform (MFT), or a Frequency Modified Fourier Transform (FMFT) on timeseries data using REBOUND. This can be used to determine the fundamental or se...
Jupyter Notebook
Unknown
298,757
[ascl:1110.016]
https://github.com/hannorein/rebound
ipython_examples/IntegratingArbitraryODEs.ipynb
{ "cells": [ { "cell_type": "markdown", "id": "ac2c0891", "metadata": {}, "source": [ "# Integrating arbitrary ODEs\n", "\n", "Although REBOUND is primarily an N-body integrator, it can also integrate arbitrary ordinary differential equations (ODEs). Even better: it can integrate arbitrary OD...
Jupyter Notebook
Unknown
122,092
[ascl:1110.016]
https://github.com/hannorein/rebound
ipython_examples/Forces.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Additional forces\n", "REBOUND is a gravitational N-body integrator. But you can also use it to integrate systems with additional, non-gravitational forces.\n", "\n", "This tutorial gives you a very quick overview of how ...
Jupyter Notebook
Unknown
49,874
[ascl:1110.016]
https://github.com/hannorein/rebound
ipython_examples/WHFast.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# WHFast tutorial\n", "\n", "This tutorial is an introduction to the python interface of WHFast, a fast and unbiased symplectic Wisdom-Holman integrator. This integrator is well suited for integrations of planetary systems in w...
Jupyter Notebook
Unknown
116,137
[ascl:1110.016]
https://github.com/hannorein/rebound
ipython_examples/Resonances_of_Jupiters_moons.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Resonances of Jupiter's moons, Io, Europa, and Ganymede\n", "\n", "Example provided by Deborah Lokhorst. In this example, the four Galilean moons of Jupiter are downloaded from HORIZONS and their orbits are integrated forward...
Jupyter Notebook
Unknown
533,444
[ascl:1110.016]
https://github.com/hannorein/rebound
ipython_examples/ChaoticHyperion.ipynb
{ "cells": [ { "cell_type": "markdown", "id": "6882e778", "metadata": {}, "source": [ "# Chaotic Hyperion\n", "In this example, we simulate the spin of Hyperion. The spin evolution is governed by an ordinary differential equation that is coupled to the moon's orbit. \n", "\n", "We start b...
Jupyter Notebook
Unknown
25,909
[ascl:2011.020]
https://github.com/dtamayo/reboundx
.travis.yml
language: python sudo: false env: - TESTPART=CCOVERAGE - TESTPART=C - TESTPART=PYTHON - TESTPART=IPYTHON1 - TESTPART=IPYTHON2 python: - "2.7" - "3.9" matrix: exclude: - env: TESTPART=C python: "3.9" - env: TESTPART=CCOVERAGE python: "3.9" addons: apt: sources: ...
YAML
Unknown
5,861
[ascl:2011.020]
https://github.com/dtamayo/reboundx
README.rst
.. image:: https://img.shields.io/badge/REBOUNDx-v4.6.1-green.svg?style=flat :target: https://reboundx.readthedocs.org .. image:: https://badge.fury.io/py/reboundx.svg :target: https://badge.fury.io/py/reboundx .. image:: https://travis-ci.org/dtamayo/reboundx.svg?branch=master :target: https://travis-ci.or...
reStructuredText
Unknown
2,218
[ascl:2011.020]
https://github.com/dtamayo/reboundx
pyproject.toml
[build-system] requires = ["setuptools >= 68.0.0", "rebound >= 4.6.0"] build-backend = "setuptools.build_meta" [tool.cibuildwheel] skip = "cp36*" build = "cp38*" manylinux-x86_64-image = "manylinux2014" [tool.uv] no-build-isolation = true
TOML
Unknown
241
[ascl:2011.020]
https://github.com/dtamayo/reboundx
setup.py
from codecs import open import os import inspect import sys import sysconfig def get_reb_paths(sitepackagesdir): try: import rebound rebdir = os.path.dirname(inspect.getfile(rebound)) version = rebound.__version__ except: raise AttributeError("REBOUND was not installed.") ...
Python
Unknown
7,115
[ascl:2011.020]
https://github.com/dtamayo/reboundx
.readthedocs.yml
# .readthedocs.yml # Read the Docs configuration file # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details # Required version: 2 build: os: ubuntu-22.04 tools: python: "3.11" # Build documentation in the docs/ directory with Sphinx sphinx: configuration: doc/conf.py # Build document...
YAML
Unknown
607
[ascl:2011.020]
https://github.com/dtamayo/reboundx
update_version.py
#!/usr/bin/python # This script automatically creates a list of examples by reading the header in all problem.c files. import glob import subprocess ghash = subprocess.check_output(["git", "rev-parse", "HEAD"]).decode("ascii").strip() with open("version.txt") as f: reboundxversion = f.readlines()[0].strip() pr...
Python
Unknown
3,314
[ascl:2011.020]
https://github.com/dtamayo/reboundx
changelog.md
# Changelog This changelog only includes the most important changes in recent updates. For a full log of all changes, please refer to git. ### Version 4.6.1 * Updated to match REBOUND 4.6.0 (merging of internal part1 and part2 functions in integrators) ### Version 4.6.0 * Added tides\_dynamical to model dynamical ti...
Markdown
Unknown
1,722
[ascl:2011.020]
https://github.com/dtamayo/reboundx
requirements.txt
matplotlib numpy rebound
Text
Unknown
25
[ascl:2011.020]
https://github.com/dtamayo/reboundx
version.txt
4.6.1
Text
Unknown
6
[ascl:2011.020]
https://github.com/dtamayo/reboundx
.github/workflows/python.yml
name: REBOUNDx (python) on: [push, pull_request] jobs: build: name: Python tests on ${{ matrix.os }} (${{ matrix.python-version }}) timeout-minutes: 10 runs-on: ${{ matrix.os }} strategy: matrix: python-version: ["3.11"] os: [ubuntu-latest, macos-latest] steps: - us...
YAML
Unknown
893
[ascl:2011.020]
https://github.com/dtamayo/reboundx
.github/workflows/upload_pypi.yml
name: Upload to PyPI on: workflow_dispatch: push: branches: - main release: types: - published jobs: make_sdist: name: Make SDist runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 # Optional, use if you use setuptools_scm - n...
YAML
Unknown
879
[ascl:2011.020]
https://github.com/dtamayo/reboundx
.github/workflows/ipynb.yml
name: REBOUNDx (ipynb) on: [push, pull_request] jobs: build: runs-on: ubuntu-latest strategy: matrix: python-version: ["3.10", "3.11"] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: ...
YAML
Unknown
2,524
[ascl:2011.020]
https://github.com/dtamayo/reboundx
.github/workflows/c.yml
name: REBOUNDx (C) on: [push, pull_request] jobs: build: name: Compiling C examples on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-latest, macos-latest] steps: - uses: actions/checkout@v4 - uses: ilammy/msvc-dev-cmd@v1 - name: Checkout R...
YAML
Unknown
1,133
[ascl:2011.020]
https://github.com/dtamayo/reboundx
reboundx/constants.py
""" These are constants in REBOUND default units of AU, solar masses and (yr/2pi), in which case G=1 """ C= 10065.32012038219 # speed of light
Python
Unknown
145
[ascl:2011.020]
https://github.com/dtamayo/reboundx
reboundx/__init__.py
# -*- coding: utf-8 -*- import warnings #Find suffix import sysconfig suffix = sysconfig.get_config_var('EXT_SUFFIX') if suffix is None: suffix = ".so" #Import shared C library import os pymodulespath = os.path.dirname(os.path.abspath(__file__)) pymodulespath = os.path.abspath(os.path.join(pymodulespath, os.pardi...
Python
Unknown
1,714
[ascl:2011.020]
https://github.com/dtamayo/reboundx
reboundx/testing.py
""" These are structures anad functions mainly used for testing from the Python side and for use in unit tests. """ from . import clibreboundx from ctypes import c_void_p, c_int, c_long, Structure, byref, c_char_p import warnings from reboundx.extras import REBX_BINARY_WARNINGS REBX_BINARY_FIELD_TYPE = { 0: '...
Python
Unknown
2,069
[ascl:2011.020]
https://github.com/dtamayo/reboundx
reboundx/params.py
import rebound import sys if sys.version_info[:2] >= (3, 8): from collections.abc import MutableMapping else: from collections import MutableMapping from .extras import Param, Node, Force, Operator, Extras, REBX_CTYPES from . import clibreboundx from ctypes import byref, c_double, c_int, c_int32, c_int64, c_uin...
Python
Unknown
5,249
[ascl:2011.020]
https://github.com/dtamayo/reboundx
reboundx/simulationarchive.py
import rebound import reboundx class Simulationarchive(rebound.Simulationarchive): """ Simulationarchive Class. """ def __init__(self, filename, rebxfilename, *args, **kwargs): """ Arguments --------- filename : str Filename of the Simulationarchive file to b...
Python
Unknown
994