-
Notifications
You must be signed in to change notification settings - Fork 99
/
__init__.py
73 lines (53 loc) · 1.88 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
"""
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 astrophysical phenomena.
It contains several packages, most notably:
units - AMUSE uses quantities, i.e. a number (or array) with a unit attached,
instead of just numbers (vital when coupling different codes!)
datamodel - defines particles and grids, on which data (quantities) can be stored
ic - a collection of routines to generate initial conditions
io - how to read and write data in several file formats
community - a variety of existing codes of different physical domains, each with
a uniform interface to enable coupling
Help is available for each of these packages, e.g.:
> python
>>> import amuse.ic
>>> help(amuse.ic) # doctest: +ELLIPSIS
Help on package amuse.ic in amuse:
...
or (directly from the terminal):
> pydoc amuse.ic
"""
import sys
import os
import numpy
_AMUSE_ROOT = os.path.abspath(os.path.dirname(__file__))
def numpy_fix():
try:
numpy.set_printoptions(legacy="1.13")
except TypeError:
pass
numpy_fix()
class NoConfig:
def __init__(self, message):
self._message = message
def __getattr__(self, attr):
raise AttributeError(self._message)
try:
from . import config
except FileNotFoundError as ex:
message = (
"Configuration not read in - or configuration invalid, exception:\n" + str(ex)
)
config = NoConfig(message)
# always report AMUSE reference information
try:
from amuse.support.literature import TrackLiteratureReferences
TrackLiteratureReferences.default()
except:
pass
def get_data(path):
return os.path.join(_AMUSE_ROOT, "data", path)