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:2302.006]
https://github.com/nickk124/robust-outlier-rejection
src/NonParametric.h
/* Robust Chauvenet Rejection (RCR) Official Codebase Active Author: Nick C. Konz Former Author: Michael Maples See license at https://github.com/nickk124/RCR */ #include <vector> class NonParametric { public: NonParametric(); virtual void muFunc(std::vector<bool>&, std::vector<int>&, std::vector<double>&, std:...
C/C++ Header
Unknown
568
[ascl:2302.006]
https://github.com/nickk124/robust-outlier-rejection
src/RCR.cpp
/* Robust Chauvenet Rejection (RCR) Official Codebase Active Author: Nick C. Konz Former Author: Michael Maples See license at https://github.com/nickk124/RCR */ #include "RCR.h" namespace RCRLib { //Non-member Functions bool RCR::unityTablesLoaded = false; std::vector<double> RCR::ESUnity; std::...
C++
Unknown
267,369
[ascl:2302.006]
https://github.com/nickk124/robust-outlier-rejection
src/RCR.h
/* Robust Chauvenet Rejection (RCR) Official Codebase Active Author: Nick C. Konz Former Author: Michael Maples See license at https://github.com/nickk124/RCR */ #include <vector> #include <cmath> #include <cmath> #include <math.h> #include <algorithm> #include <float.h> #include <iterator> //#include "Demo.h" //...
C/C++ Header
Unknown
7,228
[ascl:2302.006]
https://github.com/nickk124/robust-outlier-rejection
tests/maintest.py
import rcr import numpy as np def linear(x, params): return params[0] + (x - rcr.FunctionalForm.pivot) * params[1] def linear_partial1(x, params): return 1 def linear_partial2(x, params): return x - rcr.FunctionalForm.pivot def get_pivot(xdata, weights, f, params): sum = 0 for x in xdata: ...
Python
Unknown
2,176
[ascl:2302.006]
https://github.com/nickk124/robust-outlier-rejection
tests/test.py
# for Travis import rcr data = [0, 0.1, -0.1, 0.2, -0.2, 1e50] r = rcr.RCR(rcr.LS_MODE_68) r.performBulkRejection(data) # perform outlier rejection # View results rejected_data = r.result.rejectedY assert len(rejected_data) >= 1 print(len(rejected_data))
Python
Unknown
259
[ascl:2206.022]
https://github.com/cbottrell/realsim_ifs
ifs.py
import os,sys,time import multiprocessing import numpy as np from copy import copy from shutil import copy as cp from astropy.io import fits from astropy.convolution import convolve from astropy.convolution import Gaussian2DKernel from progress.bar import FillingCirclesBar realsimPath = os.path.dirname(__file__) def ...
Python
MIT
56,401
[ascl:2206.022]
https://github.com/cbottrell/realsim_ifs
README.md
![Logo](Figures/IFS/Logo.png) RealSim-IFS is a Python tool for generating survey-realistic integral-field spectroscopy (IFS) obvervations of galaxies from numerical simulations of galaxy formation. The tool is designed primarily to emulate current and experimental observing strategies for IFS galaxy surveys in astronom...
Markdown
MIT
2,345
[ascl:2206.022]
https://github.com/cbottrell/realsim_ifs
Old/idealized_map_functions.py
import os import numpy as np from astropy.io import fits def generate_maps_losvdcube(losvd_data,vlim=700.): '''Compute moment maps for an LOSVD cube of shape (spatial_xels,spatial_yels,vels) where vels is the number of velocity elements. The velocity elements must be symmetric about zero with range [vlim,vlim] in ...
Python
MIT
2,818
[ascl:2206.022]
https://github.com/cbottrell/realsim_ifs
Old/generate_idealized-tng_observations.py
import os,sys,time,random import matplotlib.pyplot as plt from matplotlib import rc from matplotlib.patches import Circle import numpy as np from astropy.io import fits from astropy.utils.exceptions import AstropyWarning from shutil import copy as cp from copy import copy from glob import glob import RealSim_IFS import...
Python
MIT
20,075
[ascl:2206.022]
https://github.com/cbottrell/realsim_ifs
Old/Generate_TNG100-1_Diagnostic_Stellar-Ideal.py
#!/usr/bin/env python3 # Make diagnostic plots for all idealized stellar kinematic maps import matplotlib matplotlib.use('pdf') import os from glob import glob from astropy.io import fits import numpy as np import matplotlib.pyplot as plt from time import process_time from copy import copy import multiprocessing as ...
Python
MIT
5,752
[ascl:2206.022]
https://github.com/cbottrell/realsim_ifs
Old/Diagnostic_Movie.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Generate diagnostic plots\n", "\n", "Show gas/stellar surface densities, velocities, and velocity dispersions. " ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source"...
Jupyter Notebook
MIT
605,298
[ascl:2206.022]
https://github.com/cbottrell/realsim_ifs
Old/Fiber_application.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Testing Modules for Fiber Application and Datacube Construction" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "import os,sys\n", "import numpy as np\n", ...
Jupyter Notebook
MIT
679,527
[ascl:2206.022]
https://github.com/cbottrell/realsim_ifs
Old/generate_manga-tng_observations.py
import os,sys,time,random import matplotlib.pyplot as plt from matplotlib import rc from matplotlib.patches import Circle import numpy as np from astropy.io import fits from astropy.utils.exceptions import AstropyWarning from shutil import copy as cp from copy import copy from glob import glob import RealSim_IFS import...
Python
MIT
19,919
[ascl:2206.022]
https://github.com/cbottrell/realsim_ifs
Tutorials/IFS/Precision.ipynb
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Demonstration\n", "\n", "### Precision of MaNGA cube reconstruction from reduced spectra\n", "\n", "In this demo, a sample MaNGA RSS file is taken from Data Release 17. RealSim-IFS is used to spatially reconstruct flu...
Jupyter Notebook
MIT
302,210
[ascl:2206.022]
https://github.com/cbottrell/realsim_ifs
Resources/IFS/MaNGA_target_redshifts-cen.txt
3.073909133672714233e-02 3.070350736379623413e-02 2.160817198455333710e-02 2.660205215215682983e-02 2.007580362260341644e-02 2.021419629454612732e-02 3.467123582959175110e-02 3.218561783432960510e-02 6.933433562517166138e-02 3.245946019887924194e-02 3.351017832756042480e-02 3.494353964924812317e-02 3.607095777988433838...
Text
MIT
147,750
[ascl:2206.022]
https://github.com/cbottrell/realsim_ifs
Resources/IFS/MaNGA_target_redshifts-pri.txt
6.251307576894760132e-02 2.170875854790210724e-02 2.175800316035747528e-02 2.165230549871921539e-02 2.156401239335536957e-02 3.617732971906661987e-02 2.680828794836997986e-02 1.431518644094467163e-01 2.013125270605087280e-02 6.200634688138961792e-02 2.016207389533519745e-02 1.999930106103420258e-02 2.139691077172756195...
Text
MIT
442,050
[ascl:2206.022]
https://github.com/cbottrell/realsim_ifs
Resources/IFS/MaNGA_target_redshifts-sec.txt
8.376555889844894409e-02 1.209667325019836426e-01 6.759457290172576904e-02 3.587863221764564514e-02 6.182271987199783325e-02 4.570889472961425781e-02 5.158933997154235840e-02 3.745460137724876404e-02 1.221188753843307495e-01 4.892132058739662170e-02 4.578607156872749329e-02 5.177493765950202942e-02 3.715460374951362610...
Text
MIT
440,000
[ascl:2407.008]
https://github.com/cbottrell/RealSim
LICENSE.txt
MIT License Copyright (c) [2019] [Connor Bottrell] Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publis...
Text
MIT
1,077
[ascl:2407.008]
https://github.com/cbottrell/RealSim
SpecToSDSS_gri.py
#!/usr/bin/env python ''' Create photometric images from SKIRT IFS datacube. Version 0.1 SED to flux conversions use the AB system following the documentation here: http://www.astro.ljmu.ac.uk/~ikb/research/mags-fluxes/ Also found here (though incorrect in places): http://mfouesneau.github.io/docs/pyphot/ Update His...
Python
MIT
5,571
[ascl:2407.008]
https://github.com/cbottrell/RealSim
README.md
# `RealSim` ## Statistical observational realism for synthetic images from galaxy simulations This repository is for the public release of the statistical observational realism suite described in Bottrell et al (2017ab) and presented publicly in Bottrell et al (2019b). The methods are described in detail in Bottrell ...
Markdown
MIT
5,002
[ascl:2407.008]
https://github.com/cbottrell/RealSim
ObsRealism.py
#!/bin/env python ''' The statistical observational realism suite presented in Bottrell et al 2019b. If you use this suite in your research or for any other purpose, I would appreciate a citation. If you have questions or suggestions on how to improve or broaden the suite, please contact me at cbottrel "at" uvic "dot"...
Python
MIT
26,847
[ascl:2407.008]
https://github.com/cbottrell/RealSim
sqlcl.py
#!/usr/bin/env python """>> sqlcl << command line query tool by Tamas Budavari <budavari@jhu.edu> Usage: sqlcl [options] sqlfile(s) Options: -s url : URL with the ASP interface (default: pha) -f fmt : set output format (html,xml,csv - default: csv) -q query : specify query on the comma...
Python
MIT
3,122
[ascl:2407.008]
https://github.com/cbottrell/RealSim
Sources/utils/sdss-apps/readAtlasImages-v5_4_11/read.c
/* * Read a fits binary table */ #include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <math.h> #include <string.h> #include <unistd.h> #include "dervish.h" #include "phFits.h" #include "phDataIo.h" #include "phVariablePsf.h" #define FITS_SIZE 2880 /* Fits record length */ #define TYPE_OBJMASK 0 /*...
C
MIT
12,953
[ascl:2407.008]
https://github.com/cbottrell/RealSim
Sources/utils/sdss-apps/readAtlasImages-v5_4_11/phSpanUtil.h
#if !defined(PHSPANUTIL_H) #define PHSPANUTIL_H #include "dervish.h" #include "phConsts.h" /* * typedefs and prototypes to deal with spans and masks made from * lists of spans. */ typedef struct { short y, x1, x2; } SPAN; /* pragma SCHEMA */ typedef struct { const int id; /* unique ID number for OBJMA...
C/C++ Header
MIT
8,713
[ascl:2407.008]
https://github.com/cbottrell/RealSim
Sources/utils/sdss-apps/readAtlasImages-v5_4_11/phObjc.h
#if !defined(PHOBJC_H) #define PHOBJC_H #include "dervish.h" #include "phExtract.h" #include "phSpanUtil.h" #include "phFramestat.h" #include "phPeaks.h" #include "phConsts.h" /* * An enum for types of object */ typedef enum { OBJ_UNK = 0, OBJ_CR, OBJ_DEFECT, OBJ_GALAXY, OBJ_GHOST, OBJ_KNOWNOB...
C/C++ Header
MIT
18,129
[ascl:2407.008]
https://github.com/cbottrell/RealSim
Sources/utils/sdss-apps/readAtlasImages-v5_4_11/write.c
/* * Write a FITS file; BITPIX == 8 (MASK) or 16 (U16 REGION) only */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include "phFits.h" #define BITS_PER_BYTE 8 /* number of bits in a byte */ #define FITSIZE 2880 /* size of FITS record Note that we need FITSIZE+1 i...
C
MIT
6,944
[ascl:2407.008]
https://github.com/cbottrell/RealSim
Sources/utils/sdss-apps/readAtlasImages-v5_4_11/main_mask.c
/* * Read an fpM file produced by photo */ #define CALC_POLYGONS 1 /* define this if you want to use the -p flag to calculate polgonal approximations to masks */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "dervish.h" #include "phFits.h" #include "phConsts.h" #include "phSpa...
C
MIT
5,565
[ascl:2407.008]
https://github.com/cbottrell/RealSim
Sources/utils/sdss-apps/readAtlasImages-v5_4_11/phGeometry.h
#if !defined(PHGEOMETRY_H) #define PHGEOMETRY_H 1 typedef struct { int x, y; /* coordinates of point */ } POINT; typedef struct { int n; /* number of points */ POINT *p; /* the points in the polygon */ int is_convex; /* is this polygon convex? */ } POLYGON; typedef struct { int n; /* num...
C/C++ Header
MIT
1,071
[ascl:2407.008]
https://github.com/cbottrell/RealSim
Sources/utils/sdss-apps/readAtlasImages-v5_4_11/phSpanUtil.c
/* * <INTRO> * Utilities to handle masks made from SPANs */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <alloca.h> #include "dervish.h" #include "phConsts.h" #include "phSpanUtil.h" #if !defined(STAND_ALONE) # include "phUtils.h" #endif #ifndef MAXSHORT # define MAXSHORT ...
C
MIT
88,271
[ascl:2407.008]
https://github.com/cbottrell/RealSim
Sources/utils/sdss-apps/readAtlasImages-v5_4_11/phConsts.h
#if !defined(PHCONSTS_H) #define PHCONSTS_H /* * The fundamental REGION datatype; all values must be consistent! * * N.b. Use #define not typedef for PIX so as not to confuse dervish's schema */ #if !defined(FLOATING_PHOTO) # define FLOATING_PHOTO 0 #endif #define PHOTO_U16_COMPAT 0 /* try to make floating photo...
C/C++ Header
MIT
2,753
[ascl:2407.008]
https://github.com/cbottrell/RealSim
Sources/utils/sdss-apps/readAtlasImages-v5_4_11/main_PSF.c
/* * Read a psField file produced by photo */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "dervish.h" #include "phConsts.h" #include "phVariablePsf.h" #include "phFits.h" /* * some symbols to prevent dervish.o from being loaded from libatlas.a * if we are also linking against real dervish *...
C
MIT
3,299
[ascl:2407.008]
https://github.com/cbottrell/RealSim
Sources/utils/sdss-apps/readAtlasImages-v5_4_11/phRice.h
#if !defined(PH_RICE_H) #define PH_RICE_H #include "phConsts.h" #define NOT_COMPRESSED 0 /* compression protocol used */ #define RICE_COMPRESSION 1 /* Rice compression, pre Feb 1999 */ #define RICE_COMPRESSION_V2 2 /* Rice Compression, Feb 1999 --- */ #define RICE_J 128 /* number of pixels to treat together*/ /...
C/C++ Header
MIT
2,421
[ascl:2407.008]
https://github.com/cbottrell/RealSim
Sources/utils/sdss-apps/readAtlasImages-v5_4_11/dervish.c
#include <stdlib.h> #include <stdio.h> #include <string.h> #include <stdarg.h> #include "dervish.h" #include "phConsts.h" /*****************************************************************************/ /* * A routine to return this version of photo's name */ const char * phPhotoVersion(void) { static const char v...
C
MIT
6,605
[ascl:2407.008]
https://github.com/cbottrell/RealSim
Sources/utils/sdss-apps/readAtlasImages-v5_4_11/phMeasureObj.h
#include "phRandom.h" #include "phObjc.h" #include "phSpanUtil.h" #include "phRandom.h"
C/C++ Header
MIT
88
[ascl:2407.008]
https://github.com/cbottrell/RealSim
Sources/utils/sdss-apps/readAtlasImages-v5_4_11/dataIo.c
/* * The code in this file is used to flatten/inflate complex photo data types * into network-byteorder strings for output to FITS binary tables */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include "dervish.h" #include "phSpanUtil.h" #include "phObjc.h" #include "phDataIo.h" /***...
C
MIT
16,255
[ascl:2407.008]
https://github.com/cbottrell/RealSim
Sources/utils/sdss-apps/readAtlasImages-v5_4_11/phPeaks.h
typedef void *PEAKS;
C/C++ Header
MIT
21
[ascl:2407.008]
https://github.com/cbottrell/RealSim
Sources/utils/sdss-apps/readAtlasImages-v5_4_11/phOffset.h
#if !defined(PHOFFSET_H) #define PHOFFSET_H #endif
C/C++ Header
MIT
52
[ascl:2407.008]
https://github.com/cbottrell/RealSim
Sources/utils/sdss-apps/readAtlasImages-v5_4_11/phDataIo.h
#if !defined PHDATAIO_H #define PHDATAIO_H #include "phObjc.h" #include "phRice.h" /*****************************************************************************/ /* * flatten/inflate OBJMASKs to/from strings */ int phObjmaskFlatten(const OBJMASK *om, /* OBJMASK to flatten */ unsigned char *buff, /* buffer to fl...
C/C++ Header
MIT
1,479
[ascl:2407.008]
https://github.com/cbottrell/RealSim
Sources/utils/sdss-apps/readAtlasImages-v5_4_11/dervish.h
#if !defined(PHDERVISH_H) /* not DERVISH_H -- this is a fake */ #define PHDERVISH_H const char *phPhotoVersion(void); /* * Try to include the real dervish.h; if we succeed it'll define DERVISH_H * and we'll know not to provide our own fake version. */ #include <dervish.h> #if !defined(DERVISH_H) /* we didn't fi...
C/C++ Header
MIT
2,838
[ascl:2407.008]
https://github.com/cbottrell/RealSim
Sources/utils/sdss-apps/readAtlasImages-v5_4_11/variablePsf.c
/* * Code to handle variable PSFs */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <alloca.h> #include "dervish.h" #if defined(STAND_ALONE) static int shRegIntCopy(REGION *tmp_reg, const REGION *reg); #else # include "atConversions.h" /* for M_PI */ # include "phUtils.h" ...
C
MIT
47,828
[ascl:2407.008]
https://github.com/cbottrell/RealSim
Sources/utils/sdss-apps/readAtlasImages-v5_4_11/phFramestat.h
typedef void *FIELDPARAMS; #include "phRandom.h"
C/C++ Header
MIT
49
[ascl:2407.008]
https://github.com/cbottrell/RealSim
Sources/utils/sdss-apps/readAtlasImages-v5_4_11/phExtract.h
#define NANN 1
C/C++ Header
MIT
15
[ascl:2407.008]
https://github.com/cbottrell/RealSim
Sources/utils/sdss-apps/readAtlasImages-v5_4_11/atlasImages.c
/* * Create ATLAS_IMAGEs from REGIONs and OBJC lists */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <alloca.h> #include "dervish.h" #include "phRandom.h" #include "phMeasureObj.h" #include "phOffset.h" static PIX *ai_pix_set(PIX *pix, const OBJMASK *om, const REGION *reg, ...
C
MIT
31,223
[ascl:2407.008]
https://github.com/cbottrell/RealSim
Sources/utils/sdss-apps/readAtlasImages-v5_4_11/main.c
/* * Read an atlas image table produced by photo */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "dervish.h" #include "phFits.h" #include "phConsts.h" /* * some symbols to prevent dervish.o from being loaded from libatlas.a * if we are also linking against real dervish */ int verbose = 0; ...
C
MIT
3,850
[ascl:2407.008]
https://github.com/cbottrell/RealSim
Sources/utils/sdss-apps/readAtlasImages-v5_4_11/geometry.c
#include <stdio.h> #include <stdlib.h> #include "dervish.h" #include "phSpanUtil.h" #include "phGeometry.h" /*****************************************************************************/ /* * Create/destroy a general polygon */ POLYGON * phPolygonNew(int n) { POLYGON *pol = shMalloc(sizeof(POLYGON)); pol->n ...
C
MIT
8,460
[ascl:2407.008]
https://github.com/cbottrell/RealSim
Sources/utils/sdss-apps/readAtlasImages-v5_4_11/phVariablePsf.h
#if !defined(PH_VARIABLE_PSF_H) #define PH_VARIABLE_PSF_H #include "dervish.h" /* * a struct to contain coefficients describing the kernel required * to convert one PSF to another */ #define MAX_ORDER_B 5 /* maximum spatial order */ typedef struct { int shMalloc; /* was this ACOEFF shMalloced? */ int nrow...
C/C++ Header
MIT
5,962
[ascl:2407.008]
https://github.com/cbottrell/RealSim
Sources/utils/sdss-apps/readAtlasImages-v5_4_11/rice.c
#include <stdlib.h> #include <stdio.h> #include <string.h> #include "dervish.h" #include "phRice.h" /*****************************************************************************/ /* * utility functions to byte swap data */ #if defined(SDSS_LITTLE_ENDIAN) static void swap2(unsigned char *buff, int n) { int ...
C
MIT
18,852
[ascl:2407.008]
https://github.com/cbottrell/RealSim
Sources/utils/sdss-apps/readAtlasImages-v5_4_11/phRandom.h
#if !defined(PHRANDOM_H) #define PHRANDOM_H typedef void *RANDOM; #endif
C/C++ Header
MIT
75
[ascl:2407.008]
https://github.com/cbottrell/RealSim
Sources/utils/sdss-apps/readAtlasImages-v5_4_11/phFits.h
#if !defined(PHFITS_H) #define PHFITS_H #include <fcntl.h> #include "phObjc.h" typedef struct { int fd, hfd; /* file descriptors for main table and heap */ int bitpix; /* value of bitpix */ int naxis; /* number of axes */ int naxis1, naxis2; /* size of table */ int theap; /* offse...
C/C++ Header
MIT
917
[ascl:1110.016]
https://github.com/hannorein/rebound
_typos.toml
[default] extend-ignore-re = [ ".*image/png.*", ".*\"id\".*", ] [default.extend-words] ix = "ix" iy = "iy" iz = "iz" nd = "nd" pn = "pn" hel = "hel" Stoer = "Stoer" nax = "nax" yoh = "yoh" offsetp = "offsetp" Fo = "Fo" WHT = "WHT" ba = "ba" wheight = "wheight" precesses = "precesses" arange = "arange" rightt = "righ...
TOML
Unknown
479
[ascl:1110.016]
https://github.com/hannorein/rebound
version.txt
4.6.0
Text
Unknown
6
[ascl:1110.016]
https://github.com/hannorein/rebound
README.md
[![Version](https://img.shields.io/badge/rebound-v4.6.0-green.svg?style=flat)](https://rebound.hanno-rein.de) [![codecov](https://codecov.io/github/hannorein/rebound/graph/badge.svg?token=Zmynoi99Vl)](https://codecov.io/github/hannorein/rebound) [![PyPI](https://badge.fury.io/py/rebound.svg)](https://badge.fury.io/py/r...
Markdown
Unknown
9,667
[ascl:1110.016]
https://github.com/hannorein/rebound
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.x ### Version 4.6.0 * Merged the part1() and part2() functions of all integerators into a single step() function. Integrators are now responsible for updating accele...
Markdown
Unknown
36,023
[ascl:1110.016]
https://github.com/hannorein/rebound
setup.py
try: from setuptools import setup, Extension except ImportError: # Legacy distutils import. No longer available on Python > 3.12 from distutils.core import setup, Extension from codecs import open import os import sys import sysconfig suffix = sysconfig.get_config_var('EXT_SUFFIX') if suffix is None: s...
Python
Unknown
5,483
[ascl:1110.016]
https://github.com/hannorein/rebound
pyproject.toml
[build-system] requires = ["setuptools >= 59.0.0"] build-backend = "setuptools.build_meta"
TOML
Unknown
91
[ascl:1110.016]
https://github.com/hannorein/rebound
style.txt
Style Guide =========== This is a short source code style guide for REBOUND. It is not enforced in any way and only intended to be a suggestion. Functions (c) ------------- * All non-static functions have the prefix reb_ * All lower case * Multiple words are connected with underscores * "Sentences" should follow "no...
Text
Unknown
2,237
[ascl:1110.016]
https://github.com/hannorein/rebound
update_version.py
#!python # This script automatically creates a list of examples by reading the header in all problem.c files. import subprocess ghash = subprocess.check_output(["git", "rev-parse", "HEAD"]).decode("ascii").strip() with open("version.txt") as f: reboundversion = f.readlines()[0].strip() print("Updating version ...
Python
Unknown
3,902
[ascl:1110.016]
https://github.com/hannorein/rebound
mkdocs.yml
site_name: REBOUND repo_url: https://github.com/hannorein/rebound repo_name: hannorein/rebound edit_uri: "" nav: - "Home": - index.md - changelog.md - "Quick-start guide": - quickstart_installation.md - quickstart_firstexample.md - quickstart_whereto.md - "API Documentation": - api.md ...
YAML
Unknown
7,139
[ascl:1110.016]
https://github.com/hannorein/rebound
requirements.txt
matplotlib numpy
Text
Unknown
17
[ascl:1110.016]
https://github.com/hannorein/rebound
python_examples/orbital_elements/problem.py
import rebound # Create a rebound simulation sim = rebound.Simulation() # Add a particle at the origin with mass 1 sim.add(m=1.) # Add a particle with mass 1e-3 on a Keplerian # orbit around the center of mass (including all # particles added so far) with semi-major axis 1 sim.add(m=1e-3, a=1.) # Add a test par...
Python
Unknown
776
[ascl:1110.016]
https://github.com/hannorein/rebound
python_examples/simple_orbit/problem.py
# Import the rebound module import rebound # Create Simulation object sim = rebound.Simulation() # Add particle to rebound sim.add( m=1. ) sim.add( m=1e-3, a=1., e=0.1 ) # Planet 1 sim.add( a=1.4, e=0.1 ) # Massless test particle # Output orbits in Jacobi coordinates for o in sim.orbits(): print...
Python
Unknown
495
[ascl:1110.016]
https://github.com/hannorein/rebound
python_examples/outersolarsystem/problem.py
# Import the rebound module import rebound # Create a REBOUND simulation sim = rebound.Simulation() # Set variables (defaults are G=1, t=0, dt=0.01) k = 0.01720209895 # Gaussian constant sim.G = k*k # Gravitational constant # Setup particles (data taken from NASA Horizons) # This could also be easily ...
Python
Unknown
1,797
[ascl:1110.016]
https://github.com/hannorein/rebound
python_examples/simulationarchive/problem.py
# Import the rebound module import rebound filename = "simulationarchive.bin" try: sim = rebound.Simulation(filename) print("Restarting from simulationarchive. Last snapshot found at t=%.1f"%sim.t) except: print("Cannot load Simulationarchive. Creating new simulation.") sim = rebound.Simulation() s...
Python
Unknown
729
[ascl:1110.016]
https://github.com/hannorein/rebound
python_examples/megno_simple/problem.py
#!/usr/bin/python # This example script runs 2 simulations and plots the MEGNO value. Values close to <Y>=2 correspond # to regular quasi-periodic orbits. Higher values of <Y> correspond to chaotic orbits. from __future__ import print_function # Import the rebound module import rebound # Import other modules import nu...
Python
Unknown
1,024
[ascl:1110.016]
https://github.com/hannorein/rebound
python_examples/horizons/problem.py
import matplotlib; matplotlib.use("pdf") import matplotlib.pyplot as plt import rebound import socket import sys import os.path import os filename = "cache.bin" solar_system_objects = ["Sun", "Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune", "C/2014 Q2"] if os.path.isfile(filename): #...
Python
Unknown
1,716
[ascl:1110.016]
https://github.com/hannorein/rebound
python_examples/megno/problem.py
#!/usr/bin/python # This example integrates Jupiter and Saturn in the Solar system for a variety of initial conditions. # Alongside the normal equations of motions, IAS15 is used to integrate the variational equations. # These can be used to measure the Mean Exponential Growth of Nearby Orbits (MEGNO), a chaos indicato...
Python
Unknown
3,505
[ascl:1110.016]
https://github.com/hannorein/rebound
python_examples/dragforce/problem.py
# Import the rebound module import rebound # Add particles # We work in units where G=1. sim = rebound.Simulation() sim.add(m=1. ) # Test particle sim.add(m=1e-3,x=1.,vy=1. ) # Planet # Move particles so that the center of mass is (and stays) at the origin sim.move_to_com() # You can provid...
Python
Unknown
1,062
[ascl:1110.016]
https://github.com/hannorein/rebound
python_examples/longtermtest/problem.py
# Import the rebound module import sys import matplotlib; matplotlib.use("pdf") import matplotlib.pyplot as plt import rebound import numpy as np import time import warnings def simulation(par): integrator, run, trial = par sim = rebound.Simulation() k = 0.01720209895 Gfac = 1./k sim.dt = dt ...
Python
Unknown
6,149
[ascl:1110.016]
https://github.com/hannorein/rebound
docs/examples.md
# Examples in REBOUND We provide a lot of examples for REBOUND. We think examples are the easiest way to learn how to use REBOUND. This page contains a list of all examples that come with REBOUND. The examples are sorted by topic. Note that some examples use the C version, other the python version of REBOUND. Often,...
Markdown
Unknown
564
[ascl:1110.016]
https://github.com/hannorein/rebound
docs/simulationoperators.md
# Operators ## Copying simulations REBOUND makes it very easy to copy a simulation. This can be very helpful in many cases. For example, you can keep a record of your initial conditions by simply making a copy of the simulation before you start any integration. === "C" ```c struct reb_simulation* r = reb_s...
Markdown
Unknown
3,369
[ascl:1110.016]
https://github.com/hannorein/rebound
docs/namingconvention.md
# Naming Convention Starting with REBOUND version 4.0 we try to keep all variable, structure, class, and function names adhere to a naming convention which is outlined in this document. We do this because this will make it easier to users to understand what a variable or function does. There is some tension between th...
Markdown
Unknown
2,965
[ascl:1110.016]
https://github.com/hannorein/rebound
docs/generate_python_docs.py
import rebound import inspect import docstring_to_markdown def convert_code_blocks(doc): new_doc = "" lines = doc.split("\n") first = True for line in lines: if first: if line[:3]==">>>": first = False new_doc += "```python\n" new_doc +...
Python
Unknown
1,054
[ascl:1110.016]
https://github.com/hannorein/rebound
docs/particles.md
# Particle structure A particle is represented by the `reb_particle` structure in C. The python class `Particle` is an abstraction of the `reb_particle` structure in C. We will refer to both the C structure and the python object interchangeably as the *particle structure* and *particle object*. The particle object con...
Markdown
Unknown
1,924
[ascl:1110.016]
https://github.com/hannorein/rebound
docs/quickstart_whereto.md
# Where to go from here In addition to reading the [API section](api.md), you can learn most about REBOUND by looking at some of the [example problems](examples.md). The C examples are located in the `examples/` directory. The python and iPython examples are located in the `python_examples/` and `ipython_examples/` d...
Markdown
Unknown
743
[ascl:1110.016]
https://github.com/hannorein/rebound
docs/simulation.md
# Life cycle These pages describe the C structure `reb_simulation` and the python class `rebound.Simulation`. Because the python class is an abstraction of the C structure, we describe their common features in one place. We will refer to both the C structure and the python object interchangeably as the *simulation str...
Markdown
Unknown
2,958
[ascl:1110.016]
https://github.com/hannorein/rebound
docs/quickstart_firstexample.md
# Your first REBOUND simulation If you have successfully [installed REBOUND](quickstart_installation.md), then you are now ready to run your first simulation. On this page, we'll walk you through one simple example, line by line. ## Python version There are different ways to run python code: - interactively, by usi...
Markdown
Unknown
3,432
[ascl:1110.016]
https://github.com/hannorein/rebound
docs/orbitalelements.md
# Orbital elements This section discusses orbital parameters. We focus on the implementation and conventions in REBOUND. The following image illustrated the most important angles used. In REBOUND the reference direction is the positive x direction, the reference plane is the xy plane. ![Orbital elements](img/orbit....
Markdown
Unknown
3,948
[ascl:1110.016]
https://github.com/hannorein/rebound
docs/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.x ### Version 4.6.0 * Merged the part1() and part2() functions of all integerators into a single step() function. Integrators are now responsible for updating accele...
Markdown
Unknown
36,023
[ascl:1110.016]
https://github.com/hannorein/rebound
docs/api.md
# REBOUND API These pages describe the main features of REBOUND and its API. There are two structures (*objects* in Python) which you will encounter frequently when working with REBOUND. The first is the [Simulation structure](simulation.md) which contains all the configuration, status and particle data of one REBOUND...
Markdown
Unknown
1,472
[ascl:1110.016]
https://github.com/hannorein/rebound
docs/simulationtimestepping.md
# Timestepping ## Integrate In most cases, you will want to integrate your simulation to a given time. This could be the time at which you want to create the next output, or a very long time into the future, if you are waiting for an exception to happen (close encounter, ejection, etc). In those cases use this syn...
Markdown
Unknown
3,657
[ascl:1110.016]
https://github.com/hannorein/rebound
docs/integrators.md
# Integrators ![type:video](https://www.youtube.com/embed/QW5a-iH62dQ) Numerical integrators are the backbone of any N-body package. A numerical integrator evolves particles forward in time, one timestep at a time. To do that, the integrator needs to know the current position and velocity coordinates of the particle...
Markdown
Unknown
43,839
[ascl:1110.016]
https://github.com/hannorein/rebound
docs/units.md
# Units ## Using G=1 By default, REBOUND simulations use units in which $G=1$. That might be confusing at first if you're used to working in SI units. The reason for setting $G=1$ is that gravity is scale-free. Imagine a simulation with two particles orbiting each other. For REBOUND, it doesn't matter if this is a plan...
Markdown
Unknown
3,266
[ascl:1110.016]
https://github.com/hannorein/rebound
docs/simulationdiagnostics.md
# Diagnostics ## Energy You can calculate the total energy (kinetic plus potential energy) of a simulation using the following function: === "C" ```c struct reb_simulation* r = reb_simulation_create(); double energy = reb_simulation_energy(r); ``` === "Python" ```python sim = rebound.Simulati...
Markdown
Unknown
1,568
[ascl:1110.016]
https://github.com/hannorein/rebound
docs/simulationarchive.md
# Simulationarchive The concepts behind the Simulationarchive are described in detail in [Rein & Tamayo 2017](https://ui.adsabs.harvard.edu/abs/2017MNRAS.467.2377R/abstract). Further examples of how to work with the Simulationarchive are provided in an [iPython](ipython_examples/Simulationarchive.ipynb) and [C example...
Markdown
Unknown
4,157
[ascl:1110.016]
https://github.com/hannorein/rebound
docs/simulationbinaryfiles.md
# Saving simulations to disk You can use binary files to save simulations to a file and then later restore them from this file. All the particle data and the current simulation states are saved. Below is an example on how to work with binary files. === "C" ```c struct reb_simulation* r = reb_simulation_create...
Markdown
Unknown
1,221
[ascl:1110.016]
https://github.com/hannorein/rebound
docs/miscellaneous.md
# Miscellaneous tools ## Modulo two pi The following function takes the modulo of angle (in radians). The result is in the range $[0, 2\pi]$. === "C" ```c double f = reb_mod2pi(7.); // returns 0.7168 = 7 - 2*pi ``` === "Python" ```python f = rebound.mod2pi(7.) // returns 0.7168 = 7 - 2*pi ``...
Markdown
Unknown
714
[ascl:1110.016]
https://github.com/hannorein/rebound
docs/visualization.md
# Visualization Starting with version 4, REBOUND includes new real-time interactive 3D visualizations. The code for these visualization is built-upon the previous OpenGL visualizations that came with the C version of REBOUND. However, the new visualization feature has several advantages - There are zero dependencie...
Markdown
Unknown
7,417
[ascl:1110.016]
https://github.com/hannorein/rebound
docs/addingparticles.md
# Adding particles ![type:video](https://www.youtube.com/embed/FoTwDtAeJyk) Once you've created a [simulation object](simulation.md), you can add particles to it. REBOUND supports several different ways to do that. Also check out the [discussion on particle operators](particleoperators.md). ## Adding particles man...
Markdown
Unknown
7,969
[ascl:1110.016]
https://github.com/hannorein/rebound
docs/simulationvariables.md
# Variables The following example shows how to access variables in the simulation structure. === "C" ```c struct reb_simulation* r = reb_simulation_create(); r->G = 1.0; // Set the gravitational constant printf("%f\n", r->t); // print current simulation time ``` === "Python" ```...
Markdown
Unknown
13,900
[ascl:1110.016]
https://github.com/hannorein/rebound
docs/removingparticles.md
# Removing particles ## Removing all particles You can remove all particles with the following code: === "C" ```c struct reb_simulation* r = reb_simulation_create(); // ... add particles ... reb_simulation_remove_all_particles(r); ``` === "Python" ```python sim = rebound.Simulation() ...
Markdown
Unknown
3,024
[ascl:1110.016]
https://github.com/hannorein/rebound
docs/boundaryconditions.md
# Boundary conditions You can use different boundary conditions with REBOUND. ## No boundaries By default, REBOUND doesn't use boundary conditions. This means particle can have arbitrary coordinates in all three dimensions (as long as they can be represented as floating point numbers). Because this is the default s...
Markdown
Unknown
3,807
[ascl:1110.016]
https://github.com/hannorein/rebound
docs/binaryformat.md
# Binary Format REBOUND comes with its own binary format. The binary format allows you to store a current simulation state to a file or to memory. The binary format is also used when you make a copy of a simulation or when you compare two simulations with each other. The Simulationarchive is an extension of the binary...
Markdown
Unknown
6,173
[ascl:1110.016]
https://github.com/hannorein/rebound
docs/chaos.md
# Chaos indicators REBOUND supports different chaos indicators. All of these make use of variational equations, but most of the complexity is hidden. ## Initialization If you want to use a chaos indicator in REBOUND, first add all the particles to your simulations. Then, initialize the variational particles and MEGNO ...
Markdown
Unknown
4,461
[ascl:1110.016]
https://github.com/hannorein/rebound
docs/requirements.txt
mkdocs-material mkdocs-jupyter==0.24.7 #git+git://github.com/hannorein/mkdocs-jupyter mkdocs-simple-hooks mkdocs-video
Text
Unknown
119
[ascl:1110.016]
https://github.com/hannorein/rebound
docs/quickstart_installation.md
# Installation ![type:video](https://www.youtube.com/embed/_7Y3YLKyxWA) ## Choosing between C and Python You can use either C or Python when working with REBOUND. Which programming language you want to use depends on your preference and your specific application. In short: - If you want to set up a planetary syste...
Markdown
Unknown
9,025
[ascl:1110.016]
https://github.com/hannorein/rebound
docs/gravity.md
# Gravity solvers ## Basic `REB_GRAVITY_BASIC` The basic gravity routine works is the default. It works in most cases. It uses direct summation to calculate gravitational forces between all particle pairs. OpenMP parallelization is implemented. If OpenMP is turned on, the scaling is $O(N^2)$, otherwise, it is $O(\fr...
Markdown
Unknown
1,154
[ascl:1110.016]
https://github.com/hannorein/rebound
docs/simulationreferenceframes.md
# Moving reference frames Compared to other N-body codes, REBOUND does not use a predefined coordinate system. It works in any inertial frame. This makes setting up simulations and interpreting outputs more intuitive. However, one often wants to move to a specific coordinate system. REBOUND has several built-in funct...
Markdown
Unknown
2,020
[ascl:1110.016]
https://github.com/hannorein/rebound
docs/mpi.md
# MPI (Message Passing Interface) !!! info inline end Python Only the C version of REBOUND supports MPI. The python version of REBOUND does not support MPI. REBOUND supports parallelization on distributed memory systems with MPI (Message Passing Interface). This can be useful to accelerate simulations but it on...
Markdown
Unknown
2,809
[ascl:1110.016]
https://github.com/hannorein/rebound
docs/collisions.md
# Collisions ## Detecting collisions REBOUND comes with several collision detection modules. These modules check for physical collisions (the distance between two particles is closer than the sum of the radii), not close encounters. For a collision to occur between two particles, at least one of them needs to have a...
Markdown
Unknown
9,313
[ascl:1110.016]
https://github.com/hannorein/rebound
docs/particleoperators.md
# Operators ## Adding, subtracting, multiplying particles REBOUND allows you to multiply particles with scalars. In the code blow, the particle's position and velocity coordinates, and its mass are all multiplied by a constant. === "C" ```c struct reb_simulation* r = reb_simulation_create(); reb_simulatio...
Markdown
Unknown
2,663