repic.utils.common ================== .. py:module:: repic.utils.common .. autoapi-nested-parse:: Common functions and libraries shared across REPIC scripts Attributes ---------- .. autoapisummary:: repic.utils.common.print repic.utils.common.box_id Functions --------- .. autoapisummary:: repic.utils.common.adjust_plot_attributes repic.utils.common.is_float repic.utils.common.create_dir repic.utils.common.del_dir repic.utils.common.get_box_coords repic.utils.common.get_box_vertex_entry repic.utils.common.get_multi_in_coords repic.utils.common.write_pickle Module Contents --------------- .. py:data:: print partial function to have all print statements flush buffer :type: func .. py:data:: box_id :value: 0 NetworkX initial vertex (particle bounding box) ID :type: int .. py:function:: adjust_plot_attributes(ax, xlabel, ylabel, fontsize=32) Adjusts general Matplotlib plot parameters :param ax: Matplotlib axis object :type ax: obj :param xlabel: x-axis label :type xlabel: str :param ylabel: y-axis label :type ylabel: str :keyword fontsize: font size of plot text :kwtype fontsize: int, default=32 :returns: None .. py:function:: is_float(val) Checks if Python object can be converted to float datatype :param val: Python object :type val: obj :returns: True if string can be converted (False otherwise) :rtype: bool .. py:function:: create_dir(dir_path) Creates directory at provided location :param dir_path: file path to directory :type dir_path: str :returns: file path to directory :rtype: str .. py:function:: del_dir(dir_path) Deletes directory if it exists :param dir_path: file path to directory :type dir_path: str :returns: file path to directory :rtype: str .. py:function:: get_box_coords(pattern, key=1.0, size=None, return_weights=False) Parses particle bounding box file and returns particle bounding box coordinates :param pattern: filename RegEx pattern :type pattern: str :keyword key: method key for k-d tree building :kwtype key: float, default=1. :keyword size: restrict the number of coordinates returned to this value :kwtype size: int or None :keyword return_weight: flag to include particle bounding box score or confidence in return :kwtype return_weight: bool, default=False :returns: list of particle bounding box coordinates :rtype: list .. py:function:: get_box_vertex_entry(coord, clique_size, index) Returns particle bounding box coordinates of a clique as a vector :param coord: particle bounding box coordinates :type coord: list :param clique_size: size of clique :type clique_size: int :param index: position of particle bounding boxes in clique (determined by order of particle picking algorithms) :type index: int :returns: particle coordinates formatted for multi-out output :rtype: list .. py:function:: get_multi_in_coords(in_file) Parses a particle bounding box file that contains multiple boxes per line (optimal cliques) and returns their coordinates, labels, and weights :param in_file: filepath to particle bounding box file :type in_file: str :returns: lists of particle bounding box coordinates, labels, and weights :rtype: list, list, list .. py:function:: write_pickle(data, out_file) Writes provided data to storage in Pickle format :param data: NumPy array object :type data: obj :param out_file: filepath for output file :type out_file: str :returns: None