Skip to content

Commit

Permalink
cleanup of some core files
Browse files Browse the repository at this point in the history
  • Loading branch information
rieder committed Apr 26, 2024
1 parent 409d3b0 commit 284793f
Show file tree
Hide file tree
Showing 3 changed files with 238 additions and 191 deletions.
26 changes: 18 additions & 8 deletions src/amuse/__init__.py
Expand Up @@ -25,39 +25,49 @@
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')
numpy.set_printoptions(legacy="1.13")
except TypeError:
pass



numpy_fix()

class NoConfig(object):

class NoConfig:
def __init__(self, message):
self._message=message
self._message = message

def __getattr__(self, attr):
raise AttributeError(self._message)


try:
from . import config
except Exception as ex:
message="Configuration not read in - or configuration invalid, exception:\n"+str(ex)
config=NoConfig(message)
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)
return os.path.join(_AMUSE_ROOT, "data", path)

0 comments on commit 284793f

Please sign in to comment.