-
Notifications
You must be signed in to change notification settings - Fork 75
/
__init__.py
80 lines (63 loc) · 1.86 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
74
75
76
77
78
79
80
"""
pynbody
=======
A light-weight, portable, format-transparent analysis framework
for N-body and SPH astrophysical simulations.
For more information, either build the latest documentation included
in our git repository, or view the online version here:
http://pynbody.github.io/pynbody/
"""
import sys
# We need to import configuration first, so prevent isort from reordering
# isort: off
from .configuration import config, logger, config_parser
# isort: on
from . import (
analysis,
array,
bridge,
configuration,
derived,
family,
filt,
gravity,
halo,
snapshot,
sph,
transformation,
util,
)
# The PlotModuleProxy serves to delay import of pynbody.plot until it's accessed.
# Importing pynbody.plot imports pylab which in turn is quite slow and cause problem
# for terminal-only applications. However, since pynbody always auto-imported
# pynbody.plot, it would seem to be too destructive to stop this behaviour.
# So this hack is the compromise and should be completely transparent to most
# users.
class PlotModuleProxy:
def _do_import(self):
global plot
del plot
from . import plot as plot_module
plot = plot_module
def __hasattr__(self, key):
self._do_import()
return hasattr(plot, key)
def __getattr__(self, key):
self._do_import()
global plot
return getattr(plot, key)
def __setattr__(self, key, value):
self._do_import()
global plot
return setattr(plot, key, value)
def __dir__(self):
self._do_import()
global plot
return dir(plot)
def __repr__(self):
return "<Unloaded plot module>"
plot = PlotModuleProxy()
from .snapshot import load, new
derived_array = snapshot.simsnap.SimSnap.derived_quantity
__version__ = '2.0.0-beta.2'
__all__ = ['load', 'new', 'derived_array']