|
40 | 40 | import six |
41 | 41 | import itertools |
42 | 42 | import logging |
43 | | -from pkg_resources import parse_version |
| 43 | +from packaging.version import Version |
44 | 44 |
|
45 | 45 | import h5py |
46 | 46 | import pandas as pd |
@@ -145,9 +145,9 @@ def __init__(self, nwb_file): |
145 | 145 | meta = self.get_metadata() |
146 | 146 | if meta and 'pipeline_version' in meta: |
147 | 147 | pipeline_version_str = meta['pipeline_version'] |
148 | | - self.pipeline_version = parse_version(pipeline_version_str) |
| 148 | + self.pipeline_version = Version(pipeline_version_str) |
149 | 149 |
|
150 | | - if self.pipeline_version > parse_version(self.SUPPORTED_PIPELINE_VERSION): |
| 150 | + if self.pipeline_version > Version(self.SUPPORTED_PIPELINE_VERSION): |
151 | 151 | logging.warning("File %s has a pipeline version newer than the version supported by this class (%s vs %s)." |
152 | 152 | " Please update your AllenSDK." % (nwb_file, pipeline_version_str, self.SUPPORTED_PIPELINE_VERSION)) |
153 | 153 |
|
@@ -289,7 +289,7 @@ def get_neuropil_traces(self, cell_specimen_ids=None): |
289 | 289 | timestamps = self.get_fluorescence_timestamps() |
290 | 290 |
|
291 | 291 | with h5py.File(self.nwb_file, 'r') as f: |
292 | | - if self.pipeline_version >= parse_version("2.0"): |
| 292 | + if self.pipeline_version >= Version("2.0"): |
293 | 293 | ds = f['processing'][self.PIPELINE_DATASET][ |
294 | 294 | 'Fluorescence']['imaging_plane_1_neuropil_response']['data'] |
295 | 295 | else: |
@@ -321,7 +321,7 @@ def get_neuropil_r(self, cell_specimen_ids=None): |
321 | 321 | ''' |
322 | 322 |
|
323 | 323 | with h5py.File(self.nwb_file, 'r') as f: |
324 | | - if self.pipeline_version >= parse_version("2.0"): |
| 324 | + if self.pipeline_version >= Version("2.0"): |
325 | 325 | r_ds = f['processing'][self.PIPELINE_DATASET][ |
326 | 326 | 'Fluorescence']['imaging_plane_1_neuropil_response']['r'] |
327 | 327 | else: |
@@ -388,7 +388,7 @@ def get_corrected_fluorescence_traces(self, cell_specimen_ids=None): |
388 | 388 | ''' |
389 | 389 |
|
390 | 390 | # starting in version 2.0, neuropil correction follows trace demixing |
391 | | - if self.pipeline_version >= parse_version("2.0"): |
| 391 | + if self.pipeline_version >= Version("2.0"): |
392 | 392 | timestamps, cell_traces = self.get_demixed_traces(cell_specimen_ids) |
393 | 393 | else: |
394 | 394 | timestamps, cell_traces = self.get_fluorescence_traces(cell_specimen_ids) |
|
0 commit comments