pygauss.utils module

Created on Thu Apr 30 01:08:30 2015

@author: chris

pygauss.utils.circumcenter(pts)[source]

Computes the circumcenter and circumradius of M, N-dimensional points (1 <= M <= N + 1 and N >= 1). The points are given by the rows of an (M)x(N) dimensional maatrix pts.

Returns a tuple (center, radius) where center is a column vector of length N and radius is a scalar.

In the case of four points in 3D, pts is a 4x3 matrix arranged as:

pts = [ x0 y0 z0 ]
[ x1 y1 z1 ] [ x2 y2 z2 ] [ x3 y3 z3 ]

with return value ([ cx cy cz ], R)

Uses an extension of the method described here: http://www.ics.uci.edu/~eppstein/junkyard/circumcenter.html

pygauss.utils.circumcenter_barycoords(pts)[source]

Computes the barycentric coordinates of the circumcenter M, N-dimensional points (1 <= M <= N + 1 and N >= 1). The points are given by the rows of an (M)x(N) dimensional matrix pts.

Uses an extension of the method described here: http://www.ics.uci.edu/~eppstein/junkyard/circumcenter.html

pygauss.utils.df_to_img(df, na_rep='-', other_temp=None, font_size=None, width=None, height=None, unconfined=False)[source]

converts a pandas Dataframe to an IPython image

na_rep : str
how to represent empty (nan) cells
other_temp : str
a latex template to use for the table other than the default

The function uses pandas to convert the dataframe to a latex table, applies a template, converts to a PDF, converts to an image, and finally return the image

to use this function you will need the pdflatex executable from tex distribution, the convert executable from imagemagick, which also requires ghostscript; http://www.ghostscript.com/download/gsdnld.html http://www.imagemagick.org/script/binary-releases.php

NB: on Windows some issues were found with convert being an already existing application. To overcome this change its filename and use the im_name variable.

pygauss.utils.imgplot_kmean_groups(analysis, category, cat_name, groups, columns, filters={}, output=[], max_cols=2, **kwargs)[source]
pygauss.utils.is_wellcentered(pts, tol=1e-08)[source]

Determines whether the M points in N dimensions define a well-centered simplex.

pygauss.utils.set_imagik_exe(name)[source]