
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Python package for performing set type operations on any layout of discrete space in any dimension.
A python package for performing set operations on layouts of discrete space in any dimension.
Block is an orthogonal clump of units/pixels (i.e. a line segment, rectangle, cuboid, hyper... you get the idea)
BlockSet takes a layout and resolves it to a disjoint set of Blocks in a consistent fashion, regardless of how the layout was composed.
You might choose to use a BlockSet
instead of a set
of tuples because the
resolution/granularity is sufficiently high to warrant it.
Or in other words, the number of pixels/points being modelled pushes the limits of the available computing power due to the expanse of the space they take up.
add
, remove
or toggle
blocks over the current blockset state.union
, intersection
, difference
etc. on
blockset objects.blocksets is available on pypi.org and can be installed using pip (there are no dependent packages).
pip install blocksets
Visit readthedocs
Review and run the example_use.py
module via python -m blocksets.example_use
for a few examples, one of which follows here.
from blocksets import Block, BlockSet
# A block is defined by the co-ordinates of the opposite corners
big_rubik = Block((0, 0, 0), (99999, 99999, 99999))
assert big_rubik.measure == 999970000299999
# A single argument is a unit block
centre_cube = Block((49999, 49999, 49999))
assert centre_cube.measure == 1
# Create a large 3 dimensional cube with the centre missing
bs = BlockSet(3)
bs.add(big_rubik)
bs.remove(centre_cube)
assert bs.measure == 999970000299998
assert len(bs) == 6
sorted_blocks = sorted(bs, key=lambda x: x.norm)
for blk in sorted_blocks:
print(f"{blk:50} {blk.measure}")
The resulting space is modelled using 6 objects (effectively tuples) instead of 999970000299998
(0, 0, 0)..(49999, 99999, 99999) 499980000249999
(49999, 0, 0)..(50000, 49999, 99999) 4999850001
(49999, 49999, 0)..(50000, 50000, 49999) 49999
(49999, 49999, 50000)..(50000, 50000, 99999) 49999
(49999, 50000, 0)..(50000, 99999, 99999) 4999850001
(50000, 0, 0)..(99999, 99999, 99999) 499980000249999
An example of 2D set operations on some randomly generated block sets A, B and
drawn using matplotlib
. See
readthedocs
for code snippet to generate this
At the moment it is early days so whilst the foundations are forming I am only inviting comments which can be given via github issues
FAQs
Python package for performing set type operations on any layout of discrete space in any dimension.
We found that blocksets demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.