Browse Source

Bump version to 2.1.0, updated documentation, removed skips from some unit tests

zolfa-add_slices_loading
Jim Rybarski 9 years ago
parent
commit
13139518b3
6 changed files with 22 additions and 11 deletions
  1. +4
    -0
      CHANGELOG.md
  2. +12
    -4
      README.md
  3. +3
    -0
      functional_tests/FYLM141111001.py
  4. +1
    -5
      functional_tests/monocycle.py
  5. +1
    -1
      nd2reader/__init__.py
  6. +1
    -1
      setup.py

+ 4
- 0
CHANGELOG.md View File

@ -1,3 +1,7 @@
## [2.1.0] - 2016-01-16
### ADDED
- `select` now supports `start` and `stop` keyword arguments to put bounds on images
## [2.0.2] - 2016-01-06
### ADDED
- `Nd2.pixel_microns` gives the width of a pixel


+ 12
- 4
README.md View File

@ -70,10 +70,16 @@ array([[1894, 1949, 1941, ..., 2104, 2135, 2114],
If you only want to view images that meet certain criteria, you can use `select()`. It's much faster than iterating
and checking attributes of images manually. You can specify scalars or lists of values. Criteria that aren't specified
default to every possible value. Currently, slicing and selecting can't be done at the same time:
default to every possible value. Currently, slicing and selecting can't be done at the same time, but you can
set a range with the `start` and `stop` arguments:
```python
for image in nd2.select(channels="GFP", fields_of_view=(1, 2, 7)):
# gets all GFP images in fields of view 1, 2 and 7, regardless of z-level or frame
do_something(image)
for image in nd2.select(z_levels=(0, 1), start=12, stop=3000):
# gets images of any channel or field of view, with z-level 0 or 1, between images 12 and 3000
do_something(image)
```
@ -102,12 +108,14 @@ my_important_image = nd2[17]
The `Nd2` object has some programmatically-accessible metadata:
```python
>>> nd2.height
>>> nd2.height # in pixels
1280
>>> nd2.width
>>> nd2.width # in pixels
800
>>> len(nd2)
>>> len(nd2) # the number of images
30528
>>> nd2.pixel_microns # the width of a pixel in microns
0.22
```
Each camera has its own settings. If you image multiple wavelengths with one camera, each channel will appear as its


+ 3
- 0
functional_tests/FYLM141111001.py View File

@ -213,3 +213,6 @@ class FYLM141111Tests(unittest.TestCase):
direct_duration = time.time() - direct_start
self.assertEqual(select_count, direct_count)
self.assertGreater(direct_duration, select_duration)
def test_pixel_microns(self):
self.assertEqual(round(self.nd2.pixel_microns, 2), 0.22)

+ 1
- 5
functional_tests/monocycle.py View File

@ -81,11 +81,9 @@ class Monocycle2Tests(unittest.TestCase):
def tearDown(self):
self.nd2.close()
@unittest.skip('missing file')
def test_pixel_size(self):
self.assertGreater(self.nd2.pixel_microns, 0.0)
self.assertGreater(round(self.nd2.pixel_microns, 2), 0.26)
@unittest.skip('missing file')
def test_select(self):
manual_images = []
for _, image in zip(range(20), self.nd2):
@ -106,7 +104,6 @@ class Monocycle2Tests(unittest.TestCase):
self.assertEqual(a.field_of_view, b.field_of_view)
self.assertEqual(a.channel, b.channel)
@unittest.skip('missing file')
def test_select_order_all(self):
# If we select every possible image using select(), we should just get every image in order
n = 0
@ -125,7 +122,6 @@ class Monocycle2Tests(unittest.TestCase):
# If there's a problem, we'll have seen it by now.
break
@unittest.skip('missing file')
def test_select_order_subset(self):
# Test that images are always yielded in increasing order. This guarantees that no matter what subset of images
# we're filtering, we still get them in the chronological order they were acquired


+ 1
- 1
nd2reader/__init__.py View File

@ -1,3 +1,3 @@
from nd2reader.main import Nd2
__version__ = '2.0.2'
__version__ = '2.1.0'

+ 1
- 1
setup.py View File

@ -1,6 +1,6 @@
from setuptools import setup
VERSION = '2.0.2'
VERSION = '2.1.0'
if __name__ == '__main__':
setup(


Loading…
Cancel
Save