repo
stringlengths
2
99
file
stringlengths
13
225
code
stringlengths
0
18.3M
file_length
int64
0
18.3M
avg_line_length
float64
0
1.36M
max_line_length
int64
0
4.26M
extension_type
stringclasses
1 value
amuse
amuse-main/examples/applications/iliev_test5.py
""" Radiative transfer comparison test 5 (Iliev et al 2009). This example demonstrates the coupling of a radiative transfer code to a hydrodynamics code to do radiative hydrodynamic problems. Specifically it calculates the Iliev radiative trasnfer comparison project test 5 (expanding HII region in homogeneous medium)...
9,751
25.791209
79
py
amuse
amuse-main/examples/applications/test_evrard_collapse.py
import sys import os.path from optparse import OptionParser try: from matplotlib import pyplot HAS_MATPLOTLIB = True from amuse.plot import plot, xlabel, ylabel except ImportError: HAS_MATPLOTLIB = False from amuse.test.amusetest import get_path_to_results from amuse.units import units from amuse.unit...
7,936
27.448029
83
py
amuse
amuse-main/examples/applications/test_molecular_cloud.py
import os import numpy from amuse.community.fi import interface as interface from amuse.ext.evrard_test import regular_grid_unit_cube from amuse.ext.molecular_cloud import molecular_cloud from amuse.test.amusetest import get_path_to_results from amuse.rfi.core import is_mpd_running try: from matplotlib import pyp...
2,493
23.213592
74
py
amuse
amuse-main/examples/applications/test_plummer_sphere_on_grid.py
""" In this script we simulate a plummer sphere on a grid """ from amuse.units import constants from amuse.units import units from amuse.units import nbody_system from amuse.units.generic_unit_system import ( time, length, speed, mass, density, ) from amuse.units.generic_unit_converter import ( ...
18,609
33.720149
115
py
amuse
amuse-main/examples/applications/test_HRdiagram_tracks.py
import sys import os import warnings from optparse import OptionParser from amuse.units import units from amuse.community.sse.interface import SSE from amuse.community.evtwin.interface import EVtwin from amuse.community.evtwin2sse.interface import EVtwin2SSE from amuse.community.mesa.interface import MESA from amuse...
11,883
36.021807
121
py
amuse
amuse-main/examples/applications/mercury_solarsystem3.py
# import numpy from amuse.community.mercury.interface import MercuryWayWard from amuse.community.sse.interface import SSE from amuse.ext.solarsystem import new_solar_system_for_mercury from amuse.units import units from amuse.units.quantities import VectorQuantity from amuse.plot import ( plot, native_plot, ...
1,944
26.394366
62
py
amuse
amuse-main/examples/applications/test_supernova.py
import os.path import numpy from amuse.test.amusetest import get_path_to_results try: from matplotlib import pyplot HAS_MATPLOTLIB = True from amuse.plot import plot, xlabel, ylabel except ImportError: HAS_MATPLOTLIB = False from amuse.units import units # from amuse.units import generic_unit_system # ...
8,418
34.37395
89
py
amuse
amuse-main/examples/applications/test_HRdiagram_cluster.py
import numpy import os import warnings from optparse import OptionParser from amuse.units import units from amuse.community.sse.interface import SSE from amuse.community.evtwin.interface import EVtwin from amuse.community.mesa.interface import MESA from amuse.community.cachedse.interface import CachedStellarEvolution...
7,013
28.225
109
py
amuse
amuse-main/examples/applications/test_riemann_shock_tube_problem.py
""" In this script we simulate the riemann shock tube problem in 3d. .. quote: The test set-up consists of two fluids of different densities and pressures separated by a membrane that is then removed. The resulting solution shows all three types of fluid discontinuties; a shock wave moving from the high ...
16,622
32.246
126
py
amuse
amuse-main/examples/applications/vader_ring.py
import numpy as np import matplotlib.pyplot as plt import scipy.constants as physcons from scipy.special import ive from amuse.units import units from amuse.community.vader.interface import Vader kB = physcons.k*1e7 | units.erg/units.K mH = 1e3*physcons.physical_constants['atomic mass constant'][0]*1.00794 | units.g...
4,473
28.434211
84
py
amuse
amuse-main/examples/applications/mercury_solarsystem4.py
import numpy from amuse.community.mercury.interface import MercuryWayWard from amuse.community.sse.interface import SSE from amuse.ext.solarsystem import new_solar_system_for_mercury from amuse.units import units # from amuse.units.quantities import VectorQuantity from amuse.plot import ( plot, native_plot, pl...
3,567
25.827068
62
py
amuse
amuse-main/examples/applications/linear_wave.py
""" In this script we simulate a 1d linear wave in a 2d field """ import numpy # from amuse.support.core import late # from amuse.units.quantities import VectorQuantity from amuse.units.generic_unit_system import ( time, length, speed, mass, density ) from amuse.community.capreole.interface import Cap...
9,855
32.753425
77
py
amuse
amuse-main/examples/applications/cloudshock.py
import numpy try: from matplotlib import pyplot IS_PLOT_AVAILABLE = True except ImportError: IS_PLOT_AVAILABLE = False from amuse.ext import cloud from amuse.units import generic_unit_system from amuse.community.capreole.interface import Capreole from amuse import io from amuse import datamodel class C...
7,222
31.102222
93
py
amuse
amuse-main/examples/applications/mercury_example.py
import numpy from amuse.community.mercury.interface import MercuryInterface try: # from amuse import plot from matplotlib import pyplot HAS_MATPLOTLIB = True IS_PLOT_AVAILABLE = True except ImportError: HAS_MATPLOTLIB = False IS_PLOT_AVAILABLE = False # from amuse.support.core import late # ...
7,777
29.147287
76
py
amuse
amuse-main/examples/applications/christmas_card_2010.py
import os.path from amuse.test.amusetest import get_path_to_results try: from matplotlib import pyplot HAS_MATPLOTLIB = True # from amuse.plot import plot, semilogy, xlabel, ylabel, loglog except ImportError: HAS_MATPLOTLIB = False from amuse.units import units from amuse.units import constants from am...
8,724
37.436123
124
py
amuse
amuse-main/examples/applications/vader_ringrad.py
import numpy as np import matplotlib.pyplot as plt import scipy.constants as physcons from scipy.special import ive from amuse.units import units from amuse.community.vader.interface import Vader kB = physcons.k*1e7 | units.erg/units.K mH = 1e3*physcons.physical_constants['atomic mass constant'][0]*1.00794 | units.g...
4,443
29.231293
84
py
amuse
amuse-main/examples/applications/kelvin_helmholtz.py
""" In this script we simulate Kelvin-Helmholtz Instability in 3d. """ import numpy # from amuse.support.core import late # from amuse.units.quantities import VectorQuantity from amuse.units.generic_unit_system import ( time, length, mass, speed, density ) from amuse.community.capreole.interface impor...
6,921
29.493392
76
py
amuse
amuse-main/examples/applications/asterisk_example.py
import numpy.random from amuse.units import units, nbody_system from amuse.ic.flatimf import new_flat_mass_distribution from amuse.ic.plummer import new_plummer_model from amuse.ext.particles_with_color import new_particles_with_blackbody_color from amuse.community.seba.interface import SeBa from amuse.community.bhtre...
3,433
35.531915
77
py
amuse
amuse-main/examples/applications/asterisk_movie_example.py
# import time import numpy.random from amuse.ic.flatimf import new_flat_mass_distribution from amuse.ic.plummer import new_plummer_model from amuse.units import nbody_system as nbody # from amuse.community.asterisk.interface import AsteriskInterface from amuse.community.asterisk.interface import Asterisk # from matpl...
3,988
35.935185
84
py
amuse
amuse-main/examples/applications/distributed_sunandearth.py
""" Example of usage of the distributed code based on the 'sunandearth' simple example. Evolves the dynamic evolution of the earth around the sun. """ from amuse.units import nbody_system from amuse.units import units from amuse.units import quantities from amuse.community.hermite.interface import Hermite from amuse...
3,754
24.371622
78
py
amuse
amuse-main/examples/applications/linear_wave_boundaries.py
""" In this script we simulate a 1d linear wave in a 2d field, the periodic boundaries are not handled in the code but by amuse (much slower at time of writing) """ import numpy # from amuse.support.core import late # from amuse.units.quantities import VectorQuantity from amuse.units.generic_unit_system import ( ...
15,714
33.922222
104
py
amuse
amuse-main/examples/applications/vader_selfsim.py
import numpy as np import matplotlib.pyplot as plt import scipy.constants as physcons from amuse.units import units from amuse.community.vader.interface import Vader kB = physcons.k*1e7 | units.erg/units.K mH = 1e3*physcons.physical_constants['atomic mass constant'][0]*1.00794 | units.g mu = 2.33 def setup_vader (...
3,889
26.202797
260
py
amuse
amuse-main/examples/applications/linear_wave_parts_live.py
""" In this script we simulate a 1d linear wave in a 2d field, the periodic boundaries are not handled in the code but by amuse (much slower at time of writing) """ import sys import numpy # import math # from amuse.support.core import late # from amuse.units.quantities import VectorQuantity from amuse.units.generic_u...
29,043
35.350438
125
py
amuse
amuse-main/examples/applications/galaxy_merger.py
""" Simple Galaxy Merger example simulating a merger of two Milky Way-type galaxies, collisionless particles (i.e. no gas) """ import os import os.path import numpy from amuse.units import nbody_system, units from amuse.datamodel import Particles from amuse.io import read_set_from_file, write_set_to_file from amuse....
3,960
31.735537
79
py
amuse
amuse-main/examples/applications/__init__.py
0
0
0
py
amuse
amuse-main/examples/applications/test_jeans_instability.py
from amuse.community.athena.interface import Athena from amuse.units import generic_unit_converter # from amuse.units import generic_unit_system from amuse.units import units from amuse.units import constants from amuse.test import amusetest import numpy try: from amuse import plot from matplotlib import pypl...
10,206
31.403175
79
py
amuse
amuse-main/examples/applications/mercury_solarsystem.py
# import numpy from amuse.community.mercury.interface import MercuryInterface try: from matplotlib import pyplot HAS_MATPLOTLIB = True except ImportError: HAS_MATPLOTLIB = False solarsystem = [ [ 'MERCURY', 1.66013679527193009E-07, 20., 5.43, -3.8396601741917596...
5,147
34.020408
77
py
amuse
amuse-main/examples/applications/test_blender.py
# 1BPY """ Name: 'sun-earth' Blender: 249 Group:'Add' Tooltip: 'Amuse example' """ from amuse.community.hermite.interface import Hermite from amuse.units import nbody_system from amuse.units import units from amuse.ext.blender import blender # get blender API import numpy as np from amuse import datamodel class Su...
2,202
29.597222
79
py
amuse
amuse-main/examples/applications/test_evrard.py
import os # import sys import numpy try: from matplotlib import pyplot HAS_MATPLOTLIB = True except ImportError: HAS_MATPLOTLIB = False from amuse.community.fi import interface as interface from amuse.ext.evrard_test import MakeEvrardTest # from amuse.ext.evrard_test import regular_grid_unit_cube # from a...
2,538
22.95283
70
py
amuse
amuse-main/examples/applications/imperial.py
from amuse.units.units import ( kg, m, s, N, named ) pound = named('avoirdupois pound', 'lbm', 0.45359237 * kg) g = 9.80665 * m / s**2 poundforce = named('poundforce', 'lbf', pound*g) print(poundforce.as_quantity_in(N)) feet = named('feet', 'feet', 1/3.2808399 * m) print(g.value_in(feet/s**2)) print(p...
404
27.928571
58
py
amuse
amuse-main/examples/applications/test_triple_statistics.py
""" In this script we simulate triple evolution. See papers: http://arxiv.org/abs/1004.2506 and http://arxiv.org/abs/1101.0399 """ import numpy import sys # import time from amuse.units import nbody_system, units from amuse.units.quantities import AdaptingVectorQuantity from amuse.datamodel import Particles from amu...
8,115
29.977099
79
py
amuse
amuse-main/examples/applications/test_smallcluster_async.py
import sys # import unittest import numpy # import random # import collections import os import threading import time try: from matplotlib import pyplot HAS_MATPLOTLIB = True except ImportError: HAS_MATPLOTLIB = False from amuse.units import nbody_system from amuse.units import units from amuse.io import...
7,593
32.307018
82
py
amuse
amuse-main/examples/applications/test_smallcluster.py
import sys # import unittest import numpy # import random # import collections import os try: from matplotlib import pyplot HAS_MATPLOTLIB = True except ImportError: HAS_MATPLOTLIB = False from amuse.units import nbody_system from amuse.units import units # from amuse.community.hermite.interface import H...
6,750
32.755
82
py
amuse
amuse-main/examples/applications/distributed_nosetests.py
#!/usr/bin/python import nose from amuse.units import units from amuse.community.distributed.interface import ( # DistributedAmuseInterface, DistributedAmuse, ) from amuse.community.distributed.interface import ( # Resource, # Resources, Pilot, # Pilots, ...
1,495
23.129032
76
py
amuse
amuse-main/examples/syllabus/hydro_sink_particles.py
from amuse.lab import * def hydro_sink_particles(sinks, bodies): all_lost_particles = Particles() for s in sinks: xs,ys,zs=s.x,s.y,s.z radius_squared = s.radius**2 insink=bodies.select_array(lambda x,y,z: (x-xs)**2+(y-ys)**2+(z-zs)**2 < radius_squared,['x','y','z']) if len(ins...
2,124
37.636364
112
py
amuse
amuse-main/examples/syllabus/add_function_to_particleset.py
from amuse.lab import * def function(body): return 0.2*body[0].mass bodies = Particles(1) bodies.mass = 1|units.MSun bodies.add_global_function_attribute("new_function", function) print(bodies.new_function().in_(units.MSun))
231
22.2
62
py
amuse
amuse-main/examples/syllabus/plot_salpeter.py
""" Example AMUSE sciprt for plotting the Salpeter mass function """ import numpy from matplotlib import pyplot from amuse.lab import new_salpeter_mass_distribution, units def main(N, m, M, ximf): masses = new_salpeter_mass_distribution(N, m, M, ximf) lm = numpy.log10(m.value_in(units.MSun)) lM = numpy...
1,803
36.583333
92
py
amuse
amuse-main/examples/syllabus/gravity_stellar_collision.py
""" Nbody integration of N particles with a Salpeter initial mass function between Mmin and Mmax and with stellar evolution with metalicity z. """ from __future__ import print_function from amuse.lab import * from amuse.io import store from amuse.community.seba.interface import SeBa def merge_two_stars(bodies...
5,904
43.067164
136
py
amuse
amuse-main/examples/syllabus/three_body_bridge.py
from __future__ import print_function import numpy from amuse.lab import * from amuse.couple import bridge def new_system_of_sun_and_earth(): stars = Particles(3) sun = stars[0] sun.mass = units.MSun(1.0) sun.position = units.m(numpy.array((0.0,0.0,0.0))) sun.velocity = units.ms(numpy.array((0.0,0...
2,759
31.857143
82
py
amuse
amuse-main/examples/syllabus/core_temperature_density.py
from amuse.lab import * Second_Asymptotic_Giant_Branch = 6 | units.stellar_type HeWhiteDwarf = 10 | units.stellar_type def stellar_remnant(stellar): remnant = True if stellar.particles[0].stellar_type<HeWhiteDwarf or stellar.particles[0].stellar_type>11|units.stellar_type: remnant = False retu...
1,554
36.02381
113
py
amuse
amuse-main/examples/syllabus/sun_venus_earth.py
""" Example AMUSE script for evolving Venus and Earth around the Sun. Syllabus List. 2.1 and 2.2 """ from amuse.lab import Particles, units def sun_venus_and_earth(): particles = Particles(3) sun = particles[0] sun.mass = 1.0 | units.MSun sun.position = (0.0,0.0,0.0) | units.m sun.velocity =...
2,493
31.815789
98
py
amuse
amuse-main/examples/syllabus/two_body_bridge.py
from __future__ import print_function import numpy from amuse.lab import * from amuse.couple import bridge def new_system_of_sun_and_earth(): stars = Particles(2) sun = stars[0] sun.mass = units.MSun(1.0) sun.position = units.m(numpy.array((0.0,0.0,0.0))) sun.velocity = units.ms(numpy.array((0.0,0...
2,232
29.175676
82
py
amuse
amuse-main/examples/syllabus/binary_evolution_example.py
""" Generates a grid of binaries with different, primary mass, mass ratio and separation and evolves these over time. """ from amuse.units import units from amuse.units import quantities from amuse import datamodel from amuse.community.seba.interface import SeBa from matplotlib import pyplot import numpy import time ...
3,283
35.488889
87
py
amuse
amuse-main/examples/syllabus/hydro_outflow_particles.py
import numpy from amuse.lab import * from amuse import datamodel from amuse.ext.evrard_test import uniform_unit_sphere set_printing_strategy("custom", #nbody_converter = converter, preferred_units = [units.MSun, units.AU, units.Myr], precision = 5, prefix = "", separator =...
3,715
34.390476
89
py
amuse
amuse-main/examples/syllabus/plot_plummer.py
""" Example AMUSE sciprt for generating a Plummer shere and plot the results. """ from matplotlib.pyplot import show, xlim, ylim, figure from amuse.plot import scatter, xlabel, ylabel from amuse.lab import new_plummer_model def main(N=10): figure(figsize=(5,5)) bodies = new_plummer_model(N) scatter(bo...
741
26.481481
95
py
amuse
amuse-main/examples/syllabus/gravity_kepler_disks.py
from __future__ import print_function from amuse.lab import * #from amuse.io import store #from amuse.community.seba.interface import SeBa from amuse.community.fractalcluster.interface import new_fractal_cluster_model def resolve_close_encounter(time, bodies, Johannes): Johannes.initialize_from_particles(bodies) ...
6,086
39.046053
252
py
amuse
amuse-main/examples/syllabus/star_to_hydro.py
""" Convert a 1D Henhey stellar model into a spherical particle distribution """ from amuse.units import units from amuse.community.evtwin.interface import EVtwin from amuse.ext.star_to_sph import convert_stellar_model_to_SPH from amuse.plot import sph_particles_plot, native_plot from amuse.datamodel import Particle d...
901
33.692308
78
py
amuse
amuse-main/examples/syllabus/rad_minimal.py
""" Minimalistic routine for running a radiative transfer code. """ from __future__ import print_function from amuse.lab import * def main(N=1000, Lstar=100|units.LSun, boxsize=10|units.parsec, rho=1.0 | (units.amu/units.cm**3), t_end=0.1 |units.Myr): internal_energy = (9. |units.kms)**2 source=...
2,224
35.47541
70
py
amuse
amuse-main/examples/syllabus/rad_simple.py
from __future__ import print_function from amuse.lab import * from amuse.ext.molecular_cloud import ism_cube from amuse.ext.protodisk import ProtoPlanetaryDisk from amuse.community.simplex.interface import SimpleXInterface, SimpleX,SimpleXSplitSet def new_disk_with_bump(Mstar = 1|units.MSun, Ndi...
4,649
38.07563
93
py
amuse
amuse-main/examples/syllabus/three_body_bridge_hierarchical.py
from __future__ import print_function import numpy from amuse.lab import * from amuse.couple import bridge def new_system_of_sun_and_earth(): stars = Particles(3) sun = stars[0] sun.mass = units.MSun(1.0) sun.position = units.m(numpy.array((0.0,0.0,0.0))) sun.velocity = units.ms(numpy.array((0.0,0...
2,870
31.625
82
py
amuse
amuse-main/examples/syllabus/hydro_minimal.py
""" Minimalistic routine for running a hydrodynamics solver """ from __future__ import print_function from amuse.lab import * def main(N=100, Mtot=1|units.MSun, Rvir=1|units.RSun, t_end=1|units.hour): converter=nbody_system.nbody_to_si(Mtot, Rvir) gas = new_plummer_gas_model(N, convert_nbody=converter) ...
1,799
38.130435
84
py
amuse
amuse-main/examples/syllabus/stellar_minimal.py
""" Minimalistic routine for running a stellar evolution code """ from amuse.lab import * def main(M, z, model_time): # stellar = MESA() stellar = SSE() stellar.parameters.metallicity = z stellar.particles.add_particle(Particle(mass=M)) stellar.commit_particles() initial_luminosity = ste...
1,519
33.545455
91
py
amuse
amuse-main/examples/syllabus/merge_two_stars.py
""" Initialize two stars to a ertain age and merge them using MMAMS """ import sys import numpy from amuse.lab import * from amuse.plot import plot, xlabel, ylabel from matplotlib import pyplot def merge_two_stars(Mprim, Msec, t_coll): bodies = Particles(mass=[Mprim, Msec] |units.MSun) stellar...
1,822
34.057692
97
py
amuse
amuse-main/examples/syllabus/plot_gravity.py
""" Simple visualization for N-body integration. Reads particle set from file (nbody.hdf5) and prints frames. """ from matplotlib import pyplot from amuse.plot import scatter, xlabel, ylabel from amuse.lab import * from amuse.io import store def main(filename, lim): pyplot.ion() particles = read_set_from...
1,354
32.04878
108
py
amuse
amuse-main/examples/syllabus/stellar_simple.py
""" Evolve a population of N stars. initial mass function between Mmin and Mmax and with stellar evolution with metalicity z. """ from __future__ import print_function import sys import numpy from amuse.lab import * from amuse.units.optparse import OptionParser from matplotlib import pyplot from amuse.plot imp...
3,440
33.757576
89
py
amuse
amuse-main/examples/syllabus/gravity_minimal.py
""" Minimalistic routine for running a gravity code """ from __future__ import print_function from amuse.lab import * def main(N=10, W0=7.0, t_end=10): t_end = t_end | nbody_system.time bodies = new_king_model(N, W0) bodies.scale_to_standard() gravity = Hermite() gravity.particles.add_particle...
1,274
33.459459
129
py
amuse
amuse-main/examples/syllabus/initialize_singe_star.py
""" Script for initializing a star and printing its structure """ from amuse.lab import * from matplotlib import pyplot from amuse.plot import plot, xlabel, ylabel def get_density_profile(code=MESA, M=1.0|units.MSun, z=0.02): stellar = code() stellar.parameters.metallicity = z stellar.particles.add_part...
1,414
33.512195
72
py
amuse
amuse-main/examples/syllabus/stellar_gravity_hydro.py
""" example code for bridging a gravity solver with a hydrodynamics solver """ from __future__ import print_function import numpy from amuse.lab import * from amuse.couple import bridge from amuse import datamodel from amuse.ext.evrard_test import uniform_unit_sphere def new_sph_particles_from_stellar_wind(stars, m...
8,412
37.949074
96
py
amuse
amuse-main/examples/syllabus/hydro_experiment.py
""" Simulate the hydrodynamial evolve a disk with a single bump around a star """ from __future__ import print_function from amuse.lab import * from amuse.io import store def main(Mstar = 1|units.MSun, Ndisk=100, Mdisk=0.9|units.MSun, Rmin=1.0|units.AU, Rmax=100.0|units.AU, Mbump=0.1|un...
5,136
39.769841
96
py
amuse
amuse-main/examples/syllabus/sun_and_M67.py
from __future__ import print_function import numpy from amuse.lab import * from amuse.couple import bridge from matplotlib import pyplot class MilkyWay_galaxy(object): def get_gravity_at_point(self, eps, x,y,z): phi_0 = self.get_potential_at_point(eps, x,y,z) grav = AdaptingVectorQuantity() ...
5,242
34.187919
85
py
amuse
amuse-main/examples/syllabus/rad_experiment.py
""" Simulate the radiative and hydrodynamial evolution of a disk with a single bump around a single star """ from __future__ import print_function from time import time, localtime from amuse.lab import * from amuse.ext.molecular_cloud import ism_cube from amuse.community.simplex.interface import SimpleXInterface...
10,552
40.222656
241
py
amuse
amuse-main/examples/syllabus/plot_molecular_cloud.py
""" example of molecular cloud evolution with explictly split SPH and grav evolution Initial condition is a smooth spherical cloud with random velocities as in Bonnell et al. (2003) """ from __future__ import print_function import numpy from matplotlib import pyplot from amuse.lab import * from a...
1,261
29.780488
123
py
amuse
amuse-main/examples/syllabus/gravity_potential.py
import numpy from amuse.units import units from amuse.units import constants from amuse.units import nbody_system from amuse.ext.bridge import bridge from amuse.community.phigrape.interface import PhiGRAPE from amuse.community.fi.interface import Fi from amuse.community.gadget2.interface import Gadget2 from matplotlib...
3,681
28.934959
86
py
amuse
amuse-main/examples/syllabus/stellar_massloss_response.py
""" Calculate the response of a star as a result of mass loss. """ from amuse.lab import * Second_Asymptotic_Giant_Branch = 6 | units.stellar_type set_printing_strategy("custom", preferred_units = [units.MSun, units.RSun, units.Myr], precision = 6, prefix = "", ...
2,176
36.534483
147
py
amuse
amuse-main/examples/syllabus/hydro_simple.py
""" Simple routine for running a hydrodynamics solver """ from __future__ import print_function from amuse.lab import * def main(N=100, Mtot=1|units.MSun, Rvir=1|units.RSun, t_end=1|units.day, n_steps=6): converter=nbody_system.nbody_to_si(Mtot, Rvir) bodies = new_plummer_gas_model(N, convert_nbo...
2,260
38.666667
100
py
amuse
amuse-main/examples/syllabus/merge_two_stars_sph.py
""" Initialize two stars to a ertain age and merge them using MMAMS """ import sys import numpy from amuse.lab import * from amuse.plot import plot, xlabel, ylabel from matplotlib import pyplot from orbital_elements_to_Cartesian import Orbital_elements_to_pos_vel from amuse.ext.sph_to_star import convert_SPH_to_st...
2,923
34.658537
88
py
amuse
amuse-main/examples/syllabus/gravity_hydro.py
""" example code for bridging a gravity solver with a hydrodynamics solver """ import numpy from amuse.lab import * from amuse.couple import bridge def get_kepler_elements(model_time, bh, star, converter): kep = Kepler(converter) kep.initialize_code() pos = bh.position - star.position vel = bh.veloc...
4,597
41.183486
96
py
amuse
amuse-main/examples/syllabus/molecular_cloud_to_star_cluster.py
""" example of molecular cloud evolution with explictly split SPH and grav evolution Initial condition is a smooth spherical cloud with random velocities as in Bonnell et al. (2003) """ from __future__ import print_function import numpy from matplotlib import pyplot from amuse.lab import * from a...
10,096
32.104918
367
py
amuse
amuse-main/examples/syllabus/gravity_simple.py
""" Simple routine for running a gravity code """ from __future__ import print_function from amuse.lab import * def main(N=10, W0=7.0, t_end=10, dt=1, filename="nbody.hdf5"): t_end = t_end | nbody_system.time dt = dt | t_end.unit bodies = new_king_model(N, W0) bodies.scale_to_standard() bodies.r...
2,192
38.160714
80
py
amuse
amuse-main/examples/validation/particles_and_gas_in_cluster.py
from amuse.couple import bridge from amuse.community.bhtree.interface import BHTree from amuse.community.hermite.interface import Hermite from amuse.community.fi.interface import Fi from amuse.community.octgrav.interface import Octgrav from amuse.community.gadget2.interface import Gadget2 from amuse.community.phigrape...
23,500
31.149111
151
py
amuse
amuse-main/examples/validation/particles_and_multiples.py
# from amuse.couple import bridge from amuse.community.bhtree.interface import BHTree from amuse.community.hermite.interface import Hermite from amuse.community.fi.interface import Fi from amuse.community.octgrav.interface import Octgrav # from amuse.community.gadget2.interface import Gadget2 from amuse.community.phig...
9,951
31
100
py
amuse
amuse-main/examples/validation/__init__.py
0
0
0
py
amuse
amuse-main/src/amuse/config.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ configuration from config.mk """ import os import warnings def parse_configmk(filename): configfile = open(filename, "r") lines = configfile.readlines() configfile.close() cfgvars = dict() if "amuse configuration" not in lines[0]: raise Ex...
2,968
25.747748
76
py
amuse
amuse-main/src/amuse/__init__.py
""" The Astrophysical Multipurpose Software Environment The aim of AMUSE is to provide a software framework, in which existing codes for dynamics, stellar evolution, hydrodynamics and radiative transfer can easily be coupled, in order to perform state-of-the-art simulations of a wide range of different astrophysica...
1,903
28.292308
88
py
amuse
amuse-main/src/amuse/lab.py
""" This is the public interface to the AMUSE *Astrophysical Multipurpose Software Environment* framework. """ from amuse.support.core import late from amuse.datamodel import ( particle_attributes, Particle, Particles, ParticlesSuperset, Grid, ) from amuse.io import ( write_set_to_file, read_set_from_file, ge...
4,808
26.959302
79
py
amuse
amuse-main/src/amuse/codes.py
import sys _CODES = [ 'athena', 'capreole', 'cachedse', 'gadget2', 'mesa', 'octgrav', 'twobody', 'capreole', 'hermite0', 'mocassin', 'phiGRAPE', 'athena', 'evtwin', 'hop', 'seba', 'bhtree', 'evtwin2sse', 'interface', 'smallN', 'bse', 'fi', ...
915
26.757576
96
py
amuse
amuse-main/src/amuse/community/__init__.py
from amuse.community.interface.stopping_conditions import StoppingConditionInterface from amuse.community.interface.stopping_conditions import StoppingConditions from amuse.support.options import option from amuse.support.options import OptionalAttributes from amuse.units import units from amuse.units import nbody_sy...
1,277
30.95
89
py
amuse
amuse-main/src/amuse/community/octgrav/__init__.py
# -*- mode: python; coding: utf-8 -*- __author__ = 'Evghenii Gaburov (code), Derek Groen (interface)' __author_email__ = '<egaburov@science.uva.nl>,<djgroen@science.uva.nl>' __date__ = '2008-04-14 15:42:00 CEST' # Dummy file to indicate that this directory is a package. from .interface import Octgrav
318
34.444444
71
py
amuse
amuse-main/src/amuse/community/octgrav/interface.py
from amuse.community import * from amuse.community.interface.gd import GravitationalDynamicsInterface from amuse.community.interface.gd import GravitationalDynamics from amuse.community.interface.gd import GravityFieldInterface from amuse.community.interface.gd import GravityFieldCode class OctgravInterface( CodeI...
5,783
28.814433
111
py
amuse
amuse-main/src/amuse/community/pikachu/__init__.py
from .interface import Pikachu
31
15
30
py
amuse
amuse-main/src/amuse/community/pikachu/interface.py
from amuse.community import * from amuse.community.interface.gd import GravitationalDynamicsInterface from amuse.community.interface.gd import GravitationalDynamics from amuse.community.interface.gd import GravityFieldInterface from amuse.community.interface.gd import GravityFieldCode class PikachuInterface(CodeInterf...
21,295
41.935484
142
py
amuse
amuse-main/src/amuse/community/fastkick/__init__.py
from .interface import Fastkick
32
15.5
31
py
amuse
amuse-main/src/amuse/community/fastkick/interface.py
from amuse.community import * #~from amuse.community.interface.gd import GravitationalDynamics from amuse.community.interface.gd import GravityFieldCode, GravityFieldInterface from amuse.community.interface.common import CommonCodeInterface, CommonCode class FastKickInterface(CodeInterface, CommonCodeInterface, Gravi...
10,311
39.598425
166
py
amuse
amuse-main/src/amuse/community/halogen/__init__.py
# generated file from .interface import Halogen
48
15.333333
30
py
amuse
amuse-main/src/amuse/community/halogen/interface.py
import os.path from amuse.community import * from amuse.community.interface.common import CommonCodeInterface, CommonCode from amuse.support.options import option class HalogenInterface(CodeInterface, CommonCodeInterface, LiteratureReferencesMixIn, CodeWithDataDirectories): """ This is a stripped-down ...
22,661
39.832432
156
py
amuse
amuse-main/src/amuse/community/secularmultiple/__init__.py
from .interface import Secularmultiple
39
19
38
py
amuse
amuse-main/src/amuse/community/secularmultiple/interface.py
import numpy as np from amuse.community import ( InCodeComponentImplementation, CodeInterface, legacy_function, LegacyFunctionSpecification, INDEX, NO_UNIT, LINK, ) from amuse.units import units, constants # units used in the legacy code # numerical values are defined in src/types.h UNIT_LENGTH = units.au ...
84,722
49.400357
177
py
amuse
amuse-main/src/amuse/community/huayno/__init__.py
from .interface import Huayno
30
14.5
29
py
amuse
amuse-main/src/amuse/community/huayno/interface.py
from amuse.community import * from amuse.community.interface.gd import GravitationalDynamicsInterface,GravityFieldInterface from amuse.community.interface.gd import GravitationalDynamics,GravityFieldCode class HuaynoInterface(CodeInterface, LiteratureReferencesMixIn, Gravita...
14,167
34.331671
154
py
amuse
amuse-main/src/amuse/community/simplex/__init__.py
from .interface import Simplex
31
15
30
py
amuse
amuse-main/src/amuse/community/simplex/interface.py
import os.path from amuse.community.interface.common import CommonCodeInterface, CommonCode from amuse.community import * from amuse.support.options import option from amuse.datamodel import Particles class SimpleXInterface(CodeInterface, CommonCodeInterface, LiteratureReferencesMixIn, CodeWithDataDirectorie...
48,398
35.555136
202
py
amuse
amuse-main/src/amuse/community/mmams/__init__.py
from .interface import Mmams
29
14
28
py
amuse
amuse-main/src/amuse/community/mmams/interface.py
import numpy from amuse.community import * from amuse.community.interface.common import CommonCodeInterface, CommonCode from amuse.support.options import option from amuse.units import units from amuse.datamodel import Particle import os.path class MMAMSInterface(CodeInterface, CommonCodeInterface, LiteratureReferenc...
27,837
49.431159
175
py
amuse
amuse-main/src/amuse/community/mercury/__init__.py
from .interface import Mercury
31
15
30
py
amuse
amuse-main/src/amuse/community/mercury/interface.py
import os import numpy from amuse.community.interface.common import CommonCodeInterface, CommonCode from amuse.community import * from amuse.community.interface.gd import GravitationalDynamics from amuse.community.interface.gd import GravitationalDynamicsInterface from amuse.datamodel import Particles class MercuryI...
52,295
33.679045
154
py
amuse
amuse-main/src/amuse/community/nbody6xx/phigrape.py
import re from amuse.units import units from amuse.units import nbody_system from amuse import datamodel """ fileformat: =========== diskstep # diskstep is used to number out, should be 0 for input dat N # number of particles time # current time, usually starts ...
4,248
37.627273
126
py
amuse
amuse-main/src/amuse/community/nbody6xx/interface_new.py
from amuse.community import * from amuse.community.interface.gd import GravitationalDynamicsInterface from amuse.community.interface.gd import GravitationalDynamics from amuse.community.interface.gd import GravityFieldInterface from amuse.community.interface.gd import GravityFieldCode class Nbody6xxInterface(CodeInter...
1,140
33.575758
95
py
amuse
amuse-main/src/amuse/community/nbody6xx/__init__.py
# generated file from .interface import Nbody6xx
49
15.666667
31
py
amuse
amuse-main/src/amuse/community/nbody6xx/interface.py
from amuse.community import * from amuse.community.interface.gd import GravitationalDynamicsInterface from amuse.community.interface.gd import GravitationalDynamics from amuse.community.interface.gd import GravityFieldInterface from amuse.community.interface.gd import GravityFieldCode class Nbody6xxInterface( ...
10,090
32.976431
97
py
amuse
amuse-main/src/amuse/community/nbody6xx/debug.py
from amuse.lab import * from .interface import Nbody6xx from amuse.units import nbody_system if __name__ == "__main__": inst = Nbody6xx(redirection="none") inst.initialize_code() inst.particles.mass = 1 | nbody_system.mass inst.evolve_model(2|nbody_system.time) inst.get_velocity(1) inst.get_...
622
26.086957
89
py