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

How to make combo descriptors (like circularity..) #33

Open
hughesadam87 opened this issue Feb 13, 2014 · 1 comment
Open

How to make combo descriptors (like circularity..) #33

hughesadam87 opened this issue Feb 13, 2014 · 1 comment

Comments

@hughesadam87
Copy link
Owner

Maybe not worth it because it's super easy to just define these functions:

def circ(p):
return 4pi * p.area/p.perimeter**2

But still might be worth doing.

@hughesadam87
Copy link
Owner Author

FOR NOW, ADDED AS A HACK TO GETATTR OF PARTICLE MANAGER

    # Bypasses a bug (or pyparty design flaw?) in ipython notebook 2.0 beta
    # when ending a cell w/ c.particles
    if attr == '_ipython_display_':
        return         

    # HACK HACK HACK
    if attr == 'circularity':
        area = np.array([getattr(p, 'area') for p in self.plist])
        perim = np.array([getattr(p, 'perimeter') for p in self.plist])
        return 4 *  np.pi * (  area / (perim**2) )

    return np.array([getattr(p, attr) for p in self.plist])

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

No branches or pull requests

1 participant