Browse Source

resolves #101: No longer assumes a date will always be present in the metadata and falls back by displayed "Unknown" in the Nd2 repr

feature/load_slices
jim 9 years ago
parent
commit
c3a3cbadd4
4 changed files with 5 additions and 5 deletions
  1. +1
    -1
      Makefile
  2. +1
    -1
      nd2reader/interface.py
  3. +1
    -1
      nd2reader/model/metadata.py
  4. +2
    -2
      nd2reader/parser/v3.py

+ 1
- 1
Makefile View File

@ -26,7 +26,7 @@ test: build
docker run --rm -it jimrybarski/nd2reader python3.4 /opt/nd2reader/tests.py
docker run --rm -it jimrybarski/nd2reader python2.7 /opt/nd2reader/tests.py
functest: build
ftest: build
docker run --rm -v ~/nd2s:/var/nd2s -it jimrybarski/nd2reader python3.4 /opt/nd2reader/ftests.py
docker run --rm -v ~/nd2s:/var/nd2s -it jimrybarski/nd2reader python2.7 /opt/nd2reader/ftests.py

+ 1
- 1
nd2reader/interface.py View File

@ -28,7 +28,7 @@ class Nd2(object):
def __repr__(self):
return "\n".join(["<ND2 %s>" % self._filename,
"Created: %s" % self.date,
"Created: %s" % self.date if self.date is not None else "Unknown",
"Image size: %sx%s (HxW)" % (self.height, self.width),
"Frames: %s" % len(self.frames),
"Channels: %s" % ", ".join(["'%s'" % str(channel) for channel in self.channels]),


+ 1
- 1
nd2reader/model/metadata.py View File

@ -35,7 +35,7 @@ class Metadata(object):
"""
The date and time when acquisition began.
:rtype: datetime.datetime()
:rtype: datetime.datetime() or None
"""
return self._date


+ 2
- 2
nd2reader/parser/v3.py View File

@ -59,7 +59,7 @@ class V3Parser(BaseParser):
"""
The date and time when acquisition began.
:rtype: datetime.datetime()
:rtype: datetime.datetime() or None
"""
for line in metadata_dict[six.b('ImageTextInfo')][six.b('SLxImageTextInfo')].values():
@ -78,7 +78,7 @@ class V3Parser(BaseParser):
if not absolute_start_12 and not absolute_start_24:
continue
return absolute_start_12 if absolute_start_12 else absolute_start_24
raise ValueError("This ND2 has no recorded start time. This is probably a bug.")
return None
def _parse_channels(self, metadata_dict):
"""


Loading…
Cancel
Save