Welcome to pydaily’s documentation!¶
The documentation for pydaily is mainly organized by sub-modules.
filesystem¶
find_ext_files¶
- def find_ext_files(dir_name, ext):
“”” Find all file with specific extension under designated directory.
“”“
Arguments
dir_name: path of the designated directory
ext: specific file extension
overwrite_dir¶
- def overwrite_dir(dir_name):
“”” Create a directory, and delete it first if exist.
“”“
Arguments
dir_name: path of the directory
batch_rename_files¶
- def batch_rename_files(input_dir, save_dir, ext=’.png’, start_num=0, filename_len=5):
“”” Rename all files with specific extention in an input directory to another directory with ordering numbers.
“”“
Arguments
input_dir: directory that interested files in
save_dir: directory to save renamed files
ext: interested file extension
start_num: start number for first file
filename_len: length of renamed filename
batch_uuid_rename¶
- def batch_uuid_rename(input_dir, save_dir, ext=”.png”):
“”” Rename all files with specific extension in an input directory to another directory with uuid string as filename.
“”“
Arguments
input_dir: directory that interested files in
save_dir: directory to save renamed files
ext: interested file extension
is_image_file¶
- def is_image_file(filename):
“”” Check given filename is an image or not. Extensions of image file include: [‘.jpg’, ‘.JPG’, ‘.jpeg’, ‘.JPEG’, ‘.png’, ‘.PNG’, ‘.ppm’, ‘.PPM’, ‘.bmp’, ‘.BMP’, ‘tif’, ‘TIF’, ‘tiff’, ‘TIFF’,]
“”“
Arguments
filename: name or path of given file
format¶
json_to_dict¶
- def json_to_dict(json_path):
“”” Load json file as dictionary.
“”“
dict_to_json¶
- def dict_to_json(data_dict, json_path):
“”” Save dictionary to json file.
“”“
csv_to_dict¶
- def csv_to_dict(csv_path):
“”” Load csv to python dictionary.
“”“
pkl_to_dict¶
- def pkl_to_dict(pkl_path):
“”” Load pickle file as python dictionary
“”“
dict_to_pkl¶
- def dict_to_pkl(data_dict, pkl_path):
“”” Save dictionary data as pickle file
“”“
h5_to_dict¶
- def h5_to_dict(h5_path):
“”” Load h5 to python dictionary.
“”“
dict_to_h5¶
- def dict_to_h5(data_dict, h5_path):
“”” Save python dictionary to h5 file.
“”“
txt_to_list¶
- def txt_to_list(txt_path):
“”” Load text file as list
“”“
list_to_txt¶
- def list_to_txt(data_list, txt_path):
“”” Save python list to text file
“”“
tic¶
time_to_str¶
- def time_to_str(delta_t, mode=”min”):
“”“Convert elapsed time to string representation
- delta_t: time difference
- Elapsed time
- mode: str
- Time representation manner, by “minitues” or “seconds”.
- delta_str: str
- Elapsed time string representation
>>> from timeit import default_timer as timer >>> start = timer() >>> end = timer() >>> elapsed_time_str = time_to_str(end - start, "min")
“”“
About pydaily¶
pydaily package is a collection of functions and utilities used in my daily research. I organize all these functions together mainly for following reasons.
- Figure out how to write a python package and upload to pypi.
- Avoid reinventing the wheel all the time. After all, life is short.
- Expect this package can be of help to the community, especially those in working in computer vision, machine learning, biomedical image analysis. I also look forward for contributors to improve the package.
- For the spirit of open source. Sharing is growing.
\ Sort by:\ best rated\ newest\ oldest\
\\
Add a comment\ (markup):
\``code``
, \ code blocks:::
and an indented block after blank line