Skip to main content

Python utility tools for research

Project description

https://img.shields.io/pypi/v/toolman.svg https://travis-ci.com/bohaohuang/toolman.svg?branch=master https://codecov.io/gh/bohaohuang/toolman/branch/master/graph/badge.svg

See the source for this project on our GitHub page

Install

pip install toolman

Modules

mist_utils.py

miscellaneous utility functions including data I/O and processing

  1. Read/write different formats of files in one function:
import toolman as tm
data = tm.misc_utils.load_file(file_name)
tm.misc_utils.save_file(file_name, data)

Currently support extensions including: .npy, .pkl, .txt, .csv, .json and commonly used image formats.

  1. Argument parser, parse nested argument list:
import sys
import argparse
import toolman as tm
parser = argparse.ArgumentParser()
args, extras = parser.parse_known_args(sys.argv[1:])
cfg_dict = tm.misc_utils.parse_args(extras)

vis_utils.py

Matplotlib utility functions for visualization

  1. Display images in side by side with axis linked
import toolman as tm
fig1 = tm.misc_utils.load_file(img_name_1)
fig2 = tm.misc_utils.load_file(img_name_1)
tm.vis_utils.compare_figures([fig1, fig2], (1, 2), fig_size=(12, 5))
  1. Display barplots
import toolman as tm
data = np.random.random((3, 4))
labels = ['group 1', 'group 2', 'group 3']
xticks = ['cluster 1', 'cluster 2', 'cluster 3', 'cluster 4']
tm.vis_utils.compare_bars(data, labels, xticks)

img_utils

image specific utility functions

pytorch_utils

pytorch specific utility functions

process_block

A processing unit that do certain operations only if it has never done before. This is helpful avoid duplicate executing time consuming jobs.

import toolman as tm
def foo(cnt_len):
    cnt = 0
    for i in range(cnt_len):
        cnt += 1
    return cnt

pb = tm.process_block.ProcessBlock(foo, file_dir)
pb.run(force_run=False, cnt_len=100)

Project details


Download files

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

Files for toolman, version 0.1.14
Filename, size File type Python version Upload date Hashes
Filename, size toolman-0.1.14.tar.gz (12.7 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page