Giter Club home page Giter Club logo

Comments (4)

jpivarski avatar jpivarski commented on June 14, 2024

I think empty = array[False] is a typo (and I don't know what it's supposed to be).

Other than that, everything else looks correct.

from awkward-0.x.

jpivarski avatar jpivarski commented on June 14, 2024

Oh, now I see the array defined above it (I thought this was supposed to be a function call— sorry!).

Still looking at it, I don't see any errors. This is how content and flatten() are supposed to act.

Slicing a jagged array does minimal work: it replaces the starts and stops arrays, but doesn't touch the content. This avoids having to recursively make changes to all the contents, which might be a wide Table. In a very common case, you'll be applying cuts on an array of events. You don't want it to have to modify every field of every particle— you want it to quickly mark some events as bad.

This is why there's an important difference between content and flatten(). If you want to logically flatten the data, so that only the desired values exist, use flatten().

from awkward-0.x.

jpivarski avatar jpivarski commented on June 14, 2024

Another thing to notice is that your first example used a flat boolean array as a mask, which masks out the top level of structure. The second example used a jagged boolean mask, which has a different meaning: it filters at the depth of its own jaggedness.

Removing inner values ("particles"):

array[array != 1]

Removing outer values ("events"):

array[array.min() != 1]

(Look at the mask arrays directly to see the difference.)

from awkward-0.x.

bhgomes avatar bhgomes commented on June 14, 2024

I think this should be made clear in the uproot README. Currently it only shows jagged_array.content to access the underlying ndarray when this may not always be semantically the right function to use.

EDIT:
Also here on this README. It's not clear that this is not doing what you expect.

from awkward-0.x.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.