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/src/amuse/test/suite/ext_tests/test_rotating_bridge.py | import numpy
from amuse.test import amusetest
from amuse.units import units, nbody_system, constants
from amuse.ext.rotating_bridge import Rotating_Bridge, inertial_to_rotating, rotating_to_inertial
from amuse.ext.composition_methods import *
from amuse.datamodel import Particles
class drift_without_gravity(objec... | 3,371 | 25.34375 | 97 | py |
amuse | amuse-main/src/amuse/test/suite/ext_tests/test_evrardmodel.py | from amuse.test import amusetest
from amuse.ext.evrard_test import new_evrard_gas_sphere
from amuse.units import nbody_system as nbody
from amuse.units import units
class TestEvrardModel(amusetest.TestCase):
def test1(self):
print("First test: making an Evrard gas sphere model.")
target_number_... | 1,501 | 44.515152 | 95 | py |
amuse | amuse-main/src/amuse/test/suite/ext_tests/test_grid_to_sph.py | import os.path
import numpy
from amuse.test.amusetest import get_path_to_results, TestWithMPI
try:
from matplotlib import pyplot
HAS_MATPLOTLIB = True
from amuse.plot import plot, semilogy, xlabel, ylabel, loglog
except ImportError:
HAS_MATPLOTLIB = False
from amuse.support.exceptions import AmuseExcep... | 7,057 | 50.897059 | 134 | py |
amuse | amuse-main/src/amuse/test/suite/ext_tests/test_kingmodel.py | import numpy
from amuse.test import amusetest
from amuse.support.exceptions import AmuseException
from amuse.units import nbody_system
from amuse.units import units
from amuse.ic.kingmodel import new_king_model
class TestKingModel(amusetest.TestCase):
def test1(self):
print("First test: making a King mod... | 2,888 | 49.684211 | 113 | py |
amuse | amuse-main/src/amuse/test/suite/reports/test_speed.py | from amuse.units import nbody_system
from amuse.units import units
from amuse.test.amusetest import get_path_to_results
from amuse.test import compile_tools
import subprocess
import os
import numpy
import time
from amuse import datamodel
from amuse.rfi.tools import create_c
from amuse.rfi import channel
from amuse.rfi... | 10,126 | 27.526761 | 123 | py |
amuse | amuse-main/src/amuse/test/suite/reports/speed_report.py | """
Runs several tests to determine how fast common operations
are in AMUSE.
to profile (in the amuse root directory):
./amuse.sh -m cProfile -s cumulative test/reports/speed_report.py --n_order==4 --test==speed_copy_to_set > profile.txt
"""
#import numpypy
from amuse.lab import *
#from amuse.datamodel import *
... | 19,645 | 30.184127 | 157 | py |
amuse | amuse-main/src/amuse/test/suite/reports/plot_speed_report.py |
import sys
import numpy
from optparse import OptionParser
try:
from matplotlib import pyplot
HAS_MATPLOTLIB = True
except ImportError:
HAS_MATPLOTLIB = False
def select(row, cols_spec):
subspecs = cols_spec.split(',')
subspecs = list(map(str.strip, subspecs))
cols = []
for subspec in su... | 2,951 | 26.082569 | 82 | py |
amuse | amuse-main/src/amuse/test/suite/reports/__init__.py | 0 | 0 | 0 | py | |
amuse | amuse-main/src/amuse/test/suite/ticket_tests/test_ticket208.py | import numpy
from amuse.test import amusetest
import os.path
from amuse.community.phigrape.interface import PhiGRAPEInterface, PhiGRAPE
from amuse.community.hermite.interface import Hermite
from amuse.community.bhtree.interface import BHTree
from amuse.community.ph4.interface import ph4
from amuse.community.fi.interf... | 3,459 | 33.257426 | 134 | py |
amuse | amuse-main/src/amuse/test/suite/ticket_tests/test_issue123.py | from amuse.test import amusetest
from amuse.community.sse.interface import SSE
from amuse.community.bhtree.interface import BHTree
class TestsForIssue123(amusetest.TestCase):
def test1(self): # doesn't trigger recursion error
self.assertRaises(Exception, BHTree, name_of_the_worker="bogus", expected_mess... | 593 | 44.692308 | 165 | py |
amuse | amuse-main/src/amuse/test/suite/ticket_tests/test_github856.py | import os
from amuse.test import amusetest
from amuse.datamodel import new_cartesian_grid, Particles
from amuse.io import read_set_from_file, write_set_to_file
class test_github856(amusetest.TestCase):
def test1(self):
filename = os.path.join(self.get_path_to_results(), "github856.amuse")
g1 = ... | 1,102 | 31.441176 | 80 | py |
amuse | amuse-main/src/amuse/test/suite/ticket_tests/test_issue777.py | from amuse.test import amusetest
from amuse.units import units
from amuse.ic.brokenimf import new_kroupa_mass_distribution
class TestsForIssue777(amusetest.TestCase):
def test_upper_segment(self):
"Test if a star in the upper mass segment will get the right mass"
lower_limit = 1.0 | units.MSun
... | 1,308 | 31.725 | 75 | py |
amuse | amuse-main/src/amuse/test/suite/ticket_tests/test_issue850.py | from amuse.test import amusetest
from amuse.datamodel import Particles
from amuse.units import units
from amuse.community.seba import Seba
from amuse.community.bse import Bse
from amuse.support.console import set_printing_strategy
from amuse.units import units
class TestsForIssue850(amusetest.TestCase):
def crea... | 6,396 | 33.766304 | 81 | py |
amuse | amuse-main/src/amuse/test/suite/ticket_tests/test_ticket118.py | from amuse.test import amusetest
import os.path
from amuse import io
from amuse.units import units
class TestsForTicket118(amusetest.TestCase):
def test1(self):
filename = os.path.join(os.path.dirname(__file__), 'FinalSnapshot.out')
set = io.read_set_from_file(filename, 'dyn')
self.asse... | 1,090 | 34.193548 | 134 | py |
amuse | amuse-main/src/amuse/test/suite/ticket_tests/__init__.py | 0 | 0 | 0 | py | |
amuse | amuse-main/src/amuse/support/core.py | """
"""
import types
import collections.abc
import re
def compare_version_strings(version1, version2):
def normalize(v):
return [int(x if x.isdigit() else 0) for x in re.sub(r'(\.0+)*$','', v).split(".")]
version1 = normalize(version1)
version2 = normalize(version2)
return (version1 > ve... | 15,197 | 26.98895 | 91 | py |
amuse | amuse-main/src/amuse/support/exceptions.py |
class ErrorCode(object):
def __init__(self, majorcode, minorcode, description, formatstring = None):
self.majorcode = majorcode
self.minorcode = minorcode
self.description = description
self.formatstring = formatstring
def __str__(self):
return "E{0}.{1}".forma... | 2,073 | 26.289474 | 79 | py |
amuse | amuse-main/src/amuse/support/state.py | from amuse.support import exceptions
from amuse.support.options import OptionalAttributes
from amuse.support.options import option
from amuse.support.thirdparty.texttable import Texttable
import logging
class State(object):
def __init__(self, handler, name):
self.handler = handler
self.name = name... | 19,392 | 36.009542 | 161 | py |
amuse | amuse-main/src/amuse/support/project.py | """
Some general functions useful for AMUSE science projects
"""
import os
import os.path
import shutil
import pickle
def new_working_directory(script_filename=None, sub_directories=[]):
"""
Call this function from your script to create a new directory and move
into it, for storing all your simulation out... | 1,183 | 31 | 75 | py |
amuse | amuse-main/src/amuse/support/options.py | import configparser
import os.path
import os
import platform
from io import StringIO
from amuse.support.core import late
from amuse.support import exceptions
try:
import pkg_resources
except ImportError:
pkg_resources = None
class GlobalOptions(object):
INSTANCE = None
def __init__(self):
s... | 10,236 | 30.40184 | 158 | py |
amuse | amuse-main/src/amuse/support/methods.py | from amuse.support.core import late
from amuse.support import exceptions
from amuse.rfi.async_request import (
DependentASyncRequest, AbstractASyncRequest, FakeASyncRequest,
)
import inspect
class AbstractCodeMethodWrapper(object):
def __init__(self, method):
self.method = method
@late
def... | 8,981 | 31.309353 | 101 | py |
amuse | amuse-main/src/amuse/support/__init__.py | import os
from amuse.support.options import option, GlobalOptions
from amuse.support.options import OptionalAttributes
import warnings
"""
Support Code
"""
GlobalOptions=GlobalOptions.instance()
class _Defaults(OptionalAttributes):
@option(sections=['data'])
def amuse_root_dir(self):
if 'AMUS... | 569 | 18.655172 | 55 | py |
amuse | amuse-main/src/amuse/support/console.py | import numpy
from amuse.support.exceptions import AmuseException
from amuse.support import options
registered_printing_strategies = {}
class UnsupportedPrintingStrategyException(AmuseException):
"""
Raised when the given printing strategy is not supported by AMUSE.
"""
formatstring = "You tried to set... | 11,337 | 32.643917 | 113 | py |
amuse | amuse-main/src/amuse/support/interface.py | import inspect
import itertools
from collections import defaultdict
import numpy
from amuse.units import nbody_system
from amuse.units import generic_unit_system
from amuse.units import quantities
from amuse.units.quantities import is_quantity
from amuse.units.core import unit
from amuse.units import core
from amuse.u... | 61,635 | 35.514218 | 210 | py |
amuse | amuse-main/src/amuse/support/parameter_tools.py | import numpy
from configparser import ConfigParser
from collections import defaultdict, OrderedDict
from io import StringIO
try:
import f90nml
HAS_F90NML=True
except:
HAS_F90NML=False
from amuse.units.quantities import new_quantity, to_quantity, is_quantity
# parameters can be supplied as:
#
# paramete... | 11,751 | 35.496894 | 150 | py |
amuse | amuse-main/src/amuse/support/code.py | from amuse.support import interface
from amuse.support.options import OptionalAttributes
from amuse.support.core import late
from amuse import datamodel
import types
import inspect
import re
def _getdoc(object):
"""Get the doc string or comments for an object."""
result = inspect.getdoc(object) or inspect.get... | 5,372 | 30.421053 | 85 | py |
amuse | amuse-main/src/amuse/support/literature.py | import sys
try:
from docutils import core
except ValueError:
import os
import locale
os.environ['LC_CTYPE'] = 'C'
os.environ['LANG'] = 'C'
from docutils import core
import atexit
import shutil
import traceback
import importlib
from os.path import exists
from collections import namedtuple
from ... | 11,438 | 32.545455 | 97 | py |
amuse | amuse-main/src/amuse/support/thirdparty/texttable.py | #!/usr/bin/env python
#
# texttable - module for creating simple ASCII tables
# Copyright (C) 2003-2015 Gerome Fournier <jef(at)foutaise.org>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundat... | 18,956 | 30.179276 | 106 | py |
amuse | amuse-main/src/amuse/support/thirdparty/__init__.py | 0 | 0 | 0 | py | |
amuse | amuse-main/src/amuse/rfi/import_module.py | import sys
import ctypes
import tempfile
import shutil
import os
import atexit
class _ModuleRegister(object):
is_cleanup_registered = False
files_to_cleanup = []
def find_shared_object_file(dirpath, base_libname):
for path in sys.path:
fullpath = os.path.join(path, dirpath)
if os.path.ex... | 4,329 | 31.80303 | 100 | py |
amuse | amuse-main/src/amuse/rfi/async_request.py | import select
import operator
from . import channel
class AbstractASyncRequest(object):
def __bool__(self):
return not self.is_finished
def waitone(self):
return self.wait()
def waitall(self):
while not self.is_finished:
self.wait()
def wait(self):
raise ... | 23,061 | 30.039031 | 134 | py |
amuse | amuse-main/src/amuse/rfi/core.py | import weakref
import atexit
import errno
import os
import sys
import logging
import pydoc
import traceback
import random
import sys
import warnings
import inspect
import functools
# from collections import OrderedDict
from subprocess import Popen, PIPE
from amuse.support import exceptions
from amuse.support.core i... | 52,496 | 35.814165 | 186 | py |
amuse | amuse-main/src/amuse/rfi/nospawn.py |
from amuse.rfi import core
from amuse.rfi.python_code import CythonImplementation
from mpi4py import MPI
from amuse.rfi import channel
from collections import namedtuple
import sys
import importlib
Code = namedtuple("Code", ['cls', 'number_of_workers', 'args', 'kwargs'])
PythonCode = namedtuple("Code", ['cls', 'numbe... | 5,500 | 29.392265 | 241 | py |
amuse | amuse-main/src/amuse/rfi/slurm.py |
def parse_slurm_tasks_per_node(string):
per_node = string.split(',')
result = []
for node in per_node:
parts = node.split('(')
count = parts[0]
if len(parts) == 2:
nodes = parts[1]
else:
nodes = None
try:
count = int... | 2,138 | 27.905405 | 86 | py |
amuse | amuse-main/src/amuse/rfi/run_command_redirected.py | from subprocess import call
import sys
import os.path
import time
import signal
def translate_filename_for_os(filename):
if sys.platform == 'win32':
if filename == '/dev/null':
return 'nul'
else:
return filename
else:
return filename
if __name__ == '__main__':
... | 1,197 | 21.185185 | 69 | py |
amuse | amuse-main/src/amuse/rfi/python_code.py | from amuse.support.core import late, OrderedDictionary
from mpi4py import MPI
import numpy
import sys
import os
import socket
import traceback
import types
import warnings
from amuse.rfi.channel import ClientSideMPIMessage
from amuse.rfi.channel import SocketMessage
from amuse.rfi.channel import pack_array
from amu... | 23,380 | 38.098662 | 126 | py |
amuse | amuse-main/src/amuse/rfi/channel.py | import inspect
import numpy
import os.path
import pickle as pickle
import sys
import struct
import threading
import select
import atexit
import time
import socket
import array
import logging
import shlex
logger = logging.getLogger(__name__)
#
# we want to use the automatic initialization and finalization
# of the M... | 88,683 | 34.962693 | 228 | py |
amuse | amuse-main/src/amuse/rfi/gencode.py | import sys
import os.path
import os
from optparse import OptionParser
# Should probably use an absolute import here (support.config), but
# we're not guaranteed this script will always be in a support
# subdirectory with an __init__.py file.
#try: # running as a module
# from . import config
#except (ImportError,... | 15,246 | 37.022444 | 320 | py |
amuse | amuse-main/src/amuse/rfi/__init__.py | 0 | 0 | 0 | py | |
amuse | amuse-main/src/amuse/rfi/tools/create_java.py | from amuse.support.core import late
from amuse.support import exceptions, options
from amuse import config
from amuse.rfi.tools.create_code import GenerateASourcecodeString
from amuse.rfi.tools.create_code import GenerateASourcecodeStringFromASpecificationClass
from amuse.rfi.tools.create_code import DTypeSpec
from amu... | 53,344 | 34.072321 | 149 | py |
amuse | amuse-main/src/amuse/rfi/tools/fortran_tools.py | from amuse.support.literature import TrackLiteratureReferences
# ptype:
# simple: rw, scalar value and implementation generated by interface
# normal: rw, scalar value, custom implementation
# ro: read only, scalar value, generated
# vector: rw, generated vector valued
class FortranCodeGenerator(object):
_g... | 11,322 | 41.567669 | 140 | py |
amuse | amuse-main/src/amuse/rfi/tools/create_c.py | from amuse.support.core import late
from amuse.support import exceptions
from amuse.rfi.tools.create_code import GenerateASourcecodeString
from amuse.rfi.tools.create_code import GenerateASourcecodeStringFromASpecificationClass
from amuse.rfi.tools.create_code import DTypeSpec
from amuse.rfi.tools.create_code import dt... | 45,482 | 30.067623 | 236 | py |
amuse | amuse-main/src/amuse/rfi/tools/create_dir.py | import os
from amuse.support import get_amuse_root_dir
from amuse.support.core import late, print_out
from amuse.support.options import option
from amuse.support.options import OptionalAttributes
interface_file_template = """\
from amuse.community import *
# low level interface class
class {0.name_of_the_community_i... | 15,062 | 27.856322 | 169 | py |
amuse | amuse-main/src/amuse/rfi/tools/create_python_worker.py | from amuse.support.core import late, print_out
from amuse.support.options import option
from amuse.support.options import OptionalAttributes
from amuse.support import get_amuse_root_dir
import os
import inspect
import sys
class CreateAPythonWorker(OptionalAttributes):
@option(sections=['data'])
... | 2,216 | 26.036585 | 85 | py |
amuse | amuse-main/src/amuse/rfi/tools/create_definition.py | import re
from amuse.support.core import late, print_out
def strip_indent(string_with_indents):
return re.sub('^ *\n', '', string_with_indents.rstrip())
class CodeDocStringProperty(object):
"""
Return a docstring generated from a
function specification
"""
def __get__(self, insta... | 10,659 | 28.447514 | 121 | py |
amuse | amuse-main/src/amuse/rfi/tools/__init__.py | 0 | 0 | 0 | py | |
amuse | amuse-main/src/amuse/rfi/tools/create_code.py | import numpy
import sys
import os
from amuse.support.core import late, print_out
from amuse.rfi.core import legacy_function
class DTypeSpec(object):
def __init__(self, input_var_name, output_var_name, counter_name,
type, mpi_type = 'UNKNOWN'):
self.input_var_name = input_var_name
self.out... | 4,264 | 29.683453 | 82 | py |
amuse | amuse-main/src/amuse/rfi/tools/create_fortran.py | from amuse.support.core import late
from amuse.support import exceptions
from amuse import config
from amuse.rfi.tools.create_code import GenerateASourcecodeString
from amuse.rfi.tools.create_code import GenerateASourcecodeStringFromASpecificationClass
from amuse.rfi.tools.create_code import DTypeSpec
from amuse.rfi.... | 64,699 | 37.488995 | 132 | py |
amuse | amuse-main/src/amuse/units/optparse.py |
import optparse
import textwrap
from amuse.units import quantities
def check_builtin_unit(option, opt, value):
(cvt, what) = optparse._builtin_cvt[option.type]
try:
result = cvt(value)
if option.unit is None:
return result
else:
return quantities.new_quantity(r... | 4,718 | 32.468085 | 85 | py |
amuse | amuse-main/src/amuse/units/core.py | from amuse.support.core import late
from amuse.support import exceptions
import numpy
from amuse.support.core import memoize
from amuse.support.core import MultitonMetaClass
class system(object):
ALL = {}
def __init__(self, name):
self.name = name
self.bases = []
self.mapping_from_b... | 33,642 | 27.106099 | 170 | py |
amuse | amuse-main/src/amuse/units/constants.py |
#This is an auto generated file, do not change manually. Instead if you want to add constants
#or change them, change the nist.txt file and run nist.py
import numpy
from amuse.units.si import *
from amuse.units.derivedsi import *
#BASE UNITS***********************************************
X220X_lattice_spacing_of_sil... | 18,324 | 51.357143 | 93 | py |
amuse | amuse-main/src/amuse/units/trigo.py | import numpy
from amuse.units import quantities
from amuse.units.units import rad,deg,rev,pi
#trigonometric convenience functions which are "unit aware"
sin=lambda x: numpy.sin(1.*x)
cos=lambda x: numpy.cos(1.*x)
tan=lambda x: numpy.tan(1.*x)
arcsin=lambda x: numpy.arcsin(x) | rad
arccos=lambda x: numpy.arccos(x) | ra... | 780 | 27.925926 | 59 | py |
amuse | amuse-main/src/amuse/units/nbody_system.py | """
The n-body unit system knows the three base quantities in the
International System of Quantities, I.S.Q. and defines
the gravitational constant to be 1:
G = 1 | (length**3) / (mass * (time**2))
+-------------------+-----------------------------------+-----------------+
|Base quantity |Name in generic unit ... | 4,912 | 34.345324 | 105 | py |
amuse | amuse-main/src/amuse/units/units.py | import numpy
from amuse.units.si import (
named, s, m, kg, none, core,
)
from amuse.units.derivedsi import (
km, V, W, J, Pa, rad,
)
from amuse.units.si import *
from amuse.units.derivedsi import *
from amuse.units import constants
from . import quantities
# misc every day
minute = named('minute', 'min', 60.0 ... | 4,019 | 34.892857 | 77 | py |
amuse | amuse-main/src/amuse/units/generic_unit_system.py | """
The generic unit system knows the seven base quantities in the
International System of Quantities, I.S.Q.
+-------------------+-----------------------------------+-----------------+
|Base quantity |Name in generic unit |Name in S.I. unit|
+-------------------+-----------------------------------+... | 2,792 | 38.9 | 102 | py |
amuse | amuse-main/src/amuse/units/quantities.py | import numpy
import operator
from math import sqrt
from amuse.support import exceptions
from amuse.support import console
from amuse.support.core import late
from amuse.support.core import compare_version_strings
from amuse.units import core
from amuse.units.si import none
from amuse.units.core import zero_unit
try... | 45,030 | 29.16142 | 126 | py |
amuse | amuse-main/src/amuse/units/generic_unit_converter.py | import numpy
from amuse.units.quantities import new_quantity
from amuse.units.quantities import is_unit
from amuse.units.quantities import is_quantity
from amuse.units.generic_unit_system import *
from amuse.support import exceptions
from amuse.support.core import late
class UnitsNotOrtogonalException(exceptions.Amus... | 11,583 | 39.645614 | 335 | py |
amuse | amuse-main/src/amuse/units/__init__.py | 0 | 0 | 0 | py | |
amuse | amuse-main/src/amuse/units/scaling_converter.py | from amuse.units import generic_unit_system
from amuse.units.quantities import new_quantity
class ScalingConverter(object):
def __init__(
self,
length = 1,
time = 1,
mass = 1,
current = 1,
temperature = 1,
amount = 1,
luminous_intensity = 1
):
... | 1,853 | 33.333333 | 89 | py |
amuse | amuse-main/src/amuse/units/si.py | from amuse.units import core
system = core.system('S.I.')
m = core.base_unit('length', 'meter', 'm', system)
kg = core.base_unit('mass', 'kilogram', 'kg', system)
s = core.base_unit('time', 'second', 's', system)
A = core.base_unit('electric current', 'ampere', 'A', system)
K = core.base_unit('thermodynamic temperatu... | 2,349 | 36.301587 | 71 | py |
amuse | amuse-main/src/amuse/units/derivedsi.py | from amuse.units.si import (
named, s, m, kg, A, none, k,
)
from amuse.units.si import *
Hz = named('hertz', 'Hz', 1 / s)
MHz = named('megahertz', 'MHz', 1e6 * Hz)
rad = named('radian', 'rad', m / m)
sr = named('steradian', 'sr', m**2 / (m**2))
N = named('newton', 'N', kg * m / (s**2))
Pa = named('pascal', 'Pa', N... | 731 | 26.111111 | 57 | py |
amuse | amuse-main/src/amuse/units/nist.py | import urllib.request, urllib.error, urllib.parse, urllib.request, urllib.parse, urllib.error
import difflib
import os.path
import re
from hashlib import md5
from amuse.units import si
from amuse.units import derivedsi
NIST_URL = "http://132.229.222.6:9000/nistdata"
MESSAGE = \
"""
#This is an auto generated file, d... | 7,342 | 35.351485 | 225 | py |
amuse | amuse-main/src/amuse/couple/multiples.py | import sys
import numpy
import collections
import math
import copy
from amuse.datamodel import particle_attributes
from amuse.datamodel import trees
from amuse.datamodel import Particle, Particles
from amuse.rfi.core import is_mpd_running
from amuse.ic.plummer import new_plummer_model
from amuse.ic.salpeter import ne... | 122,275 | 37.854782 | 90 | py |
amuse | amuse-main/src/amuse/couple/collision_handler.py | import inspect
from amuse.units import units
from amuse.datamodel import Particle, Particles
from amuse.support.exceptions import AmuseException
class CollisionHandler(object):
"""
Generic class for handling stellar collisions.
"""
def __init__(
self,
collision_cod... | 5,584 | 41.961538 | 133 | py |
amuse | amuse-main/src/amuse/couple/bridge.py | """
bridge-like integrator for amuse
the bridge class provides a bridge like coupling between different
gravitational integrators. In this way a system composed of multiple
components can be evolved taking account of the self gravity of the whole
system self consistently, while choosing the most appropiate i... | 24,220 | 32.922969 | 164 | py |
amuse | amuse-main/src/amuse/couple/fallback_stellar_evolution.py | import os
import sys
import math
import traceback
import numpy
from amuse.units import units
from amuse.units import constants
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 impor... | 11,720 | 43.06391 | 145 | py |
amuse | amuse-main/src/amuse/couple/__init__.py | 0 | 0 | 0 | py | |
amuse | amuse-main/src/amuse/couple/encounters.py | """
This module defines the classe to handle handle close
encounters between particles.
It is used by the multiples module.
"""
from amuse.datamodel import Particle
from amuse.datamodel import Particles
from amuse.datamodel import ParticlesSuperset
from amuse.datamodel import trees
from amuse.units import constants
... | 95,615 | 41.723861 | 270 | py |
amuse | amuse-main/src/amuse/couple/parallel_stellar_evolution.py | import sys
import traceback
import numpy
import threading
from amuse.units import units
from amuse.datamodel import ParticlesSuperset
from amuse.support.exceptions import AmuseException
from amuse.community.interface.se import merge_colliding_in_stellar_evolution_code
from amuse.support.options import option, Optional... | 6,255 | 35.584795 | 126 | py |
amuse | amuse-main/src/amuse/data/__init__.py | # Data directory for AMUSE
| 27 | 13 | 26 | py |
amuse | amuse-main/src/amuse/ext/composition_methods.py | """
selection of composition integration methods
always of the form:
name(EVOLVEA,EVOLVEB,dt)
in case EVOLVEA and EVOLVEB are symplectic, the compositions
are symplectic
included:
LEAPFROG
SPLIT_4TH_S_M6
SPLIT_4TH_S_M5
SPLIT_4TH_S_M4
SPLIT_6TH_SS_M11
SPLIT_6TH_SS_M13
... | 7,430 | 23.524752 | 62 | py |
amuse | amuse-main/src/amuse/ext/halogen_model.py | from amuse.community.halogen.interface import Halogen
from amuse.datamodel import ParticlesWithUnitsConverted
def new_halogen_model(number_of_particles, convert_nbody = None, do_scale = False,
redirection = 'null', **keyword_arguments):
"""
Create an alpha-beta-gamma-model using Halogen with the given... | 2,247 | 48.955556 | 105 | py |
amuse | amuse-main/src/amuse/ext/static_potentials.py | """
The analytic potential of the galaxy so it can be used in Bridge as an external potentail.
Most equations are taken from B&T:
Binney and Tremaine, Galactic Dynamics, Second Edition
"""
import numpy
from amuse.units import units, constants, quantities
from amuse.datamodel import Particle, Particles
from ... | 8,764 | 34.630081 | 123 | py |
amuse | amuse-main/src/amuse/ext/boss_bodenheimer.py | import numpy
from amuse.ext.evrard_test import uniform_unit_sphere
from amuse.units import nbody_system
from amuse.units import generic_unit_system
from amuse.units import units
from amuse import datamodel
class bb79_cloud(object):
"""
spherical uniformly rotating cloud of particles with density perturbation (m=... | 3,386 | 36.21978 | 116 | py |
amuse | amuse-main/src/amuse/ext/ClusterCore.py | """
Stefan Umbreit, python version
.. [#] Casertano, S., Hut, P., *The Astrophysical Journal*, **298**, 80-94 (1985)
"""
import numpy as N
def density_estimators(n_points, r, mass, dims=3):
"""
Calculate the density estimators that are used for the calculation of the
core quantities.
n_points - number of po... | 1,290 | 23.826923 | 81 | py |
amuse | amuse-main/src/amuse/ext/job_server.py | """
JobServer: class for job farming using amuse communication channels
usage:
start jobserver
jobserver=JobServer(hosts=<list of hostnames> [ ,channel_type="mpi", preamble="<commands>", retry_jobs=True/ False] )
submit job
job=jobserver.submit_job(somework, (args,))
wait for one result (encounters all):
jobs... | 12,419 | 34.084746 | 119 | py |
amuse | amuse-main/src/amuse/ext/sph_to_star.py | import numpy
from amuse.units import constants, units
from amuse.datamodel import Grid
class SPH2StellarModel(object):
"""
Converts a set of SPH particles to a 1D stellar evolution model. If the SPH
model of the star included a (non-SPH) 'core' particle, supply it via the
optional core_particle keyw... | 3,314 | 49.227273 | 154 | py |
amuse | amuse-main/src/amuse/ext/stellar_tidal_evolution.py | # Equations for tidal evolution of binary/planetary orbits
# From Hansen 2010, based on Eggleton et al. 1998
import threading
import numpy
import math
from scipy import integrate
from amuse.lab import *
from amuse.support import literature
#2010ApJ...723..285H
def sigma_planet():
sig_p = 3.4e-7
return 5.9e-5... | 18,470 | 39.417943 | 169 | py |
amuse | amuse-main/src/amuse/ext/plummer.py | import warnings
from amuse.ic.plummer import *
warnings.warn("amuse.ext.plummer has moved to amuse.ic.plummer", DeprecationWarning)
| 134 | 21.5 | 84 | py |
amuse | amuse-main/src/amuse/ext/hydro_collision.py | import numpy
from amuse.units import units, nbody_system, constants
from amuse.datamodel import Particles
from amuse.plot import plot, scatter, xlabel, ylabel, native_plot
from amuse.ext.star_to_sph import convert_stellar_model_to_SPH
from amuse.ext.sph_to_star import convert_SPH_to_stellar_model
from amuse.community.k... | 22,588 | 50.928736 | 190 | py |
amuse | amuse-main/src/amuse/ext/salpeter.py | import warnings
from amuse.ic.salpeter import *
warnings.warn("amuse.ext.salpeter has moved to amuse.ic.salpeter", DeprecationWarning)
| 137 | 22 | 86 | py |
amuse | amuse-main/src/amuse/ext/grid_to_sph.py | import numpy
from amuse.support.exceptions import AmuseException
from amuse.units import units
from amuse.datamodel import Particles
class Grid2SPH(object):
"""
Converts a (cartesian) hydrodynamics Grid into an SPH model consisting of the
specified number of particles. The Grid must have position, rho, m... | 5,851 | 49.448276 | 144 | py |
amuse | amuse-main/src/amuse/ext/solarsystem.py | import numpy
from amuse.units import units, nbody_system, constants
from amuse.datamodel import Particles, Particle
pi_over_180 = numpy.pi/180.
_solsysdat= \
[['MERCURY',1.66013679527193009E-07,20.,5.43, \
-3.83966017419175965E-01, -1.76865300855700736E-01, 2.07959213998758705E-02, \
5.96286238644834141E-03, -2... | 12,891 | 36.806452 | 127 | py |
amuse | amuse-main/src/amuse/ext/derived_grav_systems.py | from amuse.units import constants
class center_of_mass(object):
"""
com=center_of_mass(grav_instance)
derived system, returns center of mass as skeleton grav system
provides: get_gravity_at_point, get_potential_at_point
"""
def __init__(self,baseclass):
self.baseclass=baseclass
de... | 2,340 | 30.213333 | 84 | py |
amuse | amuse-main/src/amuse/ext/galactics_model.py | from amuse.community.galactics.interface import GalactICs, GalactICsInterface
from amuse.community.galactics.gas_interface import GaslactICs, GaslactICsInterface
from amuse.datamodel import ParticlesWithUnitsConverted, Particles
from amuse.datamodel.particles import ParticlesSuperset
def _new_galactics_model(halo_numb... | 3,541 | 39.712644 | 131 | py |
amuse | amuse-main/src/amuse/ext/bridge.py | """
bridge-like integrator for amuse
the bridge class provides a bridge like coupling between different
gravitational integrators. In this way a system composed of multiple
components can be evolved taking account of the self gravity of the whole
system self consistently, while choosing the most appropi... | 11,167 | 35.858086 | 121 | py |
amuse | amuse-main/src/amuse/ext/relax_sph.py | import numpy
from amuse.units import units, nbody_system
from amuse.couple.bridge import Bridge
from amuse.plot import native_plot, semilogy, loglog, xlabel, ylabel
def no_monitoring(system, i_step, time, n_steps):
pass
def monitor_energy(system, i_step, time, n_steps):
unit = units.J
U = system.potentia... | 4,067 | 43.217391 | 127 | py |
amuse | amuse-main/src/amuse/ext/sticky_spheres.py | import sys
import numpy
from amuse.units import units
from amuse.datamodel import Particles
from amuse.support.exceptions import AmuseException
class StickySpheres(object):
"""
Resolves collisions between particles by treating them as "sticky spheres",
i.e. perfectly inelastic collisions. Mass and momen... | 1,386 | 33.675 | 82 | py |
amuse | amuse-main/src/amuse/ext/star_to_sph.py | import numpy
import os.path
import pickle
from collections import namedtuple
from amuse.community.gadget2.interface import Gadget2
from amuse.ext.spherical_model import EnclosedMassInterpolator
from amuse.ext.spherical_model import new_spherical_particle_distribution
from amuse.support.exceptions import AmuseExceptio... | 19,994 | 51.206266 | 146 | py |
amuse | amuse-main/src/amuse/ext/cosmo.py | # simple cosmology calc.
# to be extended as needed
import numpy
from amuse.units import units, generic_unit_system
from amuse.units.quantities import to_quantity
from amuse.datamodel import Particles
from amuse.support.exceptions import AmuseException
def findbin(ylist,y):
s=1
if ylist[0]>=ylist[-1]:
s=-1
... | 5,397 | 32.52795 | 102 | py |
amuse | amuse-main/src/amuse/ext/gasplummer.py | import numpy
from amuse.ext.evrard_test import uniform_unit_sphere
from amuse.units import nbody_system
from amuse.units import units
from amuse import datamodel
class MakePlummerGasModel(object):
def __init__(self, targetN, convert_nbody = None, base_grid=None, rscale=1/1.695,
mass=1.,seed=345... | 2,446 | 37.234375 | 120 | py |
amuse | amuse-main/src/amuse/ext/sobol.py | import math
from numpy import *
__all__ = ["i4_sobol", "i4_sobol_generate"]
def i4_bit_hi1 ( n ):
#*****************************************************************************80
#
## I4_BIT_HI1 returns the position of the high 1 bit base 2 in an integer.
#
# Example:
#
# N Binary BIT
# ---- ---... | 11,837 | 25.662162 | 87 | py |
amuse | amuse-main/src/amuse/ext/sink.py | """
Sinks
This module contains functions to create new sink particles. These can be used
to model accretion, for example unto protostars or compact objects.
"""
import numpy
from amuse.units import units, quantities
from amuse.units.quantities import zero, AdaptingVectorQuantity
from amuse.datamodel import Particle, ... | 12,155 | 40.917241 | 147 | py |
amuse | amuse-main/src/amuse/ext/comsystem.py | """
function center_of_mass_system generates a thin wrapper class
to a grav dynamics class to calculate the dynamics in the center of mass frame
"""
from amuse.datamodel import Particles
def center_of_mass_system(baseclass):
class comsystem(baseclass):
def __init__(self,*args,**kwargs):
self.particles_... | 1,932 | 29.68254 | 103 | py |
amuse | amuse-main/src/amuse/ext/radial_profile.py | import numpy
def radial_profile(r,dat,N=100):
n=len(r)
a=r.argsort()
i=0
if hasattr(r,"unit"):
r_a=[] | r.unit
else:
r_a=[]
if hasattr(dat,"unit"):
dat_a=[] | dat.unit
else:
dat_a=[]
while i < n:
ra=r[a[i:i+N]].sum()/min(n-i,N)
da=dat[a[i:i+N]].sum()/min(n-i,N)
r_a.append(ra... | 1,981 | 21.781609 | 86 | py |
amuse | amuse-main/src/amuse/ext/rotating_bridge.py | """
Wrapper of the bridge-like integrator for amuse. To see how bridge works go to the file bridge.py in this folder.
This bridge makes the integration of eqs of motion in a right hand counterclockwise rotating system.
Usage:
from amuse.ext.composition_methods import *
from amuse.ext.rotating_bridge import Rotating_B... | 6,928 | 35.088542 | 113 | py |
amuse | amuse-main/src/amuse/ext/molecular_cloud.py | import numpy
from math import sqrt
from amuse.ext.evrard_test import regular_grid_unit_cube
from amuse.ext.evrard_test import uniform_unit_sphere
from amuse.ext.evrard_test import uniform_unit_cube
from amuse.units import constants
from amuse.units import nbody_system
from amuse.units import generic_unit_converter
fr... | 10,428 | 30.224551 | 120 | py |
amuse | amuse-main/src/amuse/ext/sph_to_grid.py | import numpy
from amuse.units import units
from amuse.support.exceptions import AmuseException
from amuse.community.gadget2.interface import Gadget2
from amuse.community.fi.interface import Fi
from amuse.datamodel import Grid
class _SPH2Grid(object):
def __init__(self, sph_code, dimensions, do_scale = False)... | 3,482 | 43.088608 | 134 | py |
amuse | amuse-main/src/amuse/ext/particles_with_color.py | """
Particle colors
This module contains functions to compute colors for stars and SPH particles. These can be used
for visualisation.
"""
import os.path
import numpy
from amuse.units import units, constants
from amuse.support.exceptions import AmuseException
from amuse.datamodel import ParticlesOverlay
__all__ = ... | 6,567 | 44.93007 | 121 | py |
amuse | amuse-main/src/amuse/ext/roche_radius.py | """
Various equations to calculate the size of the Roche lobe of a system.
There are three ways to use this module:
1. From the command line:
python roche_radius.py -a 10 -e 0.5 -m 10
2. Using the direct functions:
q = 10
print eggleton_formula(q)
e = 0.5
A = s... | 10,547 | 35.752613 | 206 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.