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 | examples/shearing_sheet_2/problem.c | /**
* Shearing sheet (Akihiko Fujii)
*
* This example is identical to the shearing_sheet
* example but uses a different algorithm for resolving individual
* collisions. In some cases, this might give more realistic results.
* Particle properties resemble those found in Saturn's rings.
*
* In this collision re... | C | Unknown | 7,864 |
[ascl:1110.016] | https://github.com/hannorein/rebound | examples/custom_integrator/problem.c | /**
* Custom integrator
*
* This example shows how to use a custom, user-provided integrator
* with REBOUND. Here, we implement the 2nd order leap-frog integrator.
*/
#include "rebound.h"
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
void leapfrog_step(struct reb_simulation* r){
struct reb_parti... | C | Unknown | 2,427 |
[ascl:1110.016] | https://github.com/hannorein/rebound | examples/closeencounter_record/problem.c | /**
* Detect and record close encounters
*
* This example integrates a densely packed planetary system
* which becomes unstable on a timescale of only a few orbits.
* The example is identical to the `close_encounter` sample, except that
* the collisions are recorded and written to a file. What kind of collisio... | C | Unknown | 3,778 |
[ascl:1110.016] | https://github.com/hannorein/rebound | examples/simulationarchive_viewer/problem.c | /**
* Simulationarchive Viewer
*
* This example allows you load in a Simulationarchive and visualize it.
* You can use the keyboard to step through the individual snapshots.
* It work with the web-based visualization as well as with OpenGL.
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "... | C | Unknown | 3,136 |
[ascl:1110.016] | https://github.com/hannorein/rebound | examples/J2/problem.c | /**
* J2 precession
*
* This example presents an implementation of the J2 gravitational moment.
* The equation of motions are integrated with the 15th order IAS15
* integrator. The parameters in this example have been chosen to
* represent those of Saturn, but one can easily change them or even
* include higher ... | C | Unknown | 4,593 |
[ascl:1110.016] | https://github.com/hannorein/rebound | examples/profiling/problem.c | /**
* Profiling the shearing sheet example
*
* This example demonstrates how to use the profiling tool that
* comes with REBOUND to find out which parts of your code are
* slow. To turn on this option, simple set `PROFILING=1` in
* the Makefile. Make sure to run `make clean` before compiling
* this example.
*... | C | Unknown | 4,276 |
[ascl:1110.016] | https://github.com/hannorein/rebound | examples/secular_frequencies/problem.c | /**
* Secular Frequencies
*
* This example integrates the outer Solar System and then performs a
* frequency analysis using the Frequency Modified Fourier Transform
* to determine the secular frequencies (g-modes).
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "rebound.h"
double ss_pos[6]... | C | Unknown | 4,163 |
[ascl:1110.016] | https://github.com/hannorein/rebound | examples/selfgravity_plummer/problem.c | /**
* A self-gravitating Plummer sphere
*
* A self-gravitating Plummer sphere is integrated using
* the leap frog integrator. Collisions are not resolved. Note that the
* fixed timestep might not allow you to resolve individual two-body
* encounters. An alternative integrator is IAS15 which
* comes with adaptive... | C | Unknown | 1,952 |
[ascl:1110.016] | https://github.com/hannorein/rebound | examples/shearing_sheet/problem.c | /**
* Shearing sheet (Hill's approximation)
*
* This example simulates a small patch of Saturn's
* Rings in shearing sheet coordinates. If you have OpenGL enabled,
* you'll see one copy of the computational domain. Press `g` to see
* the ghost boxes which are used to calculate gravity and collisions.
* Particle... | C | Unknown | 4,685 |
[ascl:1110.016] | https://github.com/hannorein/rebound | examples/heartbeat/problem.c | /**
* How to use a heartbeat function
*
* We first create a REBOUND simulation, then we add
* two particles and integrate the system for 100 time
* units. We output the current time at every timestep.
*/
#include "rebound.h"
#include <stdio.h>
#include <stdlib.h>
void heartbeat(struct reb_simulation* r){
... | C | Unknown | 1,154 |
[ascl:1110.016] | https://github.com/hannorein/rebound | examples/animation_solar_system/problem.c | /**
* Animation of the Solar System
*
* This examples show how to use display_settings to
* programmatically change the visualization of a
* REBOUND simulation. This can be used to render movies.
* To understand what a 4x4 view matrix is, you can read
* up on linear algebra for computer graphics, specifically... | C | Unknown | 9,646 |
[ascl:1110.016] | https://github.com/hannorein/rebound | examples/shearing_sheet_mpi/problem.c | /**
* Shearing sheet with MPI
*
* This example simulates a small patch of Saturn's
* Rings in shearing sheet coordinates. The code can use MPI
* to distribute the work of the gravity and collision modules
* to other nodes. You can enable OpenGL with MPI, but this
* is a feature that might not work in all envir... | C | Unknown | 5,237 |
[ascl:1110.016] | https://github.com/hannorein/rebound | examples/screenshots/problem.c | /**
* Screenshots
*
* This example shows how to take a screenshot of a REBOUND
* simulation at the beginning of the simulation and once
* every 400 timesteps during the integration. You need to
* compile REBOUND with SERVER=1 and connect a webbrowser
* to the simulation. Only then can you take screenshots.
*... | C | Unknown | 2,180 |
[ascl:1110.016] | https://github.com/hannorein/rebound | examples/kozai/problem.c | /**
* Kozai cycles
*
* This example uses the IAS15 integrator to simulate
* a Lidov Kozai cycle of a planet perturbed by a distant star.
* The integrator automatically adjusts the timestep so that
* even very high eccentricity encounters are resolved with high
* accuracy.
*/
#include <stdio.h>
#include <std... | C | Unknown | 2,055 |
[ascl:1110.016] | https://github.com/hannorein/rebound | examples/reb_add_fmt/problem.c | /**
* Example usage of reb_simulation_add_fmt()
*
* The reb_simulation_add_fmt() function can be used to add a particle
* to the simulation by specifying the particle's coordinates
* in a variety of formats.
*/
#include "rebound.h"
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char* argv[]) {
... | C | Unknown | 3,552 |
[ascl:1110.016] | https://github.com/hannorein/rebound | examples/bouncing_string/problem.c | /**
* A string of solid spheres bouncing
*
* This example tests collision detection methods.
* The example uses a non-square, rectangular box. 10 particles are placed
* along a line. All except one of the particles are at rest initially.
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "rebou... | C | Unknown | 1,520 |
[ascl:1110.016] | https://github.com/hannorein/rebound | examples/arbitrary_ode/problem.c | /**
* Integrating arbitrary ODEs
*
* This examples shows how to integrate arbitrary ODEs
* with REBOUND. In this case we couple a harmonic
* oscillator to an N-body simulation and drive it using
* the orbital phase of a planet.
*
*/
#include "rebound.h"
#include <stdio.h>
#include <stdlib.h>
const double k =... | C | Unknown | 1,659 |
[ascl:1110.016] | https://github.com/hannorein/rebound | examples/planetesimal_disk_migration/problem.c | /**
* Planetesimal Disk Migration
*
* This example integrates a star, 2 planet, N-planetesimal disk system, with the
* outer planet at the inner edge of the planetesimal disk. The planet in the system
* migrates on a very slow timescale and one needs to run the simulation for roughly
* 10^5 dynamical timescales t... | C | Unknown | 5,127 |
[ascl:1110.016] | https://github.com/hannorein/rebound | examples/bouncing_balls/problem.c | /**
* Bouncing balls
*
* This example is a simple test of collision detection
* methods.
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "rebound.h"
int main(int argc, char* argv[]){
struct reb_simulation* r = reb_simulation_create();
// Start the visualization web server.
... | C | Unknown | 1,184 |
[ascl:1110.016] | https://github.com/hannorein/rebound | examples/solar_system_with_testparticles/problem.c | /**
* Solar System with test particles
*
* This example integrates all planets of the Solar
* System and 10000 test particles. The initial data comes
* from the NASA HORIZONS system and was saved to
* a binary file beforehand. The integrator used is WHFast
* with a 4 day timestep. Note that close encounters are... | C | Unknown | 1,855 |
[ascl:1110.016] | https://github.com/hannorein/rebound | examples/whfast512_unittests/problem.c | /**
* Unit tests for WHFast512
*
* This file contains units tests for WHFast512.
* Note that these are not run automatically
* because GitHub's CI does not support AVX5212.
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <assert.h>
#include <sched.h>
#include <stdbool.h>
#include "rebound.h... | C | Unknown | 12,278 |
[ascl:1110.016] | https://github.com/hannorein/rebound | examples/restarting_simulation/problem.c | /**
* Restarting simulations
*
* This example demonstrates how to restart a simulation
* using a binary file. A shearing sheet ring simulation is used, but
* the same method can be applied to any other type of simulation.
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "rebound.h"
void hear... | C | Unknown | 2,102 |
[ascl:1110.016] | https://github.com/hannorein/rebound | examples/selfgravity_disc_mpi/problem.c | /**
* Self-gravitating disc with MPI
*
* A self-gravitating disc is integrated using
* the leap frog integrator. Collisions are not resolved.
* This program makes use of MPI. Note that you need
* to have MPI compilers (mpicc) installed. The code is using
* four root boxes to distribute to particles to one, two... | C | Unknown | 3,355 |
[ascl:1110.016] | https://github.com/hannorein/rebound | examples/overstability/problem.c | /**
* Overstability in Saturn Rings
*
* A narrow box of Saturn's rings is simulated to study the viscous
* overstability. Collisions are resolved using the plane-sweep method.
*
* It takes about 30 orbits for the overstability to occur. You can
* speed up the calculation by turning off the visualization. Just... | C | Unknown | 2,414 |
[ascl:1110.016] | https://github.com/hannorein/rebound | examples/animation_saturns_rings/problem.c | /**
* Animation of the Saturn's Rings
*
* This examples show how to use display_settings to
* programmatically change the visualization of a
* REBOUND simulation. Here, we visualize a simulation of
* Saturn's rings and rotate the viewwing angle programmatically.
* To understand what a 4x4 view matrix is, you c... | C | Unknown | 3,954 |
[ascl:1110.016] | https://github.com/hannorein/rebound | examples/dragforce/problem.c | /**
* Velocity dependent drag force
*
* This is a very simple example on how to implement a velocity
* dependent drag force. The example uses the IAS15 integrator, which
* is ideally suited to handle non-conservative forces.
* No gravitational forces or collisions are present.
*/
#include <stdio.h>
#include <s... | C | Unknown | 2,362 |
[ascl:1110.016] | https://github.com/hannorein/rebound | examples/removing_particles_from_simulation/problem.c | /**
* Removing particles from simulations
*
* This example demonstrates different
* options for removing particles from the simulation.
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "rebound.h"
void print_hashes(struct reb_simulation* r){
printf("hashes = ");
for (int i=0;i<r->N;i+... | C | Unknown | 2,701 |
[ascl:1110.016] | https://github.com/hannorein/rebound | examples/rotations/problem.c | /**
* Using rotations in REBOUND
*
* A simple example showing how to use the built-in rotations framework in REBOUND. See also Rotations.ipynb for more details
*/
#include "rebound.h"
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char* argv[]) {
// REBOUND provides a reb_rotation struct.
// In... | C | Unknown | 3,874 |
[ascl:1110.016] | https://github.com/hannorein/rebound | examples/frequency_analysis/problem.c | /**
* Frequency Analysis
*
* This example demonstrates how to use REBOUND's built-in
* frequency analysis tools to perform a Modified Fourier
* Transform or a Frequency Modified Fourier Transform.
*/
#include "rebound.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <assert.h>
// Secular mo... | C | Unknown | 3,950 |
[ascl:1110.016] | https://github.com/hannorein/rebound | examples/restricted_threebody/problem.c | /**
* Restricted three body problem.
*
* This example simulates a disk of test particles around
* a central object, being perturbed by a planet.
* It uses the heliocentric version of WHFast.
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "rebound.h"
void heartbeat(struct reb_simulation* ... | C | Unknown | 2,392 |
[ascl:1110.016] | https://github.com/hannorein/rebound | examples/circumplanetarydust/problem.c | /**
* Radiation forces on circumplanetary dust
*
* This example shows how to integrate circumplanetary
* dust particles using the IAS15 integrator.
* The example sets the function pointer `additional_forces`
* to a function that describes the radiation forces.
* The example uses a beta parameter of 0.01.
* Th... | C | Unknown | 4,825 |
[ascl:1110.016] | https://github.com/hannorein/rebound | examples/megno/problem.c | /**
* The chaos indicator MEGNO
*
* This example uses the IAS15 or WHFAST integrator
* to calculate the MEGNO of a two planet system.
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "rebound.h"
const double ss_pos[3][3] =
{
{-4.06428567034226e-3, -6.08813756435987e-3, -1.661623042... | C | Unknown | 2,734 |
[ascl:1110.016] | https://github.com/hannorein/rebound | examples/solar_system/problem.c | /**
* Solar System
*
* This example integrates all planets of the Solar
* System. The data comes from the NASA HORIZONS system.
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "rebound.h"
double ss_pos[10][3] =
{
{3.256101656448802E-03 , -1.951205394420489E-04 , -1.478264728548705E-04}... | C | Unknown | 4,009 |
[ascl:1110.016] | https://github.com/hannorein/rebound | .github/codecov.yml | ignore:
- "rebound/tests"
| YAML | Unknown | 29 |
[ascl:1110.016] | https://github.com/hannorein/rebound | .github/workflows/cmpi.yml | name: REBOUND (C + MPI)
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install OpenMPI
run: sudo apt-get install -y -q openmpi-bin libopenmpi-dev
- name: Compile all MPI examples
working-directory: ./examples
... | YAML | Unknown | 822 |
[ascl:1110.016] | https://github.com/hannorein/rebound | .github/workflows/python.yml | name: REBOUND (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.9", "3.10", "3.11", "3.12"]
os: [ubuntu-latest, windows-latest... | YAML | Unknown | 1,713 |
[ascl:1110.016] | https://github.com/hannorein/rebound | .github/workflows/c.yml | name: REBOUND (C)
on: [push, pull_request]
jobs:
build:
name: Compiling C examples on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v3
- uses: ilammy/msvc-dev-cmd@v1
- name: Check if ... | YAML | Unknown | 934 |
[ascl:1110.016] | https://github.com/hannorein/rebound | .github/workflows/build_wheels.yml | name: Build wheels and upload to PyPI
on:
workflow_dispatch:
push:
branches:
- main
release:
types:
- published
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]... | YAML | Unknown | 1,473 |
[ascl:1110.016] | https://github.com/hannorein/rebound | .github/workflows/lint.yml | name: REBOUND (lint)
on: [push, pull_request]
jobs:
build:
name: Linting all C files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install vim
run: |
sudo apt-get install -y -q vim
ex --version
- name: Run vim linter
run: |
... | YAML | Unknown | 438 |
[ascl:1110.016] | https://github.com/hannorein/rebound | .github/workflows/reboundx.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", "3.12"]
os: [ubuntu-latest, macos-latest]
steps:
... | YAML | Unknown | 1,214 |
[ascl:1110.016] | https://github.com/hannorein/rebound | .github/workflows/ipynb.yml | name: REBOUND (ipynb)
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
wi... | YAML | Unknown | 1,913 |
[ascl:1110.016] | https://github.com/hannorein/rebound | .github/workflows/coverage.yml | name: Coverage
on: [push]
jobs:
build:
name: Checking test coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Download Codecov
run: |
curl -Os https://cli.codecov.io/latest/linux/codecov
chmod +x codecov
./codecov --version
... | YAML | Unknown | 1,085 |
[ascl:1110.016] | https://github.com/hannorein/rebound | .github/workflows/emscripten.yml | name: REBOUND (emscripten)
on: [push, pull_request]
jobs:
build:
name: Compiling with emscripten
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Download and install emscripten
run: |
git clone https://github.com/emscrip... | YAML | Unknown | 759 |
[ascl:1110.016] | https://github.com/hannorein/rebound | .github/ISSUE_TEMPLATE/feature_request.md | ---
name: Feature request
about: Do you think REBOUND is missing a feature? Describe what features you would like to see implemented in a future version of REBOUND.
title: ''
labels: feature request
assignees: ''
---
Describe what feature you would like to see added to REBOUND.
**Name/Affiliation**
It helps to know ... | Markdown | Unknown | 370 |
[ascl:1110.016] | https://github.com/hannorein/rebound | .github/ISSUE_TEMPLATE/question.md | ---
name: General question
about: Ask a general question about REBOUND.
title: ''
labels: question
assignees: ''
---
What is your question? (It helps to know your name and your affiliation if you have one.)
| Markdown | Unknown | 209 |
[ascl:1110.016] | https://github.com/hannorein/rebound | .github/ISSUE_TEMPLATE/bug_report.md | ---
name: Bug report
about: Think you encountered a bug? File a bug report and help us improve REBOUND.
title: ''
labels: bug
assignees: ''
---
**Environment**
Which version of REBOUND are you using and on what operating system?
- REBOUND Version: [e.g. 28.7.0]
- API interface: [C or Python]
- Operating System (in... | Markdown | Unknown | 885 |
[ascl:1110.016] | https://github.com/hannorein/rebound | .github/ISSUE_TEMPLATE/advice.md | ---
name: Ask for advice
about: Ask for advice on how to use REBOUND for the specific science problem that you have in mind. Get suggestions for choosing the best integrator and settings, or inquire about ways to optmimize runtime.
title: ''
labels: question
assignees: ''
---
**Environment**
Which version of REBOUND ... | Markdown | Unknown | 1,133 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/rebound.h | /**
* @file rebound.h
* @brief REBOUND API definition.
* @author Hanno Rein <hanno@hanno-rein.de>
*
* @section LICENSE
* Copyright (c) 2015 Hanno Rein, Shangfei Liu
*
* This file is part of rebound.
*
* rebound is free software: you can redistribute it and/or modify
* it under the terms of the GNU... | C/C++ Header | Unknown | 87,377 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/binary_field_descriptor.py | import ctypes
from . import clibrebound
class BinaryFieldDescriptor(ctypes.Structure):
"""
Describes the binary field in simulationarchives
Used here for unit tests only. Checking if ids are unique.
"""
def __repr__(self):
return '<{0}.{1} object at {2}, type={3}, dtype={4}, name=\'{5}\... | Python | Unknown | 1,166 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/tools.py | from ctypes import c_double, byref
import rebound
def mod2pi(x):
try:
x = float(x)
except:
ValueError("Argument of mod2pi needs to be a float.")
clibrebound.reb_mod2pi.restype = c_double
return clibrebound.reb_mod2pi(c_double(x))
def M_to_f(e, M):
try:
e = float(e)
... | Python | Unknown | 2,412 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/data.py | # -*- coding: utf-8 -*-
"""
Initial conditions for standard tests
"""
import math
from .units import hash_to_unit, units_convert_particle
def add_outer_solar_system(sim):
"""
Add the planet of the outer Solar System as a test problem.
Data taken from NASA Horizons.
"""
Gfac = 1./0.01720209895 ... | Python | Unknown | 4,258 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/orbit.py | import ctypes
from .tools import M_to_E
from .vectors import Vec3dBasic
class Orbit(ctypes.Structure):
"""
A class containing orbital parameters for a particle.
This is an abstraction of the reb_orbit data structure in C.
When using the various REBOUND functions using Orbits, all angles are in radians... | Python | Unknown | 3,644 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/particle.py | from ctypes import Structure, c_double, c_int, byref, memmove, sizeof, c_uint32, c_uint, c_uint64, string_at, POINTER, c_char, c_void_p
import math
import sys
def notNone(a):
"""
Returns True if array a contains at least one element that is not None. Returns False otherwise.
"""
return a.count(None) !=... | Python | Unknown | 46,115 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/rotation.py | import ctypes
class Rotation(ctypes.Structure):
"""
This class facilitates rotations of Vec3d objects, and provides various convenience functions
for commonly used rotations in celestial mechanics.
"""
def __init__(self, ix=None, iy=None, iz=None, r=None, angle=None, axis=None, fromv=None, tov=Non... | Python | Unknown | 10,896 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/units.py | # Unit constants
import math
from . import clibrebound
from ctypes import c_char_p, c_uint32
def hash_to_unit(hash):
clibrebound.reb_hash.restype = c_uint32
for u in times_SI.keys():
uhash = clibrebound.reb_hash(c_char_p(u.encode("ascii")))
if uhash == hash:
return u
for u in ma... | Python | Unknown | 4,762 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/vectors.py | from ctypes import Structure, c_double
class Vec6d(Structure):
_fields_ = [("x", c_double),
("y", c_double),
("z", c_double),
("vx", c_double),
("vy", c_double),
("vz", c_double)]
class Vec3dBasic(Structure):
"""
Internal use ... | Python | Unknown | 4,254 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/__init__.py | # -*- coding: utf-8 -*-
"""An N-body integrator package for python."""
import sys
import os
import warnings
import platform
from ctypes import cdll, c_char_p
# Find suffix
if platform.system()=="Windows" and sys.version_info.major<=3 and sys.version_info.minor<8:
# Using distutils.sysconfig instead of sysconfig b... | Python | Unknown | 3,714 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/simulation.py | from ctypes import Structure, c_double, POINTER, c_uint32, c_int, c_uint, c_int64, c_uint64, c_void_p, c_char_p, CFUNCTYPE, byref, create_string_buffer, addressof, c_char, c_size_t, string_at, sizeof
from . import clibrebound, Escape, NoParticles, Encounter, Collision, GenericError
from .citations import cite
from .u... | Python | Unknown | 68,520 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/widget.py | shader_code = """
<script id="orbit_shader-vs" type="x-shader/x-vertex">
uniform vec3 focus;
uniform vec3 aef;
uniform vec3 omegaOmegainc;
attribute float lintwopi;
varying float lin;
uniform mat4 mvp;
const float M_PI = 3.14159265359;
void main() {
float a = aef.x;
float e... | Python | Unknown | 26,665 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/horizons.py | # -*- coding: utf-8 -*-
"""
Pull data from HORIZONS and format it for use as a REBOUND particle.
"""
import datetime
import re
import warnings
import sys
from .units import convert_mass
HORIZONSBASEURL = "https://ssd.jpl.nasa.gov/api/horizons.api?"
if "pyodide" in sys.modules:
from urllib.parse import urlencode... | Python | Unknown | 11,214 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/simulationarchive.py | from ctypes import Structure, c_double, POINTER, c_int, c_int64, c_uint64, c_void_p, c_char_p, byref
import os
import sys
import math
import warnings
class Simulationarchive(Structure):
"""
Simulationarchive Class.
The Simulationarchive is a binary file format which includes all
settings, constants a... | Python | Unknown | 15,852 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/citations.py | # -*- coding: utf-8 -*-
"""Automatically generate citations for a simulation."""
def cite(sim):
txt = """Simulations in this paper made use of the REBOUND N-body code \\citep{rebound}. """
bib = """@ARTICLE{rebound,
author = {{Rein}, H. and {Liu}, S. -F.},
title = "{REBOUND: an open-source multi... | Python | Unknown | 15,301 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/plotting.py | # -*- coding: utf-8 -*-
from .particle import Particle
from itertools import cycle
class OrbitPlot:
"""
Class for visualizing simulations using instantaneous orbits.
"""
def __init__(self, sim, fig=None, ax=None, figsize=(5,5), projection="xy", xlim=None, ylim=None, unitlabel=None, color=False, peria... | Python | Unknown | 19,417 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/particles.py | import sys
from ctypes import c_uint32, c_uint, c_uint64, addressof, POINTER, pointer, byref
from .hash import hash as rebhash
from .particle import Particle
from . import clibrebound, ParticleNotFound
try:
# Required for Python>=3.9
from collections.abc import MutableMapping
except:
from collections impor... | Python | Unknown | 2,993 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/variation.py | import ctypes
from . import GenericError
from .particle import Particle
from .simulation import Simulation
class Variation(ctypes.Structure):
"""
REBOUND Variational Configuration Object.
This object encapsulated the configuration of one set of variational
equations in a REBOUND simulation. It is an... | Python | Unknown | 6,872 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/hash.py | import sys
from ctypes import Structure, c_uint32, c_int, c_char_p, c_uint, c_uint64
from . import clibrebound
class HashPointerPair(Structure):
_fields_ = [("hash", c_uint32),
("index", c_int)]
def hash(key):
hash_types = c_uint32, c_uint, c_uint64
PY3 = sys.version_info[0] == 3
if PY3... | Python | Unknown | 820 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/frequency_analysis.py | import ctypes
FREQUENCY_ANALYSIS_TYPES = {"mft": 0, "fmft": 1, "fmft2": 2}
FREQUENCY_ANALYSIS_ERRORS = [
(-1, "Frequency analysis error: minfreq must be smaller than maxfreq."),
(-2, "Frequency analysis error: nfreq must be larger than 0."),
(-3, "Frequency analysis error: ndata must be power of 2."),
... | Python | Unknown | 3,332 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/tests/test_frequency_analysis.py | import rebound
import unittest
import numpy as np
# Secular modes for Jupiter. Taken from Laskar (1990).
nu5 = np.array([4.2488163, 28.2206942, 3.0895148, 52.1925732, 27.0613982, 29.3799573, 28.8679427, 27.5734578, 5.4070444, 0.6671228]) # frequency, "/yr
A5 = np.array([44119.0e-6, 15750.0e-6, 1800.0e-6, 516.0e-6, 183... | Python | Unknown | 2,497 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/tests/test_simulationarchive_matrix.py | import rebound
import unittest
import warnings
class TestSimulationarchiveMatrix(unittest.TestCase):
pass
def runSimulation(test,tmax=40., restart=False, keep_unsynchronized=1, interval=None, safe_mode=True, integrator="ias15",G=1., testparticle=0,simulationarchive_version=3):
if restart:
if keep_unsy... | Python | Unknown | 5,113 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/tests/test_eos_megno.py | import rebound
import sys
import unittest
import math
class TestMegno(unittest.TestCase):
def setUp(self):
self.sim = rebound.Simulation()
def tearDown(self):
self.sim = None
def test_whfast(self):
self.sim.integrator = "eos"
self.sim.ri_eos.phi0 = "lf4"
s... | Python | Unknown | 3,119 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/tests/test_whfast_testparticles.py | import rebound
import unittest
import rebound.data
import warnings
coordinatelist = ["democraticheliocentric","whds","jacobi","barycentric"]
class TestIntegratorWHFastTestParticle(unittest.TestCase):
pass
def create_whfast_testparticle(coordinates, N, N_active):
def do_test(self):
sim = rebound.Simula... | Python | Unknown | 7,007 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/tests/test_integrator.py | import rebound
import unittest
import math
import rebound.data
import warnings
class TestIntegratorIAS15Timescale(unittest.TestCase):
def test_ias15_timescale(self):
sim = rebound.Simulation()
sim.add(m=1.)
sim.add(a=1)
tau = sim.ias15_timescale()
self.assertAlmostEqual(tau,... | Python | Unknown | 6,243 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/tests/test_particle.py | import rebound
import unittest
import math
import warnings
class TestParticleWarning(unittest.TestCase):
def test_testparticle0_with_mass(self):
sim = rebound.Simulation()
sim.add(m=1)
sim.N_active = sim.N
sim.add(m=1,a=1)
sim.testparticle_type = 1
with warnings.catc... | Python | Unknown | 12,833 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/tests/test_additional_forces.py | import rebound
import unittest
class TestAdditionalForces(unittest.TestCase):
def test_af_ias15(self):
sim = rebound.Simulation()
sim.integrator = "ias15"
sim.force_is_velocity_dependent = 1
sim.add(m=1)
sim.add(m=1e-6,a=1)
sim.add(m=1e-3,a=5)
sim.move_to_com... | Python | Unknown | 3,657 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/tests/test_variational.py | import rebound
import unittest
import math
import sys
class TestVariationalRescale(unittest.TestCase):
def test_var_rescale_ias15(self):
sim = rebound.Simulation()
sim.integrator = "ias15"
sim.add(m=1.) # Star
sim.add(m=0.000954, a=5.204, M=0.600, omega=0.257, e=0.048)
sim.a... | Python | Unknown | 13,967 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/tests/test_trace_full_ias15.py | import rebound
import unittest
import numpy as np
import math
import sys
import warnings
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 - 0.01);
... | Python | Unknown | 14,914 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/tests/test_trace_full_bs.py | import rebound
import unittest
import numpy as np
import math
import sys
import warnings
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 - 0.01);
... | Python | Unknown | 15,149 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/tests/test_whfast_advanced.py | import rebound
import unittest
import math
import rebound.data
whfastsettings1 = [ # corrector, corrector2, kernel, relative error
[0, 0,"default",2e-7],
[3, 0,"default",1e-9],
[5, 0,"default",1e-9],
[7, 0,"default",1e-9],
[11,0,"default",1e-9],
[17,0,"default",... | Python | Unknown | 6,299 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/tests/test_server.py | import rebound
import unittest
import os
import warnings
import time
import urllib.request
class TestServer(unittest.TestCase):
def test_start_without_download(self):
with open("rebound.html", "w") as f:
f.write("<h1>Hi</h1>")
sim = rebound.Simulation()
sim.start_server(port=12... | Python | Unknown | 1,835 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/tests/__init__.py | Python | Unknown | 1 | |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/tests/test_transformations.py | import rebound
import unittest
import ctypes
def getc(sim):
c = []
for i in range(sim.N):
c.append(sim.particles[i].x)
c.append(sim.particles[i].y)
c.append(sim.particles[i].z)
c.append(sim.particles[i].vx)
c.append(sim.particles[i].vy)
c.append(sim.particles[i]... | Python | Unknown | 5,691 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/tests/test_gravity.py | import rebound
import unittest
import warnings
class TestGravity(unittest.TestCase):
def test_testparticle_0(self):
sim = rebound.Simulation()
sim.testparticle_type = 0
sim.add(m=1.)
sim.add(m=1e-3, a=1.)
sim.N_active = 1
with warnings.catch_warnings(record=True... | Python | Unknown | 3,278 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/tests/test_binary_fields.py | import rebound
import rebound.binary_field_descriptor
import unittest
class TestBinaryFields(unittest.TestCase):
def test_unique(self):
l = rebound.binary_field_descriptor.binary_field_descriptor_list()
types = []
names = []
for i in l:
types.append(i.type)
n... | Python | Unknown | 498 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/tests/test_tponly_encounter.py | import rebound
import unittest
import sys
import warnings
import math
import random
from datetime import datetime
class TestTPOnlyEncounter(unittest.TestCase):
def test_tponly_encounter0_mercurius(self):
sim = rebound.Simulation()
sim.add(m=1)
sim.add(m=1e-2,a=1)
sim.add(m=1e-2... | Python | Unknown | 1,818 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/tests/test_import.py | import warnings
import unittest
class TestImport(unittest.TestCase):
def test_no_warning_on_import(self):
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
import rebound
self.assertEqual(0,len(w))
if __name__ == "__main__":
unitte... | Python | Unknown | 330 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/tests/test_plotting.py | import rebound
import unittest
import warnings
class TestPlotting(unittest.TestCase):
def setUp(self):
self.sim = rebound.Simulation()
self.sim.add(m=1)
self.sim.add(m=1e-3,a=1,e=0.1,omega=0.1,M=0.1,inc=0.1,Omega=0.1)
self.sim.add(m=1e-3,a=-2,e=1.1,omega=0.1,M=0.1,inc=0.1,Omega=0.1)... | Python | Unknown | 1,412 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/tests/test_hash.py | import rebound
import unittest
from ctypes import c_uint32
class TestHash(unittest.TestCase):
def setUp(self):
self.sim = rebound.Simulation()
self.sim.add(m=1.)
self.sim.add(a=0.1)
self.sim.add(a=1.)
self.sim.add(a=5.)
self.sim.particles[2].hash = "earth"
se... | Python | Unknown | 5,188 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/tests/test_post_timestep_modifications.py | import rebound
import unittest
mdot = 1e-6
def ptm(sim):
if sim.contents.ri_mercurius.mode == 0:
sim.contents.particles[2].m -= sim.contents.dt_last_done*mdot
class TestPostTimestepModifications(unittest.TestCase):
def test_ptm_ias15(self):
sim = rebound.Simulation()
sim.integrator = ... | Python | Unknown | 2,300 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/tests/test_data.py | import rebound
import unittest
import rebound.data as data
class TestData(unittest.TestCase):
def setUp(self):
self.sim = rebound.Simulation()
def tearDown(self):
self.sim = None
def test_add_outer_solar_system(self):
data.add_outer_solar_system(self.sim)
self.asse... | Python | Unknown | 516 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/tests/test_janus.py | import rebound
import unittest
import math
import rebound.data
class TestIntegratorJanus(unittest.TestCase):
def test_janus_energy(self):
for o, eps in [ (2,1e-4), (4,1e-8), (6,1e-9), (8,1e-11), (10,1e-13)]:
sim = rebound.Simulation()
sim.add(m=1.)
sim.add(m=1e-3,a=1.123... | Python | Unknown | 3,642 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/tests/test_copy.py | import rebound
import unittest
class TestCopy(unittest.TestCase):
def test_copy_is_same(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,Omega=0.1)
sim.integrator = "w... | Python | Unknown | 9,362 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/tests/test_restart_mercurius.py | import rebound
import unittest
class TestSimulationRestartMercurius(unittest.TestCase):
def test_sa_mercurius_restart(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,Omega=0.... | Python | Unknown | 1,484 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/tests/test_whfast.py | import rebound
import unittest
import math
import rebound.data
import warnings
class TestIntegratorWHFast(unittest.TestCase):
# WHDS
def test_whfastwhds_outersolarsystem(self):
sim = rebound.Simulation()
rebound.data.add_outer_solar_system(sim)
sim.integrator = "whfast"
... | Python | Unknown | 12,075 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/tests/test_simulation.py | import rebound
import warnings
import unittest
import os
import sys
class TestSimulation(unittest.TestCase):
def setUp(self):
self.sim = rebound.Simulation()
self.sim.t = 1.246
self.sim.add(m=1.)
self.sim.add(m=1e-3, a=1., e=0.01, omega=0.02, M=0.04, inc=0.1)
def tearDown(s... | Python | Unknown | 10,588 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/tests/test_saba.py | import rebound
import unittest
import math
import rebound.data
sabasettings1 = [ # type, relative error
["SABA2",1e-10],
["SABACM2",1e-10],
["SABACL2",1e-10],
["SABA3",2e-11],
["SABACM3",2e-11],
["SABACL3",2e-11],
["SABA4",2e-11],
["SABACM4",2e... | Python | Unknown | 5,099 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/tests/test_pickle.py | import rebound
import unittest
import pickle
import warnings
class TestPickle(unittest.TestCase):
def test_pickle_basic(self):
sim = rebound.Simulation()
sim.add(m=1)
sim.add(m=1,a=1)
sim.step()
with open("test.pickle", "wb") as f:
pickle.dump(sim, f)
... | Python | Unknown | 1,690 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/tests/test_units.py | import rebound
import unittest
import warnings
class TestUnits(unittest.TestCase):
def setUp(self):
self.sim = rebound.Simulation()
def tearDown(self):
self.sim = None
def test_units_no_particle(self):
default_units = {'length':None, 'mass':None, 'time':None}
self.... | Python | Unknown | 2,331 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/tests/test_eos.py | import rebound
import unittest
import math
class TestEOSn(unittest.TestCase):
def setUp(self):
self.sim = rebound.Simulation()
self.sim.add(m=1)
self.sim.add(m=1e-3,a=1,e=0.05,f=0.)
self.sim.add(m=1e-3,a=1.6,e=0.05,f=1.)
self.sim.move_to_com()
def tearDown(self):
... | Python | Unknown | 3,340 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/tests/test_size_of_simulation.py | import rebound
import unittest
from ctypes import c_size_t, sizeof
class TestSizeOfSimulation(unittest.TestCase):
def test_size_of_simulation(self):
cl = rebound.clibrebound
cl.reb_simulation_struct_size.res_type = c_size_t
simulation_size_c = cl.reb_simulation_struct_size()
s... | Python | Unknown | 431 |
[ascl:1110.016] | https://github.com/hannorein/rebound | rebound/tests/test_mercurius.py | import rebound
import unittest
import sys
import warnings
import os
from datetime import datetime
class TestMercurius(unittest.TestCase):
def test_no_effect_tp(self):
# tests if test particle encounters have an effect
sim = rebound.Simulation()
sim.add(m=1)
sim.add(m=1e-3,a=1)
... | Python | Unknown | 10,962 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.