Skip to content

Commit

Permalink
MAINT: sort imports in contrib
Browse files Browse the repository at this point in the history
  • Loading branch information
kohr-h committed Mar 13, 2018
1 parent dc9d250 commit 72f4106
Show file tree
Hide file tree
Showing 41 changed files with 106 additions and 70 deletions.
3 changes: 2 additions & 1 deletion odl/contrib/datasets/ct/fips.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
"""Tomographic datasets from the Finish Inverse Problems Society (FIPS)."""

from __future__ import division

import numpy as np

from odl.contrib.datasets.util import get_data
from odl.discr import uniform_partition
from odl.tomo import FanFlatGeometry


__all__ = ('walnut_data', 'walnut_geometry',
'lotus_root_data', 'lotus_root_geometry')

Expand Down
1 change: 1 addition & 0 deletions odl/contrib/datasets/images/cambridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"""Images provided by the University of Cambridge."""

import numpy as np

import skimage.transform
from odl.contrib.datasets.util import get_data

Expand Down
3 changes: 2 additions & 1 deletion odl/contrib/datasets/images/examples/cambridge_images.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
"""Example of the Cambridge images."""

import odl.contrib.datasets.images as images
import numpy as np

import odl
import odl.contrib.datasets.images as images


def convert_to_odl(image):
Expand Down
3 changes: 2 additions & 1 deletion odl/contrib/datasets/mri/tugraz.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
import numpy as np
from pkg_resources import parse_version

from odl.contrib.datasets.util import get_data
import odl
from odl.contrib.datasets.util import get_data

if parse_version(np.__version__) < parse_version('1.12'):
flip = odl.util.npy_compat.flip
else:
Expand Down
9 changes: 5 additions & 4 deletions odl/contrib/datasets/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@
"""Utilities for datasets."""

from __future__ import print_function

import contextlib
import os
from os.path import join, expanduser, exists
from future.moves.urllib.request import urlopen
from os.path import exists, expanduser, join
from shutil import copyfileobj, rmtree
from scipy import io
import contextlib

from future.moves.urllib.request import urlopen
from scipy import io

__all__ = ('get_data_dir', 'cleanup_data_dir', 'get_data')

Expand Down
1 change: 1 addition & 0 deletions odl/contrib/fom/examples/haarpsi.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import matplotlib.pyplot as plt
import numpy as np
import scipy.misc

from odl.contrib import fom

# --- Generate images --- #
Expand Down
1 change: 1 addition & 0 deletions odl/contrib/fom/examples/noise_power_spectrum.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Simple example of noise power spectrum (NPS)."""

import numpy as np

import odl
from odl.contrib import fom

Expand Down
5 changes: 3 additions & 2 deletions odl/contrib/fom/examples/supervised_comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
"""

import matplotlib.pyplot as plt
import numpy as np

import odl
from odl.contrib import fom
import numpy as np
import matplotlib.pyplot as plt

# Discrete space: discretized functions on the rectangle
# [-20, 20]^2 with 100 samples per dimension.
Expand Down
1 change: 1 addition & 0 deletions odl/contrib/fom/supervised.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"""Figures of merit (FOMs) for comparison against a known ground truth."""

from __future__ import division

import numpy as np

import odl
Expand Down
4 changes: 3 additions & 1 deletion odl/contrib/fom/test/test_supervised.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
"""Tests for supervised FoMs."""

from __future__ import division

import numpy as np
import pytest
import scipy.signal
import scipy.misc
import scipy.signal

import odl
import odl.contrib.fom
from odl.contrib.fom.util import filter_image_sep2d
Expand Down
1 change: 1 addition & 0 deletions odl/contrib/fom/test/test_unsupervised.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import numpy as np
import pytest

import odl
import odl.contrib.fom

Expand Down
1 change: 1 addition & 0 deletions odl/contrib/fom/unsupervised.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"""Figures of Merit (FOMs) for measuring image quality without a reference."""

from __future__ import division

import numpy as np

__all__ = ('estimate_noise_std',)
Expand Down
6 changes: 3 additions & 3 deletions odl/contrib/mrc/examples/mrc_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@

from __future__ import print_function

import matplotlib.pyplot as plt
import numpy as np
import os
import tempfile

import matplotlib.pyplot as plt
import numpy as np

from odl.contrib.mrc import (
FileReaderMRC, FileWriterMRC, mrc_header_from_params)


# --- Reading --- #

file_path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
Expand Down
4 changes: 2 additions & 2 deletions odl/contrib/mrc/examples/raw_binary_with_header_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
sequence of dictionaries with a certain structure.
"""

import tempfile
from collections import OrderedDict

import matplotlib.pyplot as plt
import numpy as np
import scipy
import tempfile

from odl.contrib.mrc import (
FileReaderRawBinaryWithHeader, FileWriterRawBinaryWithHeader)


# --- Writing --- #

# Create some test data. We arbitrarily define origin and pixel size.
Expand Down
9 changes: 5 additions & 4 deletions odl/contrib/mrc/mrc.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,20 @@

"""Specification and reader for the MRC2014 file format."""

from __future__ import print_function, division, absolute_import
from __future__ import absolute_import, division, print_function

import struct
import warnings
from builtins import int, object
from collections import OrderedDict
from itertools import permutations

import numpy as np
import struct
import warnings

from odl.contrib.mrc.uncompr_bin import (
FileReaderRawBinaryWithHeader, FileWriterRawBinaryWithHeader,
header_fields_from_table)


__all__ = ('FileReaderMRC', 'FileWriterMRC', 'mrc_header_from_params')


Expand Down
9 changes: 5 additions & 4 deletions odl/contrib/mrc/test/mrc_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,18 @@
"""Tests for the MRC I/O routines."""

from __future__ import division

import tempfile
from itertools import permutations
import pytest

import numpy as np
import tempfile
import pytest

import odl
from odl.contrib.mrc import (
mrc_header_from_params, FileWriterMRC, FileReaderMRC)
FileReaderMRC, FileWriterMRC, mrc_header_from_params)
from odl.util.testutils import all_equal, simple_fixture


# --- pytest fixtures --- #


Expand Down
7 changes: 4 additions & 3 deletions odl/contrib/mrc/test/uncompr_bin_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@
"""

from __future__ import division
import numpy as np

import tempfile

import numpy as np

import odl
from odl.contrib.mrc import (
FileWriterRawBinaryWithHeader, FileReaderRawBinaryWithHeader)
FileReaderRawBinaryWithHeader, FileWriterRawBinaryWithHeader)
from odl.util.testutils import simple_fixture


# --- pytest fixtures --- #


Expand Down
9 changes: 5 additions & 4 deletions odl/contrib/mrc/uncompr_bin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@

"""Utilities and class for reading uncompressed binary files with header."""

from __future__ import print_function, division, absolute_import
from builtins import int, object
from collections import OrderedDict
from __future__ import absolute_import, division, print_function

import csv
import numpy as np
import struct
from builtins import int, object
from collections import OrderedDict

import numpy as np

__all__ = ('FileReaderRawBinaryWithHeader',
'FileWriterRawBinaryWithHeader',
Expand Down
7 changes: 4 additions & 3 deletions odl/contrib/pyshearlab/pyshearlab_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
"""ODL integration with pyshearlab."""


import odl
import numpy as np
import pyshearlab
from threading import Lock

import numpy as np

import odl
import pyshearlab

__all__ = ('PyShearlabOperator',)

Expand Down
4 changes: 2 additions & 2 deletions odl/contrib/pyshearlab/test/operator_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

"""Unit tests for the ODL-pyshearlab integration."""

import pytest
import numpy as np
import pytest

import odl
import odl.contrib.pyshearlab
from odl.util.testutils import all_almost_equal, simple_fixture


dtype = simple_fixture('dtype', ['float32', 'float64'])
shape = simple_fixture('shape', [(64, 64), (128, 128)])

Expand Down
2 changes: 1 addition & 1 deletion odl/contrib/solvers/examples/tomography_nonlocalmeans.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
"""

import numpy as np

import odl
import odl.contrib.solvers


# Select what type of denoising to use. Options: 'TV', 'NLM' and 'TV_NLM'
model = 'TV'

Expand Down
3 changes: 2 additions & 1 deletion odl/contrib/solvers/functional/nonlocalmeans_functionals.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

"""Non Local Means functionals."""

from __future__ import print_function, division, absolute_import
from __future__ import absolute_import, division, print_function

import numpy as np

from odl.operator import Operator
Expand Down
3 changes: 2 additions & 1 deletion odl/contrib/tensorflow/examples/tensorflow_layer_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
"""

from __future__ import print_function
import tensorflow as tf

import numpy as np

import odl
import odl.contrib.tensorflow
import tensorflow as tf

sess = tf.InteractiveSession()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
"""

from __future__ import print_function
import tensorflow as tf

import odl
import odl.contrib.tensorflow
import tensorflow as tf

sess = tf.InteractiveSession()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
"""

from __future__ import print_function
import tensorflow as tf

import numpy as np

import odl
import odl.contrib.tensorflow
import tensorflow as tf

sess = tf.InteractiveSession()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
"""

from __future__ import print_function
import tensorflow as tf

import numpy as np

import odl
import odl.contrib.tensorflow
import tensorflow as tf

sess = tf.InteractiveSession()

Expand Down
3 changes: 2 additions & 1 deletion odl/contrib/tensorflow/examples/tensorflow_tomography.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
using a gradient descent method (ADAM).
"""

import tensorflow as tf
import numpy as np

import odl
import odl.contrib.tensorflow
import tensorflow as tf

sess = tf.InteractiveSession()

Expand Down
8 changes: 5 additions & 3 deletions odl/contrib/tensorflow/layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@

"""Utilities for converting ODL operators to tensorflow layers."""

from __future__ import print_function, division, absolute_import
from __future__ import absolute_import, division, print_function

import uuid

import numpy as np

import odl
import uuid
import tensorflow as tf
from tensorflow.python.framework import ops


__all__ = ('as_tensorflow_layer',)


Expand Down
Loading

0 comments on commit 72f4106

Please sign in to comment.