pysal.lib.weights.spw_from_gal

pysal.lib.weights.spw_from_gal(galfile)[source]

Sparse scipy matrix for w from a gal file.

Parameters:
galfile : string

name of gal file including suffix

Returns:
spw : sparse_matrix

scipy sparse matrix in CSR format

ids : array

identifiers for rows/cols of spw

Examples

>>> import pysal.lib
>>> spw = pysal.lib.weights.user.spw_from_gal(pysal.lib.examples.get_path("sids2.gal"))
>>> spw.sparse.nnz
462