Skip to content

Commit 713e060

Browse files
Merge pull request #74 from francois-drielsma/develop
Massive speed up found in children_id loading from larcv::Particle...
2 parents 992fdad + 03cd57e commit 713e060

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

spine/data/particle.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,10 @@ def from_larcv(cls, particle):
263263
obj_dict[key] = np.asarray(
264264
[getattr(vector, a)() for a in pos_attrs], dtype=np.float32)
265265

266-
# Load the other array attributes (special care needed)
267-
obj_dict['children_id'] = np.asarray(particle.children_id(), dtype=int)
266+
# Load the other array attributes (special care needed). Note for future
267+
# self: need the list comprehension. Direct casting is INSANELY slow...
268+
obj_dict['children_id'] = np.asarray(
269+
[i for i in particle.children_id()], dtype=int)
268270

269271
mom_attrs = ('px', 'py', 'pz')
270272
for prefix in ('', 'end_'):

0 commit comments

Comments
 (0)