Skip to content

Commit

Permalink
black reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
ywkure committed Feb 17, 2021
1 parent 709058f commit a353cf8
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 25 deletions.
2 changes: 1 addition & 1 deletion napari_split_dataset/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Top-level package for napari-split-dataset."""

__author__ = """You Wu"""
__version__ = '0.1.0'
__version__ = "0.1.0"

from ._reader import napari_get_reader
15 changes: 11 additions & 4 deletions napari_split_dataset/_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,21 @@ def read_directory(path):
if len(data.shape) > 3:
# set contrast limits for 4D data
# otherwise napari tries to set them after reading everything, which would take too long if the data was large.
data_for_contrast = data[min(2, data.shape[0]-1):min(7, data.shape[0]), :, :, :]
contrast_limits = (np.percentile(data_for_contrast, 0.1), np.percentile(data_for_contrast, 99.9))
data_for_contrast = data[
min(2, data.shape[0] - 1) : min(7, data.shape[0]), :, :, :
]
contrast_limits = (
np.percentile(data_for_contrast, 0.1),
np.percentile(data_for_contrast, 99.9),
)

data = data.as_dask() # read as a dask array
# optional kwargs for the corresponding viewer.add_* method
add_kwargs = {"contrast_limits": contrast_limits,}
add_kwargs = {
"contrast_limits": contrast_limits,
}
else:
data = data[:,:,:]
data = data[:, :, :]
add_kwargs = {}

layer_type = "image" # optional, default is "image"
Expand Down
44 changes: 24 additions & 20 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from setuptools import setup, find_packages
import os

with open('README.rst') as readme_file:
with open("README.rst") as readme_file:
readme = readme_file.read()

# with open('HISTORY.rst') as history_file:
Expand All @@ -17,38 +17,42 @@
with open("requirements_dev.txt") as f:
requirements_dev = f.read().splitlines()

setup_requirements = ['pytest-runner', ]
setup_requirements = [
"pytest-runner",
]

test_requirements = ['pytest>=3', ]
test_requirements = [
"pytest>=3",
]

setup(
author="You Wu",
author_email='[email protected]',
python_requires='>=3.5',
author_email="[email protected]",
python_requires=">=3.5",
classifiers=[
'Development Status :: 2 - Pre-Alpha',
'Intended Audience :: Developers',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Natural Language :: English',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
"Development Status :: 2 - Pre-Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
],
description="hdf5/split-dataset file reader for napari",
extras_require=dict(dev=requirements_dev),
install_requires=requirements,
license="GNU General Public License v3",
# long_description=readme + '\n\n' + history,
include_package_data=True,
keywords='napari_split_dataset',
name='napari_split_dataset',
packages=find_packages(include=['napari_split_dataset', 'napari_split_dataset.*']),
keywords="napari_split_dataset",
name="napari_split_dataset",
packages=find_packages(include=["napari_split_dataset", "napari_split_dataset.*"]),
setup_requires=setup_requirements,
test_suite='tests',
test_suite="tests",
tests_require=test_requirements,
url='https://github.com/portugueslab/napari_split_dataset',
version='0.1.0',
url="https://github.com/portugueslab/napari_split_dataset",
version="0.1.0",
zip_safe=False,
)
2 changes: 2 additions & 0 deletions tests/test_napari_split_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from numpy import ndarray
from dask.array.core import Array


@pytest.mark.parametrize(
"path",
[
Expand All @@ -26,6 +27,7 @@ def test_reader(path):
reader = _reader.napari_get_reader(path)
assert callable(reader)


@pytest.mark.parametrize(
"path",
[
Expand Down

0 comments on commit a353cf8

Please sign in to comment.