LAL / TrackMLRamp

Connecting the Dots / Intelligent Tracker 2017 TrackML RAMP
0 stars 0 forks source link

Error in cont.predictParticles() #14

Open hushchyn-mikhail opened 7 years ago

hushchyn-mikhail commented 7 years ago

The error in the README.ipynb:

AttributeError Traceback (most recent call last)

in () 1 cont.compHitdet() ----> 2 cont.predictParticles() /Users/mikhail91/Documents/Github/TrackMLRamp/particleController.py in predictParticles(self) 140 self.particles.append(thispart) # create particle 141 thispart.hits.append(hit) --> 142 thispart.hitbcs.append(hit.hbc) 143 temphits.remove(hit) 144 for particle in self.particles: AttributeError: 'bool' object has no attribute 'append'

The error occurs due to the changes in oogenerateParticles.py file.

In the https://github.com/LAL/TrackML repository was:

class Particle:
    """ particle constructor """
    def __init__(self, barcode, gen = False, vertices=[]):
        self.barcode = barcode
        self.vertices = vertices
        self.mangle = []
        self.charge = -10

        self.hits = []
        self.hitbcs = []

        ### FOR GENERATED PARTICLES ###
        self.p_radius = 0
        self.centpt = []
        self.p_circ = None
        self.m_ray = None

        if(gen): self.genParticle()

Now:

class Particle:
    """ particle constructor """
    def __init__(self, barcode, hitbcs, gen = False, vertices=[]):
        self.barcode = barcode
        self.vertices = vertices
        self.mangle = []
        self.charge = None

        self.hits = []
        self.hitbcs = hitbcs

        ### FOR GENERATED PARTICLES ###
        self.p_radius = 0
        self.centpt = []
        self.p_circ = None
        self.m_ray = None

        if(gen): self.genParticle()

This leads to the error above.

dhrou commented 7 years ago

In which cell do you have this ?

tboser commented 7 years ago

I changed the way hit barcodes were generated so that they would be more 'random' which is why that change was made. The particle prediction needs some changes either way because input will be different from what I expected. I'll make a quick fix that'll remove this error but more work needs to be done to update that method.

tboser commented 7 years ago

Also - you can find the files I use in the README.ipynb here: https://people.ucsc.edu/~tboser/example_files/

hushchyn-mikhail commented 7 years ago

David, the error occurs in the 23rd cell.

tboser commented 7 years ago

This should have been fixed in my latest pull request - the error was caused because the constructor was changed to take an argument hitbcs on top of the old arguments, so we just had to add another argument [] when constructing particles so that a boolean was not passed as the argument for hitbcs.