From 3ad588c5e03816adec098507c619948f5719465e Mon Sep 17 00:00:00 2001 From: Stan Seibert Date: Sat, 31 Dec 2011 17:25:24 -0500 Subject: 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. --- chroma/__init__.py | 1 - chroma/camera.py | 4 +++- 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 -- cgit