diff options
author | Anthony LaTorre <devnull@localhost> | 2013-01-01 18:45:59 -0600 |
---|---|---|
committer | tlatorre <tlatorre@uchicago.edu> | 2021-05-09 08:42:39 -0700 |
commit | f38ca570ff5959c5f5e9a6d6a4c31c61fc8f0a44 (patch) | |
tree | 5cb13af2dbabb7c5b3f6bed7738a3af2bee8aa58 | |
parent | c644ae44ab68ca136fbb58ae8ac2ec798ba797b2 (diff) | |
download | chroma-f38ca570ff5959c5f5e9a6d6a4c31c61fc8f0a44.tar.gz chroma-f38ca570ff5959c5f5e9a6d6a4c31c61fc8f0a44.tar.bz2 chroma-f38ca570ff5959c5f5e9a6d6a4c31c61fc8f0a44.zip |
make sure arguments to Photon have the correct dtype.
-rw-r--r-- | chroma/event.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/chroma/event.py b/chroma/event.py index d767c9e..07644ab 100644 --- a/chroma/event.py +++ b/chroma/event.py @@ -75,31 +75,32 @@ class Photons(object): Survival probability for each photon. Used by photon propagation code when computing likelihood functions. ''' - self.pos = pos - self.dir = dir - self.pol = pol - self.wavelengths = wavelengths + self.pos = np.asarray(pos, dtype=np.float32) + self.dir = np.asarray(dir, dtype=np.float32) + self.pol = np.asarray(pol, dtype=np.float32) + self.wavelengths = np.asarray(wavelengths, dtype=np.float32) if t is None: self.t = np.zeros(len(pos), dtype=np.float32) else: - self.t = t + self.t = np.asarray(t, dtype=np.float32) if last_hit_triangles is None: self.last_hit_triangles = np.empty(len(pos), dtype=np.int32) self.last_hit_triangles.fill(-1) else: - self.last_hit_triangles = last_hit_triangles + self.last_hit_triangles = np.asarray(last_hit_triangles, + dtype=np.int32) if flags is None: self.flags = np.zeros(len(pos), dtype=np.uint32) else: - self.flags = flags + self.flags = np.asarray(flags, dtype=np.uint32) if weights is None: self.weights = np.ones(len(pos), dtype=np.float32) else: - self.weights = weights + self.weights = np.asarray(weights, dtype=np.float32) def __add__(self, other): '''Concatenate two Photons objects into one list of photons. |