aggmap.utils package
Submodules
aggmap.utils.calculator module
Created on Sat Aug 17 16:54:12 2019
@author: wanxiang.shen@u.nus.edu
@usecase: calculate varies distances
- aggmap.utils.calculator.pairwise_distance(npydata, n_cpus=8, method='correlation')[source]
- Parameters:
method ({'euclidean', 'manhattan', 'canberra', 'chebyshev',) – ‘cosine’, ‘braycurtis’, ‘correlation’, ‘jaccard’, ‘rogerstanimoto’, ‘hamming’, ‘dice’, ‘kulsinski’, ‘sokal_sneath’}
npydata (np.array or np.memmap, Note that the default we will calcuate the vector's distances instead of sample's distances, if you wish to calculate distances between samples, you can pass data.T instead of data) –
Usage –
-------------- –
np (>>> import numpy as) –
np.random.random_sample(size=(10000 (>>> data =) –
10) –
pairwise_distance(data) (>>> dist_matrix =) –
dist_matrix.shape (>>>) –
(10 (>>>) –
10) –
aggmap.utils.distances module
- aggmap.utils.distances.chebyshev(x, y)[source]
Chebyshev or l-infinity distance. ..math:
D(x, y) = \max_i |x_i - y_i|
- aggmap.utils.distances.euclidean(x, y)[source]
Standard euclidean distance. l2 distance ..math:
D(x, y) = \sqrt{\sum_i (x_i - y_i)^2}
aggmap.utils.gen_nwk module
Created on Fri Aug 27 14:06:17 2021
@author: Shen Wanxiang
aggmap.utils.logtools module
Created on Sat Aug 17 16:54:12 2019
@author: wanxiang.shen@u.nus.edu
@logtools
- aggmap.utils.logtools.print_debug(*args, sep=' ', verbose=True)
- aggmap.utils.logtools.print_error(*args, sep=' ', verbose=True)
- aggmap.utils.logtools.print_info(*args, sep=' ', verbose=True)
- aggmap.utils.logtools.print_warn(*args, sep=' ', verbose=True)
aggmap.utils.matrixopt module
Created on Sun Aug 25 20:29:36 2019
@author: wanxiang.shen@u.nus.edu
matrix operation
- class aggmap.utils.matrixopt.Scatter2Array(fmap_shape=(128, 128))[source]
Bases:
object
- class aggmap.utils.matrixopt.Scatter2Grid[source]
Bases:
object
aggmap.utils.multiproc module
Created on Wed Nov 21 12:52:49 2018
@author: shenwanxiang
Multi process Run
- aggmap.utils.multiproc.ImapUnorder(processor, iterator, max_workers=10, fail_in_file='./filed.lst')[source]
processor: fuction iterator: list or iterator,each element should be a tuple or dict, so that data can be used as ordered
- aggmap.utils.multiproc.MultiExecutorRun(func, deal_list, n_cpus=4, tqdm_args={'unit': 'one'})[source]
- input:
func: function to do with each element in the deal_list deal_list: list to be done n_cpus: use the number of cpus tqdm_args: args for tqdm
- output:
list of the return value for each func
aggmap.utils.summary module
Created on Sat Aug 17 16:54:12 2019
@author: wanxiang.shen@u.nus.edu
@usecase: statistic features’ distribution
aggmap.utils.vismap module
- aggmap.utils.vismap.plot_grid(mp, htmlpath='./', htmlname=None, enabled_data_labels=False)[source]
mp: the object of mp htmlpath: the figure path