Skip to main content

A python package for processing 3d volumetric data to build meshes for the Sand Atlas data repository

Project description

Sand Atlas

Code style: black

Documentation here, or compile it yourself following the details below.

Installation

First, install ffmpeg and blender on your system. Both of these need to be available in your system path (so that running ffmpeg and blender in the command line works).

This package can then be installed via pip install sand-atlas. If installing from github, try cloning and then running:

pip install -e .

If you make any changes to the source code, re-run those two lines to have your changes reflected in your installed package.

Usage

Processing particles

If you are interested in reproducing a dataset that is available in the Sand Atlas, you can use the installed script sand_atlas_process, like so:

sand_atlas_process <path_to_json_file> --label <path_to_labelled_image> --raw <path_to_raw_image>

If you supply only the raw image, the script will attempt to label the image for you. If you supply the labelled image, the script will use that to generate the dataset. The json file contains the metadata for the dataset you are interested in. The json files for the datasets in the Sand Atlas are available here.

VDB files

VDB files are the industry standard for level set data. They can be viewed in recent versions of the open source software blender, via Add -> Volume -> Import OpenVDB. If you would like to use these files in a python environment that doesn't include the pyopenvdb package, you can use the vdb_to_npy script provided by the sand_atlas package to convert the VDB file to a numpy array:

vdb_to_npy <path_to_vdb_file>

This will produce a .npy file in the same directory where you run the script. You can then load this file in python with np.load:

import numpy as np
data = np.load('path_to_npy_file.npy')

Downloading particles from the python API

You can query the server to get a list of all of the available types of particles with

import sand_atlas
particles = sand_atlas.data.list()
print(particles)

If you would like to download all of the particles with a particular mesh quality to the current working directory, you do this via

import sand_atlas
sand_atlas.data.get_all('SAND-NAME', MESH-QUALITY)

If you would like to download a specific particle, you can do this via

import sand_atlas
sand_atlas.data.get_by_id('SAND-NAME', MESH-QUALITY, PARTICLE-ID)

Documentation

We use sphinx to manage the docs. Update documentation with:

cd docs
make html

Once these are built, you can commit and push the changes to github to have them refreshed on github pages. You can also view them locally.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sand_atlas-1.1.4.tar.gz (30.2 kB view details)

Uploaded Source

Built Distribution

sand_atlas-1.1.4-py3-none-any.whl (30.2 kB view details)

Uploaded Python 3

File details

Details for the file sand_atlas-1.1.4.tar.gz.

File metadata

  • Download URL: sand_atlas-1.1.4.tar.gz
  • Upload date:
  • Size: 30.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for sand_atlas-1.1.4.tar.gz
Algorithm Hash digest
SHA256 fe2b4b96e42e5b333cb1a82f743c711bd11513410ee3c5c3a13998914c1ef66b
MD5 d7638c1eb18a6ab7b3b24d623a1be4b3
BLAKE2b-256 4d299bb733745116e1f662e5253f6e1442785866d0c8625940d75c6fdb6581d2

See more details on using hashes here.

Provenance

The following attestation bundles were made for sand_atlas-1.1.4.tar.gz:

Publisher: workflow.yml on scigem/sand-atlas-python

Attestations:

File details

Details for the file sand_atlas-1.1.4-py3-none-any.whl.

File metadata

  • Download URL: sand_atlas-1.1.4-py3-none-any.whl
  • Upload date:
  • Size: 30.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for sand_atlas-1.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 fdec5e5ad9ddd9d40a85d3f8a9ccca29c50a009eaee12a0d129187cb996ec4ad
MD5 aa51b488ff8601d34af0b9618ad603ac
BLAKE2b-256 d9425b7fbb35d777c9846804072eb603f654a29259df4d80440c23c228ceb756

See more details on using hashes here.

Provenance

The following attestation bundles were made for sand_atlas-1.1.4-py3-none-any.whl:

Publisher: workflow.yml on scigem/sand-atlas-python

Attestations:

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page