summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Seibert <stan@mtrr.org>2011-12-31 17:25:24 -0500
committertlatorre <tlatorre@uchicago.edu>2021-05-09 08:42:38 -0700
commit3ad588c5e03816adec098507c619948f5719465e (patch)
treefb0f2ba16bdc363b60940760e44fd3567607da10
parent69b13961c86d001e5c837b8a574f8c912fa27966 (diff)
downloadchroma-3ad588c5e03816adec098507c619948f5719465e.tar.gz
chroma-3ad588c5e03816adec098507c619948f5719465e.tar.bz2
chroma-3ad588c5e03816adec098507c619948f5719465e.zip
Remove import of chroma.io.root in the __init__.py module and also the
global import of RootReader in the chroma.camera module. Bringing in ROOT adds 14 seconds to the import time, which really sucks if you don't need it.
-rw-r--r--chroma/__init__.py1
-rw-r--r--chroma/camera.py4
2 files changed, 3 insertions, 2 deletions
diff --git a/chroma/__init__.py b/chroma/__init__.py
index c3f4243..b409871 100644
--- a/chroma/__init__.py
+++ b/chroma/__init__.py
@@ -4,7 +4,6 @@ except ImportError:
pass # Allow chroma usage when pygame not present
from chroma import geometry
from chroma import event
-from chroma.io import root
from chroma import generator
from chroma.generator import constant_particle_gun
from chroma import gpu
diff --git a/chroma/camera.py b/chroma/camera.py
index 4929519..09463d1 100644
--- a/chroma/camera.py
+++ b/chroma/camera.py
@@ -17,7 +17,6 @@ from chroma.geometry import Mesh, Solid, Geometry, vacuum
from chroma.transform import rotate, make_rotation_matrix
from chroma.sample import uniform_sphere
from chroma.project import from_film
-from chroma.io.root import RootReader
from chroma import make
from chroma import gpu
@@ -686,6 +685,9 @@ class EventViewer(Camera):
def __init__(self, geometry, filename, **kwargs):
Camera.__init__(self, geometry, **kwargs)
+ # This is really slow, so we do it here in the constructor to
+ # avoid slowing down the import of this module
+ from chroma.io.root import RootReader
self.rr = RootReader(filename)
self.display_mode = EventViewer.CHARGE
self.sum_mode = False