Skip to main content

Utility tools for ShareLoc.XYZ

Project description

ShareLoc Utilities

Utility tools for ShareLoc.XYZ in Python

Features

Installation

pip install -U shareloc-utils

Usage for Batch Download

You can pass datasets url directly to the command line like this:

python -m shareloc_utils.batch_download --datasets=https://sandbox.zenodo.org/record/891810 --output_dir=./output --conversion

If you want to downlaod multiple datasets, use comma to separate multiple dataset URL.

To print all other options type:

python -m shareloc_utils.batch_download --help

Use the SMLM file parser

In Python, you use the read_smlm_file function to parse the *.smlm file downloaded from ShareLoc(https://shareloc.xyz).

In the following example, we first parse the tables in the smlm file, then generate a histogram image:

from PIL import Image
from shareloc_utils.smlm_file import read_smlm_file, plot_histogram

# parse the .smlm file
manifest = read_smlm_file("./localization_table.smlm")
# one file can contain multiple localization tables
tables = manifest["files"]

# generate an histogram image for the first table
histogram = plot_histogram(tables[0]["data"], value_range=(0, 255))

# save the histogram image as 16-bit png file
im = Image.fromarray(histogram.astype("uint16"))
im.save("output.png")

Development

  • Install and set up development environment.

    pip install -r requirements_dev.txt
    

    This will install all requirements. It will also install this package in development mode, so that code changes are applied immediately without reinstall necessary.

  • Here's a list of development tools we use.

  • It's recommended to use the corresponding code formatter and linters also in your code editor to get instant feedback. A popular editor that can do this is vscode.

  • Run all tests, check formatting and linting.

    tox
    
  • Run a single tox environment.

    tox -e lint
    
  • Reinstall all tox environments.

    tox -r
    
  • Run pytest and all tests.

    pytest
    
  • Run pytest and calculate coverage for the package.

    pytest --cov-report term-missing --cov=shareloc_utils
    
  • Continuous integration is by default supported via GitHub actions. GitHub actions is free for public repositories and comes with 2000 free Ubuntu build minutes per month for private repositories.

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

shareloc-utils-0.1.0.tar.gz (8.5 kB view details)

Uploaded Source

File details

Details for the file shareloc-utils-0.1.0.tar.gz.

File metadata

  • Download URL: shareloc-utils-0.1.0.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for shareloc-utils-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2df0d6a43f1fae73a1f2d6f6fe32aea6d41e74b0a4e3e770a4d858e78e622c76
MD5 8955f2748173f4f6c01397bf84b968f9
BLAKE2b-256 60f5429d9a13476ba76d64948fd1cde58d453fd34ac5a56905b125b41559b5ad

See more details on using hashes here.

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