Skip to content
Snippets Groups Projects
Commit 13139518 authored by Jim Rybarski's avatar Jim Rybarski
Browse files

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

parent 348cc649
No related branches found
No related tags found
No related merge requests found
## [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
......
......@@ -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
......
......@@ -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)
......@@ -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
......
from nd2reader.main import Nd2
__version__ = '2.0.2'
__version__ = '2.1.0'
from setuptools import setup
VERSION = '2.0.2'
VERSION = '2.1.0'
if __name__ == '__main__':
setup(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment