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

Keep track of density by hash rather than in an array #18

Open
geowurster opened this issue Dec 15, 2015 · 0 comments
Open

Keep track of density by hash rather than in an array #18

geowurster opened this issue Dec 15, 2015 · 0 comments

Comments

@geowurster
Copy link
Contributor

Run each point through the affine transform and generate a dictionary of indices and counts. Stitch everything together at the end. Will likely be much faster with a lower memory footprint since most of the "pixels" are empty.

density = defaultdict(int)

pos = (x, y) * ~affine
density[pos] += 1

out = np.array((rows, cols))

for pos, count in density.items():
    r, c = pos
    out[r][c] += count
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

1 participant