Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in cont.predictParticles() #14

Open
hushchyn-mikhail opened this issue Jan 31, 2017 · 5 comments
Open

Error in cont.predictParticles() #14

hushchyn-mikhail opened this issue Jan 31, 2017 · 5 comments

Comments

@hushchyn-mikhail
Copy link
Collaborator

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
Copy link
Contributor

dhrou commented Jan 31, 2017

In which cell do you have this ?

@tboser
Copy link
Collaborator

tboser commented Jan 31, 2017

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
Copy link
Collaborator

tboser commented Jan 31, 2017

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

@hushchyn-mikhail
Copy link
Collaborator Author

David, the error occurs in the 23rd cell.

@tboser
Copy link
Collaborator

tboser commented Feb 2, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants