Skip to content

Commit

Permalink
Initial adaptation of peak.util.imports
Browse files Browse the repository at this point in the history
  • Loading branch information
mnmelo committed Jun 20, 2017
1 parent f8d5c5e commit 8dfe010
Show file tree
Hide file tree
Showing 16 changed files with 678 additions and 463 deletions.
26 changes: 1 addition & 25 deletions package/MDAnalysis/analysis/density.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,31 +118,7 @@
import os.path
import errno
import warnings

try:
from gridData import Grid
except ImportError:
raise ImportError(
"""ImportError: The GridDataFormats package can not be found!
The 'gridData' module from GridDataFormats could not be
imported. Please install it first. You can try installing
directly from the internet:
pip install GridDataFormats
or
conda config --add channels conda-forge
conda install griddataformats
Alternatively, download the package from
http://pypi.python.org/pypi/GridDataFormats/
and install in the usual manner.
"""
)
from gridData import Grid

import MDAnalysis
from MDAnalysis.core import groups
Expand Down
4 changes: 3 additions & 1 deletion package/MDAnalysis/analysis/distances.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
'contact_matrix', 'dist', 'between']

import numpy as np
import scipy.sparse

from MDAnalysis.lib.distances import distance_array, self_distance_array
from MDAnalysis.lib.c_distances import contact_matrix_no_pbc, contact_matrix_pbc
Expand All @@ -52,6 +51,9 @@
import logging
logger = logging.getLogger("MDAnalysis.analysis.distances")

# Optional and/or lazily imported modules
from MDAnalysis.lib import lazy
scipy = lazy.import_module('scipy.sparse', level='base')

def contact_matrix(coord, cutoff=15.0, returntype="numpy", box=None):
'''Calculates a matrix of contacts.
Expand Down
Loading

0 comments on commit 8dfe010

Please sign in to comment.