Repository: catalystneuro/roiextractors (language: python)

Issue:
flake8
@Saksham20 can you look into these flake8 flags?

```
./docs/source/conf.py:65:31: W292 no newline at end of file
./tests/test_conversions.py:31:9: F841 local variable 'resp' is assigned to but never used
./tests/test_conversions.py:77:9: F841 local variable 'seg_ex_rt' is assigned to but never used
./tests/test_conversions.py:116:9: F841 local variable 'img_ex_rt' is assigned to but never used
./roiextractors/__init__.py:1:1: F401 '.example_datasets' imported but unused
./roiextractors/__init__.py:2:1: F401 '.extraction_tools.show_video' imported but unused
./roiextractors/__init__.py:3:1: F403 'from .extractorlist import *' used; unable to detect undefined names
./roiextractors/__init__.py:3:1: F401 '.extractorlist.*' imported but unused
./roiextractors/__init__.py:4:1: F401 '.imagingextractor.ImagingExtractor' imported but unused
./roiextractors/__init__.py:5:1: F401 '.memmapextractors.MemmapImagingExtractor' imported but unused
./roiextractors/__init__.py:6:1: F401 '.segmentationextractor.SegmentationExtractor' imported but unused
./roiextractors/__init__.py:7:1: F401 '.version.version as __version__' imported but unused
./roiextractors/testing.py:138:1: E302 expected 2 blank lines, found 1
./roiextractors/testing.py:155:62: E231 missing whitespace after ','
./roiextractors/testing.py:158:67: W292 no newline at end of file
./roiextractors/segmentationextractor.py:2:1: F401 'copy.deepcopy' imported but unused
./roiextractors/extractorlist.py:32:29: E128 continuation line under-indented for visual indent
./roiextractors/extractorlist.py:35:29: E127 continuation line over-indented for visual indent
./roiextractors/extractorlist.py:35:57: W292 no newline at end of file
./roiextractors/extraction_tools.py:8:1: F401 'os.path.abspath' imported but unused
./roiextractors/extraction_tools.py:8:1: F401 'os.path.relpath' imported but unused
./roiextractors/extraction_tools.py:70:1: W293 blank line contains whitespace
./roiextractors/extraction_tools.py:77:1: W293 blank line contains whitespace
./roiextractors/extraction_tools.py:147:1: C901 'write_to_h5_dataset_format' is too complex (15)
./roiextractors/extraction_tools.py:216:26: E228 missing whitespace around modulo operator
./roiextractors/extraction_tools.py:283:1: W391 blank line at end of file
./roiextractors/extractors/caiman/caimansegmentationextractor.py:109:74: E127 continuation line over-indented for visual indent
./roiextractors/extractors/caiman/__init__.py:1:1: F403 'from .caimansegmentationextractor import *' used; unable to detect undefined names
./roiextractors/extractors/caiman/__init__.py:1:1: F401 '.caimansegmentationextractor.*' imported but unused
./roiextractors/extractors/caiman/__init__.py:1:43: W292 no newline at end of file
./roiextractors/extractors/simaextractor/__init__.py:1:1: F401 '.simasegmentationextractor.SimaSegmentationExtractor' imported but unused
./roiextractors/extractors/simaextractor/__init__.py:1:65: W292 no newline at end of file
./roiextractors/extractors/simaextractor/simasegmentationextractor.py:15:1: E722 do not use bare 'except'
./roiextractors/extractors/simaextractor/simasegmentationextractor.py:29:128: E501 line too long (138 > 127 characters)
./roiextractors/extractors/tiffimagingextractor/tiffimagingextractor.py:13:1: E722 do not use bare 'except'
./roiextractors/extractors/tiffimagingextractor/tiffimagingextractor.py:22:128: E501 line too long (141 > 127 characters)
./roiextractors/extractors/tiffimagingextractor/__init__.py:1:1: F401 '.tiffimagingextractor.TiffImagingExtractor' imported but unused
./roiextractors/extractors/nwbextractors/nwbextractors.py:294:13: F841 local variable 'acquisition_name' is assigned to but never used
./roiextractors/extractors/nwbextractors/nwbextractors.py:466:5: C901 'NwbSegmentationExtractor.__init__' is too complex (20)
./roiextractors/extractors/nwbextractors/nwbextractors.py:513:128: E501 line too long (138 > 127 characters)
./roiextractors/extractors/nwbextractors/nwbextractors.py:615:5: C901 'NwbSegmentationExtractor.write_segmentation' is too complex (29)
./roiextractors/extractors/nwbextractors/nwbextractors.py:674:128: E501 line too long (130 > 127 characters)
./roiextractors/extractors/nwbextractors/nwbextractors.py:713:17: F841 local variable 'num_rois' is assigned to but never used
./roiextractors/extractors/nwbextractors/nwbextractors.py:740:128: E501 line too long (133 > 127 characters)
./roiextractors/extractors/nwbextractors/nwbextractors.py:743:128: E501 line too long (132 > 127 characters)
./roiextractors/extractors/nwbextractors/__init__.py:1:1: F401 '.nwbextractors.NwbImagingExtractor' imported but unused
./roiextractors/extractors/nwbextractors/__init__.py:1:1: F401 '.nwbextractors.NwbSegmentationExtractor' imported but unused
./roiextractors/extractors/hdf5imagingextractor/__init__.py:1:1: F401 '.hdf5imagingextractor.Hdf5ImagingExtractor' imported but unused
./roiextractors/extractors/schnitzerextractor/extractsegmentationextractor.py:102:43: E231 missing whitespace after ','
./roiextractors/extractors/schnitzerextractor/extractsegmentationextractor.py:110:63: E127 continuation line over-indented for visual indent
./roiextractors/extractors/schnitzerextractor/__init__.py:1:1: F401 '.cnmfesegmentationextractor.CnmfeSegmentationExtractor' imported but unused
./roiextractors/extractors/schnitzerextractor/__init__.py:2:1: F401 '.extractsegmentationextractor.ExtractSegmentationExtractor' imported but unused
./roiextractors/extractors/schnitzerextractor/cnmfesegmentationextractor.py:77:5: C901 'CnmfeSegmentationExtractor.write_segmentation' is too complex (11)
./roiextractors/extractors/schnitzerextractor/cnmfesegmentationextractor.py:77:47: E231 missing whitespace after ':'
./roiextractors/extractors/schnitzerextractor/cnmfesegmentationextractor.py:105:113: E225 missing whitespace around operator
./roiextractors/extractors/schnitzerextractor/cnmfesegmentationextractor.py:106:63: E127 continuation line over-indented for visual indent
./roiextractors/extractors/schnitzerextractor/cnmfesegmentationextractor.py:107:43: E231 missing whitespace after ','
./roiextractors/extractors/schnitzerextractor/cnmfesegmentationextractor.py:108:128: E501 line too long (128 > 127 characters)
./roiextractors/extractors/suite2p/__init__.py:1:1: F403 'from .suite2psegmentationextractor import *' used; unable to detect undefined names
./roiextractors/extractors/suite2p/__init__.py:1:1: F401 '.suite2psegmentationextractor.*' imported but unused
./roiextractors/extractors/suite2p/__init__.py:1:44: W292 no newline at end of file
./roiextractors/extractors/suite2p/suite2psegmentationextractor.py:44:64: E231 missing whitespace after ','
./roiextractors/extractors/suite2p/suite2psegmentationextractor.py:64:17: E128 continuation line under-indented for visual indent
./roiextractors/extractors/suite2p/suite2psegmentationextractor.py:74:5: C901 'Suite2pSegmentationExtractor.write_segmentation' is too complex (12)
./roiextractors/extractors/sbximagingextractor/sbximagingextractor.py:3:1: F401 '...extraction_tools.FloatType' imported but unused
./roiextractors/extractors/sbximagingextractor/sbximagingextractor.py:44:36: E231 missing whitespace after ','
./roiextractors/extractors/sbximagingextractor/sbximagingextractor.py:94:66: E225 missing whitespace around operator
./roiextractors/extractors/sbximagingextractor/sbximagingextractor.py:95:28: E127 continuation line over-indented for visual indent
./roiextractors/extractors/sbximagingextractor/sbximagingextractor.py:147:1: W391 blank line at end of file
./roiextractors/extractors/sbximagingextractor/__init__.py:1:1: F401 '.sbximagingextractor.SbxImagingExtractor' imported but unused
./roiextractors/extractors/sbximagingextractor/__init__.py:1:53: W292 no newline at end of file
./roiextractors/extractors/numpyextractors/__init__.py:1:1: F401 '.numpyextractors.NumpyImagingExtractor' imported but unused
./roiextractors/extractors/numpyextractors/__init__.py:1:1: F401 '.numpyextractors.NumpySegmentationExtractor' imported but unused
./roiextractors/extractors/numpyextractors/numpyextractors.py:112:5: C901 'NumpySegmentationExtractor.__init__' is too complex (13)
./roiextractors/example_datasets/toy_example.py:11:1: C901 '_generate_rois' is too complex (11)
./roiextractors/example_datasets/__init__.py:1:1: F401 '.toy_example.toy_example' imported but unused
./roiextractors/example_datasets/__init__.py:1:37: W292 no newline at end of file
7     C901 '_generate_rois' is too complex (11)
5     E127 continuation line over-indented for visual indent
2     E128 continuation line under-indented for visual indent
2     E225 missing whitespace around operator
1     E228 missing whitespace around modulo operator
6     E231 missing whitespace after ','
1     E302 expected 2 blank lines, found 1
7     E501 line too long (138 > 127 characters)
2     E722 do not use bare 'except'
24    F401 '.example_datasets' imported but unused
3     F403 'from .extractorlist import *' used; unable to detect undefined names
5     F841 local variable 'acquisition_name' is assigned to but never used
8     W292 no newline at end of file
2     W293 blank line contains whitespace
2     W391 blank line at end of file
```


Discussion / hints:
we should consider using Black

Fix patch:
diff --git a/docs/source/conf.py b/docs/source/conf.py
index a0411f6f..36119d95 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -12,17 +12,18 @@
 #
 import os
 import sys
-sys.path.insert(0, os.path.abspath('.'))
+
+sys.path.insert(0, os.path.abspath("."))
 
 
 # -- Project information -----------------------------------------------------
 
-project = 'RoiExtractors'
-copyright = '2021, Saksham Sharda'
-author = 'Saksham Sharda'
+project = "RoiExtractors"
+copyright = "2021, Saksham Sharda"
+author = "Saksham Sharda"
 
 # The full version, including alpha/beta/rc tags
-release = '0.2.1'
+release = "0.2.1"
 
 
 # -- General configuration ---------------------------------------------------
@@ -30,11 +31,10 @@
 # Add any Sphinx extension module names here, as strings. They can be
 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
 # ones.
-extensions = [
-]
+extensions = []
 
 # Add any paths that contain templates here, relative to this directory.
-templates_path = ['_templates']
+templates_path = ["_templates"]
 
 # List of patterns, relative to source directory, that match files and
 # directories to ignore when looking for source files.
@@ -57,9 +57,9 @@
     html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
 except ImportError:
     print("RTD theme not installed, using default")
-    html_theme = 'alabaster'
+    html_theme = "alabaster"
 
 # Add any paths that contain custom static files (such as style sheets) here,
 # relative to this directory. They are copied after the builtin static files,
 # so a file named "default.css" will overwrite the builtin "default.css".
-html_static_path = ['_static']
\ No newline at end of file
+html_static_path = ["_static"]
diff --git a/roiextractors/example_datasets/__init__.py b/roiextractors/example_datasets/__init__.py
index f500d653..135ecd47 100644
--- a/roiextractors/example_datasets/__init__.py
+++ b/roiextractors/example_datasets/__init__.py
@@ -1,1 +1,1 @@
-from .toy_example import toy_example
\ No newline at end of file
+from .toy_example import toy_example
diff --git a/roiextractors/example_datasets/toy_example.py b/roiextractors/example_datasets/toy_example.py
index a536b483..2f086afb 100644
--- a/roiextractors/example_datasets/toy_example.py
+++ b/roiextractors/example_datasets/toy_example.py
@@ -1,14 +1,19 @@
 import numpy as np
 import spikeextractors as se
 
-from ..extractors.numpyextractors import NumpyImagingExtractor, NumpySegmentationExtractor
+from ..extractors.numpyextractors import (
+    NumpyImagingExtractor,
+    NumpySegmentationExtractor,
+)
 
 
 def _gaussian(x, mu, sigma):
-    return 1 / np.sqrt(2 * np.pi * sigma) * np.exp(- (x - mu) ** 2 / sigma)
+    return 1 / np.sqrt(2 * np.pi * sigma) * np.exp(-((x - mu) ** 2) / sigma)
 
 
-def _generate_rois(num_units=10, size_x=100, size_y=100, roi_size=4, min_dist=5, mode='uniform'):
+def _generate_rois(
+    num_units=10, size_x=100, size_y=100, roi_size=4, min_dist=5, mode="uniform"
+):
     image = np.zeros((size_x, size_y))
     max_iter = 1000
 
@@ -48,10 +53,12 @@ def _generate_rois(num_units=10, size_x=100, size_y=100, roi_size=4, min_dist=5,
 
                 if np.linalg.norm(p - mean) < roi_size:
                     pixels.append(p)
-                    if mode == 'uniform':
+                    if mode == "uniform":
                         image[i, j] = 1
-                    elif mode == 'gaussian':
-                        image[i, j] = _gaussian(i, mean[0], roi_size) + _gaussian(j, mean[1], roi_size)
+                    elif mode == "gaussian":
+                        image[i, j] = _gaussian(i, mean[0], roi_size) + _gaussian(
+                            j, mean[1], roi_size
+                        )
                     else:
                         raise Exception("'mode' can be 'uniform' or 'gaussian'")
         roi_pixels.append(np.array(pixels))
@@ -59,8 +66,18 @@ def _generate_rois(num_units=10, size_x=100, size_y=100, roi_size=4, min_dist=5,
     return roi_pixels, image, means
 
 
-def toy_example(duration=10, num_rois=10, size_x=100, size_y=100, roi_size=4, min_dist=5, mode='uniform',
-                sampling_frequency=30, decay_time=0.5, noise_std=0.05):
+def toy_example(
+    duration=10,
+    num_rois=10,
+    size_x=100,
+    size_y=100,
+    roi_size=4,
+    min_dist=5,
+    mode="uniform",
+    sampling_frequency=30,
+    decay_time=0.5,
+    noise_std=0.05,
+):
     """
     Create a toy example of an ImagingExtractor and a SegmentationExtractor.
 
@@ -99,12 +116,22 @@ def toy_example(duration=10, num_rois=10, size_x=100, size_y=100, roi_size=4, mi
     """
     # generate ROIs
     num_rois = int(num_rois)
-    roi_pixels, im, means = _generate_rois(num_units=num_rois, size_x=size_x, size_y=size_y,
-                                           roi_size=roi_size, min_dist=min_dist, mode=mode)
+    roi_pixels, im, means = _generate_rois(
+        num_units=num_rois,
+        size_x=size_x,
+        size_y=size_y,
+        roi_size=roi_size,
+        min_dist=min_dist,
+        mode=mode,
+    )
 
     # generate spike trains
-    rec, sort = se.example_datasets.toy_example(duration=duration, K=num_rois, num_channels=1,
-                                                sampling_frequency=sampling_frequency)
+    rec, sort = se.example_datasets.toy_example(
+        duration=duration,
+        K=num_rois,
+        num_channels=1,
+        sampling_frequency=sampling_frequency,
+    )
 
     # create decaying response
     resp_samples = int(decay_time * rec.get_sampling_frequency())
@@ -115,15 +142,17 @@ def toy_example(duration=10, num_rois=10, size_x=100, size_y=100, roi_size=4, mi
     # convolve response with ROIs
     raw = np.zeros((len(sort.get_unit_ids()), rec.get_num_frames()))
     deconvolved = np.zeros((len(sort.get_unit_ids()), rec.get_num_frames()))
-    neuropil = noise_std * np.random.randn(len(sort.get_unit_ids()), rec.get_num_frames())
+    neuropil = noise_std * np.random.randn(
+        len(sort.get_unit_ids()), rec.get_num_frames()
+    )
     frames = rec.get_num_frames()
     for u_i, unit in enumerate(sort.get_unit_ids()):
         for s in sort.get_unit_spike_train(unit):
             if s < rec.get_num_frames():
                 if s + len(resp) < frames:
-                    raw[u_i, s:s + len(resp)] += resp
+                    raw[u_i, s: s + len(resp)] += resp
                 else:
-                    raw[u_i, s:] = resp[:frames - s]
+                    raw[u_i, s:] = resp[: frames - s]
                 deconvolved[u_i, s] = 1
 
     # generate video
@@ -147,7 +176,12 @@ def toy_example(duration=10, num_rois=10, size_x=100, size_y=100, roi_size=4, mi
         for r in roi:
             image_masks[r[0], r[1], rois_i] += im[r[0], r[1]]
 
-    seg = NumpySegmentationExtractor(image_masks=image_masks, raw=raw, deconvolved=deconvolved,
-                                     neuropil=neuropil, sampling_frequency=sampling_frequency)
+    seg = NumpySegmentationExtractor(
+        image_masks=image_masks,
+        raw=raw,
+        deconvolved=deconvolved,
+        neuropil=neuropil,
+        sampling_frequency=sampling_frequency,
+    )
 
     return imag, seg
diff --git a/roiextractors/extraction_tools.py b/roiextractors/extraction_tools.py
index 863a9baa..13ef02bd 100644
--- a/roiextractors/extraction_tools.py
+++ b/roiextractors/extraction_tools.py
@@ -5,7 +5,6 @@
 import numpy as np
 from spikeextractors.extraction_tools import cast_start_end_frame
 from tqdm import tqdm
-from os.path import abspath, relpath
 
 try:
     import h5py
@@ -36,7 +35,9 @@ def dict_recursive_update(base, input_):
         elif key in base and isinstance(val, list) and isinstance(base[key], list):
             for i, input_list_item in enumerate(val):
                 if len(base[key]) < i:
-                    if isinstance(base[key][i], dict) and isinstance(input_list_item, dict):
+                    if isinstance(base[key][i], dict) and isinstance(
+                        input_list_item, dict
+                    ):
                         dict_recursive_update(base[key][i], input_list_item)
                     else:
                         base[key][i] = input_list_item
@@ -67,14 +68,14 @@ def _pixel_mask_extractor(image_mask_, _roi_ids):
 def _image_mask_extractor(pixel_mask, _roi_ids, image_shape):
     """
     Converts a pixel mask to image mask
-    
+
     Parameters
     ----------
     pixel_mask: list
         list of pixel masks (no pixels X 3)
     _roi_ids: list
     image_shape: array_like
-    
+
     Returns
     -------
     image_mask: np.ndarray
@@ -105,7 +106,9 @@ def corrected_args(imaging, frame_idxs, channel=0):
             frame_idxs = [frame_idxs]
         if not isinstance(frame_idxs, slice):
             frame_idxs = np.array(frame_idxs)
-            assert np.all(frame_idxs < imaging.get_num_frames()), "'frame_idxs' exceed number of frames"
+            assert np.all(
+                frame_idxs < imaging.get_num_frames()
+            ), "'frame_idxs' exceed number of frames"
         get_frames_correct_arg = func(imaging, frame_idxs, channel)
 
         if len(frame_idxs) == 1:
@@ -121,31 +124,47 @@ def check_get_videos_args(func):
     def corrected_args(imaging, start_frame=None, end_frame=None, channel=0):
         if start_frame is not None:
             if start_frame > imaging.get_num_frames():
-                raise Exception(f"'start_frame' exceeds number of frames {imaging.get_num_frames()}!")
+                raise Exception(
+                    f"'start_frame' exceeds number of frames {imaging.get_num_frames()}!"
+                )
             elif start_frame < 0:
                 start_frame = imaging.get_num_frames() + start_frame
         else:
             start_frame = 0
         if end_frame is not None:
             if end_frame > imaging.get_num_frames():
-                raise Exception(f"'end_frame' exceeds number of frames {imaging.get_num_frames()}!")
+                raise Exception(
+                    f"'end_frame' exceeds number of frames {imaging.get_num_frames()}!"
+                )
             elif end_frame < 0:
                 end_frame = imaging.get_num_frames() + end_frame
         else:
             end_frame = imaging.get_num_frames()
-        assert end_frame - start_frame > 0, "'start_frame' must be less than 'end_frame'!"
+        assert (
+            end_frame - start_frame > 0
+        ), "'start_frame' must be less than 'end_frame'!"
 
         start_frame, end_frame = cast_start_end_frame(start_frame, end_frame)
         channel = int(channel)
-        get_videos_correct_arg = func(imaging, start_frame=start_frame, end_frame=end_frame, channel=channel)
+        get_videos_correct_arg = func(
+            imaging, start_frame=start_frame, end_frame=end_frame, channel=channel
+        )
 
         return get_videos_correct_arg
 
     return corrected_args
 
 
-def write_to_h5_dataset_format(imaging, dataset_path, save_path=None, file_handle=None,
-                               dtype=None, chunk_size=None, chunk_mb=1000, verbose=False):
+def write_to_h5_dataset_format(
+    imaging,
+    dataset_path,
+    save_path=None,
+    file_handle=None,
+    dtype=None,
+    chunk_size=None,
+    chunk_mb=1000,
+    verbose=False,
+):
     """Saves the video of an imaging extractor in an h5 dataset.
 
     Parameters
@@ -170,13 +189,15 @@ def write_to_h5_dataset_format(imaging, dataset_path, save_path=None, file_handl
         If True, output is verbose (when chunks are used)
     """
     assert HAVE_H5, "To write to h5 you need to install h5py: pip install h5py"
-    assert save_path is not None or file_handle is not None, "Provide 'save_path' or 'file handle'"
+    assert (
+        save_path is not None or file_handle is not None
+    ), "Provide 'save_path' or 'file handle'"
 
     if save_path is not None:
         save_path = Path(save_path)
-        if save_path.suffix == '':
+        if save_path.suffix == "":
             # when suffix is already raw/bin/dat do not change it.
-            save_path = save_path.parent/(save_path.name + '.h5')
+            save_path = save_path.parent / (save_path.name + ".h5")
 
     num_channels = imaging.get_num_channels()
     num_frames = imaging.get_num_frames()
@@ -185,22 +206,24 @@ def write_to_h5_dataset_format(imaging, dataset_path, save_path=None, file_handl
     if file_handle is not None:
         assert isinstance(file_handle, h5py.File)
     else:
-        file_handle = h5py.File(save_path, 'w')
+        file_handle = h5py.File(save_path, "w")
 
     if dtype is None:
         dtype_file = imaging.get_dtype()
     else:
         dtype_file = dtype
 
-    dset = file_handle.create_dataset(dataset_path, shape=(num_channels, num_frames, size_x, size_y), dtype=dtype_file)
+    dset = file_handle.create_dataset(
+        dataset_path, shape=(num_channels, num_frames, size_x, size_y), dtype=dtype_file
+    )
 
     # set chunk size
     if chunk_size is not None:
         chunk_size = int(chunk_size)
     elif chunk_mb is not None:
         n_bytes = np.dtype(imaging.get_dtype()).itemsize
-        max_size = int(chunk_mb*1e6)  # set Mb per chunk
-        chunk_size = max_size//(size_x*size_y*n_bytes)
+        max_size = int(chunk_mb * 1e6)  # set Mb per chunk
+        chunk_size = max_size // (size_x * size_y * n_bytes)
 
     # writ one channel at a time
     for ch in range(num_channels):
@@ -212,20 +235,25 @@ def write_to_h5_dataset_format(imaging, dataset_path, save_path=None, file_handl
         else:
             chunk_start = 0
             # chunk size is not None
-            n_chunk = num_frames//chunk_size
-            if num_frames%chunk_size > 0:
+            n_chunk = num_frames // chunk_size
+            if num_frames % chunk_size > 0:
                 n_chunk += 1
             if verbose:
                 chunks = tqdm(range(n_chunk), ascii=True, desc="Writing to .h5 file")
             else:
                 chunks = range(n_chunk)
             for i in chunks:
-                video = imaging.get_video(start_frame=i*chunk_size,
-                                          end_frame=min((i + 1)*chunk_size, num_frames), channel=ch)
+                video = imaging.get_video(
+                    start_frame=i * chunk_size,
+                    end_frame=min((i + 1) * chunk_size, num_frames),
+                    channel=ch,
+                )
                 chunk_frames = np.squeeze(video).shape[0]
                 if dtype is not None:
                     video = video.astype(dtype_file)
-                dset[ch, chunk_start:chunk_start + chunk_frames, ...] = np.squeeze(video)
+                dset[ch, chunk_start: chunk_start + chunk_frames, ...] = np.squeeze(
+                    video
+                )
                 chunk_start += chunk_frames
 
     if save_path is not None:
@@ -248,10 +276,16 @@ def animate_func(i, imaging, im, ax):
         ax = fig.add_subplot(111)
 
     im0 = imaging.get_frames(0)
-    im = ax.imshow(im0, interpolation='none', aspect='auto', vmin=0, vmax=1)
-    interval = 1/imaging.get_sampling_frequency()*1000
-    anim = animation.FuncAnimation(fig, animate_func, frames=imaging.get_num_frames(), fargs=(imaging, im, ax),
-                                   interval=interval, blit=False)
+    im = ax.imshow(im0, interpolation="none", aspect="auto", vmin=0, vmax=1)
+    interval = 1 / imaging.get_sampling_frequency() * 1000
+    anim = animation.FuncAnimation(
+        fig,
+        animate_func,
+        frames=imaging.get_num_frames(),
+        fargs=(imaging, im, ax),
+        interval=interval,
+        blit=False,
+    )
     return anim
 
 
@@ -279,5 +313,3 @@ def todict(matobj):
         else:
             dict[strg] = elem
     return dict
-
-
diff --git a/roiextractors/extractorlist.py b/roiextractors/extractorlist.py
index 9cc22b78..6ce23bce 100644
--- a/roiextractors/extractorlist.py
+++ b/roiextractors/extractorlist.py
@@ -1,8 +1,14 @@
 from .extractors.caiman import CaimanSegmentationExtractor
 from .extractors.hdf5imagingextractor import Hdf5ImagingExtractor
-from .extractors.numpyextractors import NumpyImagingExtractor, NumpySegmentationExtractor
+from .extractors.numpyextractors import (
+    NumpyImagingExtractor,
+    NumpySegmentationExtractor,
+)
 from .extractors.nwbextractors import NwbImagingExtractor, NwbSegmentationExtractor
-from .extractors.schnitzerextractor import CnmfeSegmentationExtractor, ExtractSegmentationExtractor
+from .extractors.schnitzerextractor import (
+    CnmfeSegmentationExtractor,
+    ExtractSegmentationExtractor,
+)
 from .extractors.simaextractor import SimaSegmentationExtractor
 from .extractors.suite2p import Suite2pSegmentationExtractor
 from .extractors.tiffimagingextractor import TiffImagingExtractor
@@ -17,7 +23,7 @@
     ExtractSegmentationExtractor,
     SimaSegmentationExtractor,
     MultiSegmentationExtractor,
-    CaimanSegmentationExtractor
+    CaimanSegmentationExtractor,
 ]
 
 imaging_extractor_full_list = [
@@ -25,11 +31,15 @@
     Hdf5ImagingExtractor,
     TiffImagingExtractor,
     NwbImagingExtractor,
-    SbxImagingExtractor
+    SbxImagingExtractor,
 ]
 
-segmentation_extractor_dict = {segmentation_class.extractor_name: segmentation_class for segmentation_class in
-                            segmentation_extractor_full_list}
+segmentation_extractor_dict = {
+    segmentation_class.extractor_name: segmentation_class
+    for segmentation_class in segmentation_extractor_full_list
+}
 
-imaging_extractor_dict = {imaging_class.extractor_name: imaging_class for imaging_class in
-                            imaging_extractor_full_list}
\ No newline at end of file
+imaging_extractor_dict = {
+    imaging_class.extractor_name: imaging_class
+    for imaging_class in imaging_extractor_full_list
+}
diff --git a/roiextractors/extractors/caiman/__init__.py b/roiextractors/extractors/caiman/__init__.py
index 211acc5b..3f7fd8d9 100644
--- a/roiextractors/extractors/caiman/__init__.py
+++ b/roiextractors/extractors/caiman/__init__.py
@@ -1,1 +1,1 @@
-from .caimansegmentationextractor import *
\ No newline at end of file
+from .caimansegmentationextractor import CaimanSegmentationExtractor
diff --git a/roiextractors/extractors/caiman/caimansegmentationextractor.py b/roiextractors/extractors/caiman/caimansegmentationextractor.py
index bfdf9a99..a3704396 100644
--- a/roiextractors/extractors/caiman/caimansegmentationextractor.py
+++ b/roiextractors/extractors/caiman/caimansegmentationextractor.py
@@ -27,11 +27,13 @@ class CaimanSegmentationExtractor(SegmentationExtractor):
     its funtionality specifically applied to the dataset output from
     the \'CNMF-E\' ROI segmentation method.
     """
-    extractor_name = 'CaimanSegmentation'
+
+    extractor_name = "CaimanSegmentation"
     installed = HAVE_H5PY and HAVE_SCIPY  # check at class level if installed or not
     is_writable = True
-    mode = 'file'
-    installation_mesg = "To use the CaimanSegmentationExtractor install h5py and scipy: \n\n pip install scipy/h5py\n\n"  # error message when not installed
+    mode = "file"
+    # error message when not installed
+    installation_mesg = "To use the CaimanSegmentationExtractor install h5py and scipy: \n\n pip install scipy/h5py\n\n"
 
     def __init__(self, file_path: PathType):
         """
@@ -43,54 +45,61 @@ def __init__(self, file_path: PathType):
         SegmentationExtractor.__init__(self)
         self.file_path = file_path
         self._dataset_file = self._file_extractor_read()
-        self._roi_response_dff = self._trace_extractor_read('F_dff')
-        self._roi_response_neuropil = self._trace_extractor_read('C')
-        self._roi_response_deconvolved = self._trace_extractor_read('S')
+        self._roi_response_dff = self._trace_extractor_read("F_dff")
+        self._roi_response_neuropil = self._trace_extractor_read("C")
+        self._roi_response_deconvolved = self._trace_extractor_read("S")
         self._image_correlation = self._summary_image_read()
-        self._sampling_frequency = self._dataset_file['params']['data']['fr'][()]
+        self._sampling_frequency = self._dataset_file["params"]["data"]["fr"][()]
         self._image_masks = self._image_mask_sparse_read()
 
     def __del__(self):
         self._dataset_file.close()
 
     def _file_extractor_read(self):
-        return h5py.File(self.file_path, 'r')
+        return h5py.File(self.file_path, "r")
 
     def _image_mask_sparse_read(self):
-        roi_ids = self._dataset_file['estimates']['A']['indices']
-        masks = self._dataset_file['estimates']['A']['data']
-        ids = self._dataset_file['estimates']['A']['indptr']
-        image_mask_in = csc_matrix((masks, roi_ids, ids),
-                                   shape=(np.prod(self.get_image_size()), self.get_num_rois())).toarray()
-        image_masks = np.reshape(image_mask_in, (*self.get_image_size(), -1), order='F')
+        roi_ids = self._dataset_file["estimates"]["A"]["indices"]
+        masks = self._dataset_file["estimates"]["A"]["data"]
+        ids = self._dataset_file["estimates"]["A"]["indptr"]
+        image_mask_in = csc_matrix(
+            (masks, roi_ids, ids),
+            shape=(np.prod(self.get_image_size()), self.get_num_rois()),
+        ).toarray()
+        image_masks = np.reshape(image_mask_in, (*self.get_image_size(), -1), order="F")
         return image_masks
 
     def _trace_extractor_read(self, field):
-        if self._dataset_file['estimates'].get(field):
-            return self._dataset_file['estimates'][field]  # lazy read dataset)
+        if self._dataset_file["estimates"].get(field):
+            return self._dataset_file["estimates"][field]  # lazy read dataset)
 
     def _summary_image_read(self):
-        if self._dataset_file['estimates'].get('Cn'):
-            return np.array(self._dataset_file['estimates']['Cn'])
+        if self._dataset_file["estimates"].get("Cn"):
+            return np.array(self._dataset_file["estimates"]["Cn"])
 
     def get_accepted_list(self):
-        accepted = self._dataset_file['estimates']['idx_components']
+        accepted = self._dataset_file["estimates"]["idx_components"]
         if len(accepted.shape) == 0:
             accepted = list(range(self.get_num_rois()))
         return accepted
 
     def get_rejected_list(self):
-        rejected = self._dataset_file['estimates']['idx_components_bad']
+        rejected = self._dataset_file["estimates"]["idx_components_bad"]
         if len(rejected.shape) > 0:
             return rejected
 
     @staticmethod
     def write_segmentation(segmentation_object, save_path, overwrite=True):
         save_path = Path(save_path)
-        assert save_path.suffix in ['.hdf5', '.h5'], "'save_path' must be a *.hdf5 or *.h5 file"
+        assert save_path.suffix in [
+            ".hdf5",
+            ".h5",
+        ], "'save_path' must be a *.hdf5 or *.h5 file"
         if save_path.is_file():
             if not overwrite:
-                raise FileExistsError("The specified path exists! Use overwrite=True to overwrite it.")
+                raise FileExistsError(
+                    "The specified path exists! Use overwrite=True to overwrite it."
+                )
             else:
                 save_path.unlink()
 
@@ -99,48 +108,75 @@ def write_segmentation(segmentation_object, save_path, overwrite=True):
         if isinstance(segmentation_object, MultiSegmentationExtractor):
             segext_objs = segmentation_object.segmentations
             for plane_num, segext_obj in enumerate(segext_objs):
-                save_path_plane = folder_path/f'Plane_{plane_num}'/file_name
-                CaimanSegmentationExtractor.write_segmentation(segext_obj, save_path_plane)
+                save_path_plane = folder_path / f"Plane_{plane_num}" / file_name
+                CaimanSegmentationExtractor.write_segmentation(
+                    segext_obj, save_path_plane
+                )
         if not folder_path.is_dir():
             folder_path.mkdir(parents=True)
 
-        with h5py.File(save_path, 'a') as f:
+        with h5py.File(save_path, "a") as f:
             # create base groups:
-            estimates = f.create_group('estimates')
-            params = f.create_group('params')
+            estimates = f.create_group("estimates")
+            params = f.create_group("params")
             # adding to estimates:
-            if segmentation_object.get_traces(name='neuropil') is not None:
-                estimates.create_dataset('C', data=segmentation_object.get_traces(name='neuropil'))
-            if segmentation_object.get_traces(name='dff') is not None:
-                estimates.create_dataset('F_dff', data=segmentation_object.get_traces(name='dff'))
-            if segmentation_object.get_traces(name='deconvolved') is not None:
-                estimates.create_dataset('S', data=segmentation_object.get_traces(name='deconvolved'))
-            if segmentation_object.get_image('correlation') is not None:
-                estimates.create_dataset('Cn', data=segmentation_object.get_image('correlation'))
-            estimates.create_dataset('idx_components',
-                                     data=np.array([] if segmentation_object.get_accepted_list() is None
-                                                   else segmentation_object.get_accepted_list()))
-            estimates.create_dataset('idx_components_bad',
-                                     data=np.array([] if segmentation_object.get_rejected_list() is None
-                                                   else segmentation_object.get_rejected_list()))
+            if segmentation_object.get_traces(name="neuropil") is not None:
+                estimates.create_dataset(
+                    "C", data=segmentation_object.get_traces(name="neuropil")
+                )
+            if segmentation_object.get_traces(name="dff") is not None:
+                estimates.create_dataset(
+                    "F_dff", data=segmentation_object.get_traces(name="dff")
+                )
+            if segmentation_object.get_traces(name="deconvolved") is not None:
+                estimates.create_dataset(
+                    "S", data=segmentation_object.get_traces(name="deconvolved")
+                )
+            if segmentation_object.get_image("correlation") is not None:
+                estimates.create_dataset(
+                    "Cn", data=segmentation_object.get_image("correlation")
+                )
+            estimates.create_dataset(
+                "idx_components",
+                data=np.array(
+                    []
+                    if segmentation_object.get_accepted_list() is None
+                    else segmentation_object.get_accepted_list()
+                ),
+            )
+            estimates.create_dataset(
+                "idx_components_bad",
+                data=np.array(
+                    []
+                    if segmentation_object.get_rejected_list() is None
+                    else segmentation_object.get_rejected_list()
+                ),
+            )
 
             # adding image_masks:
-            image_mask_data = np.reshape(segmentation_object.get_roi_image_masks(),
-                                         [-1, segmentation_object.get_num_rois()], order='F')
+            image_mask_data = np.reshape(
+                segmentation_object.get_roi_image_masks(),
+                [-1, segmentation_object.get_num_rois()],
+                order="F",
+            )
             image_mask_csc = csc_matrix(image_mask_data)
-            estimates.create_dataset('A/data', data=image_mask_csc.data)
-            estimates.create_dataset('A/indptr', data=image_mask_csc.indptr)
-            estimates.create_dataset('A/indices', data=image_mask_csc.indices)
-            estimates.create_dataset('A/shape', data=image_mask_csc.shape)
+            estimates.create_dataset("A/data", data=image_mask_csc.data)
+            estimates.create_dataset("A/indptr", data=image_mask_csc.indptr)
+            estimates.create_dataset("A/indices", data=image_mask_csc.indices)
+            estimates.create_dataset("A/shape", data=image_mask_csc.shape)
 
             # adding params:
-            params.create_dataset('data/fr', data=segmentation_object.get_sampling_frequency())
-            params.create_dataset('data/dims', data=segmentation_object.get_image_size())
-            f.create_dataset('dims', data=segmentation_object.get_image_size())
+            params.create_dataset(
+                "data/fr", data=segmentation_object.get_sampling_frequency()
+            )
+            params.create_dataset(
+                "data/dims", data=segmentation_object.get_image_size()
+            )
+            f.create_dataset("dims", data=segmentation_object.get_image_size())
 
     # defining the abstract class enformed methods:
     def get_roi_ids(self):
         return list(range(self.get_num_rois()))
 
     def get_image_size(self):
-        return self._dataset_file['params']['data']['dims'][()]
+        return self._dataset_file["params"]["data"]["dims"][()]
diff --git a/roiextractors/extractors/hdf5imagingextractor/hdf5imagingextractor.py b/roiextractors/extractors/hdf5imagingextractor/hdf5imagingextractor.py
index e55c7e91..4e886642 100644
--- a/roiextractors/extractors/hdf5imagingextractor/hdf5imagingextractor.py
+++ b/roiextractors/extractors/hdf5imagingextractor/hdf5imagingextractor.py
@@ -3,7 +3,11 @@
 import numpy as np
 
 from ...extraction_tools import PathType, FloatType, ArrayType
-from ...extraction_tools import check_get_frames_args, get_video_shape, write_to_h5_dataset_format
+from ...extraction_tools import (
+    check_get_frames_args,
+    get_video_shape,
+    write_to_h5_dataset_format,
+)
 from ...imagingextractor import ImagingExtractor
 
 try:
@@ -15,27 +19,38 @@
 
 
 class Hdf5ImagingExtractor(ImagingExtractor):
-    extractor_name = 'Hdf5Imaging'
+    extractor_name = "Hdf5Imaging"
     installed = HAVE_H5  # check at class level if installed or not
     is_writable = True
-    mode = 'file'
+    mode = "file"
     installation_mesg = "To use the Hdf5 Extractor run:\n\n pip install h5py\n\n"  # error message when not installed
 
-    def __init__(self, file_path: PathType, mov_field: str = 'mov', sampling_frequency: FloatType = None,
-                 start_time: FloatType = None, metadata: dict = None,
-                 channel_names: ArrayType = None):
+    def __init__(
+        self,
+        file_path: PathType,
+        mov_field: str = "mov",
+        sampling_frequency: FloatType = None,
+        start_time: FloatType = None,
+        metadata: dict = None,
+        channel_names: ArrayType = None,
+    ):
         ImagingExtractor.__init__(self)
         self.filepath = Path(file_path)
         self._sampling_frequency = sampling_frequency
         self._mov_field = mov_field
-        assert self.filepath.suffix in ['.h5', '.hdf5'], "'file_path' file is not an .hdf5 or .h5 file"
+        assert self.filepath.suffix in [
+            ".h5",
+            ".hdf5",
+        ], "'file_path' file is not an .hdf5 or .h5 file"
         self._channel_names = channel_names
 
         self._file = h5py.File(file_path, "r")
-        if 'mov' in self._file.keys():
+        if "mov" in self._file.keys():
             self._video = self._file[self._mov_field]
             if sampling_frequency is None:
-                assert 'fr' in self._video.attrs, "sampling frequency information is unavailable!"
+                assert (
+                    "fr" in self._video.attrs
+                ), "sampling frequency information is unavailable!"
                 self._sampling_frequency = self._video.attrs["fr"]
             else:
                 self._sampling_frequency = sampling_frequency
@@ -43,38 +58,52 @@ def __init__(self, file_path: PathType, mov_field: str = 'mov', sampling_frequen
             raise Exception(f"{file_path} does not contain the 'mov' dataset")
 
         if start_time is None:
-            if 'start_time' in self._video.attrs.keys():
+            if "start_time" in self._video.attrs.keys():
                 self._start_time = self._video.attrs["start_time"]
         else:
             self._start_time = start_time
 
         if metadata is None:
-            if 'metadata' in self._video.attrs:
+            if "metadata" in self._video.attrs:
                 self.metadata = self._video.attrs["metadata"]
         else:
             self.metadata = metadata
 
-        self._num_channels, self._num_frames, self._size_x, self._size_y = get_video_shape(self._video)
+        (
+            self._num_channels,
+            self._num_frames,
+            self._size_x,
+            self._size_y,
+        ) = get_video_shape(self._video)
 
         if len(self._video.shape) == 3:
             # check if this converts to np.ndarray
             self._video = self._video[np.newaxis, :]
 
         if self._channel_names is not None:
-            assert len(self._channel_names) == self._num_channels, "'channel_names' length is different than number " \
-                                                                   "of channels"
+            assert len(self._channel_names) == self._num_channels, (
+                "'channel_names' length is different than number " "of channels"
+            )
         else:
-            self._channel_names = [f'channel_{ch}' for ch in range(self._num_channels)]
+            self._channel_names = [f"channel_{ch}" for ch in range(self._num_channels)]
 
-        self._kwargs = {'file_path': str(Path(file_path).absolute()), 'mov_field': mov_field,
-                        'sampling_frequency': sampling_frequency, 'channel_names': channel_names}
+        self._kwargs = {
+            "file_path": str(Path(file_path).absolute()),
+            "mov_field": mov_field,
+            "sampling_frequency": sampling_frequency,
+            "channel_names": channel_names,
+        }
 
     def __del__(self):
         self._file.close()
 
     @check_get_frames_args
     def get_frames(self, frame_idxs, channel=0):
-        if frame_idxs.size > 1 and np.all(np.diff(frame_idxs) > 0) or frame_idxs.size == 1:
+        if (
+            frame_idxs.size > 1
+            and np.all(np.diff(frame_idxs) > 0)
+            or frame_idxs.size == 1
+        ):
             return self._video[channel, frame_idxs]
             # return lazy_ops.DatasetView(self._video).lazy_slice[channel, frame_idxs]
         else:
@@ -100,18 +129,30 @@ def get_num_channels(self):
         return self._num_channels
 
     @staticmethod
-    def write_imaging(imaging: ImagingExtractor, save_path, overwrite: bool = False,
-                      mov_field="mov", **kwargs):
+    def write_imaging(
+        imaging: ImagingExtractor,
+        save_path,
+        overwrite: bool = False,
+        mov_field="mov",
+        **kwargs,
+    ):
         save_path = Path(save_path)
-        assert save_path.suffix in ['.h5', '.hdf5'], "'save_path' file is not an .hdf5 or .h5 file"
+        assert save_path.suffix in [
+            ".h5",
+            ".hdf5",
+        ], "'save_path' file is not an .hdf5 or .h5 file"
 
         if save_path.is_file():
             if not overwrite:
-                raise FileExistsError("The specified path exists! Use overwrite=True to overwrite it.")
+                raise FileExistsError(
+                    "The specified path exists! Use overwrite=True to overwrite it."
+                )
             else:
                 save_path.unlink()
 
-        with h5py.File(save_path, 'w') as f:
-            write_to_h5_dataset_format(imaging=imaging, dataset_path=mov_field, file_handle=f, **kwargs)
+        with h5py.File(save_path, "w") as f:
+            write_to_h5_dataset_format(
+                imaging=imaging, dataset_path=mov_field, file_handle=f, **kwargs
+            )
             dset = f[mov_field]
             dset.attrs["fr"] = imaging.get_sampling_frequency()
diff --git a/roiextractors/extractors/numpyextractors/numpyextractors.py b/roiextractors/extractors/numpyextractors/numpyextractors.py
index 05ba4878..ece12dc4 100644
--- a/roiextractors/extractors/numpyextractors/numpyextractors.py
+++ b/roiextractors/extractors/numpyextractors/numpyextractors.py
@@ -9,27 +9,38 @@
 
 
 class NumpyImagingExtractor(ImagingExtractor):
-    extractor_name = 'NumpyImagingExtractor'
+    extractor_name = "NumpyImagingExtractor"
     is_writable = True
 
-    def __init__(self, timeseries: PathType, sampling_frequency: FloatType, channel_names: ArrayType = None):
+    def __init__(
+        self,
+        timeseries: PathType,
+        sampling_frequency: FloatType,
+        channel_names: ArrayType = None,
+    ):
         ImagingExtractor.__init__(self)
 
         if isinstance(timeseries, (str, Path)):
             timeseries = Path(timeseries)
             if timeseries.is_file():
-                assert timeseries.suffix == '.npy', "'timeseries' file is not a numpy file (.npy)"
+                assert (
+                    timeseries.suffix == ".npy"
+                ), "'timeseries' file is not a numpy file (.npy)"
                 self.is_dumpable = True
-                self._video = np.load(timeseries, mmap_mode='r')
-                self._kwargs = {'timeseries': str(Path(timeseries).absolute()),
-                                'sampling_frequency': sampling_frequency}
+                self._video = np.load(timeseries, mmap_mode="r")
+                self._kwargs = {
+                    "timeseries": str(Path(timeseries).absolute()),
+                    "sampling_frequency": sampling_frequency,
+                }
             else:
                 raise ValueError("'timeeseries' is does not exist")
         elif isinstance(timeseries, np.ndarray):
             self.is_dumpable = False
             self._video = timeseries
-            self._kwargs = {'timeseries': timeseries,
-                            'sampling_frequency': sampling_frequency}
+            self._kwargs = {
+                "timeseries": timeseries,
+                "sampling_frequency": sampling_frequency,
+            }
         else:
             raise TypeError("'timeseries' can be a str or a numpy array")
 
@@ -38,17 +49,23 @@ def __init__(self, timeseries: PathType, sampling_frequency: FloatType, channel_
         self._sampling_frequency = sampling_frequency
         self._channel_names = channel_names
 
-        self._num_channels, self._num_frames, self._size_x, self._size_y = get_video_shape(self._video)
+        (
+            self._num_channels,
+            self._num_frames,
+            self._size_x,
+            self._size_y,
+        ) = get_video_shape(self._video)
 
         if len(self._video.shape) == 3:
             # check if this converts to np.ndarray
             self._video = self._video[np.newaxis, :]
 
         if self._channel_names is not None:
-            assert len(self._channel_names) == self._num_channels, "'channel_names' length is different than number " \
-                                                                   "of channels"
+            assert len(self._channel_names) == self._num_channels, (
+                "'channel_names' length is different than number " "of channels"
+            )
         else:
-            self._channel_names = [f'channel_{ch}' for ch in range(self._num_channels)]
+            self._channel_names = [f"channel_{ch}" for ch in range(self._num_channels)]
 
     @check_get_frames_args
     def get_frames(self, frame_idxs, channel=0):
@@ -86,11 +103,13 @@ def get_num_channels(self):
     @staticmethod
     def write_imaging(imaging, save_path, overwrite: bool = False):
         save_path = Path(save_path)
-        assert save_path.suffix == '.npy', "'save_path' should have a .npy extension"
+        assert save_path.suffix == ".npy", "'save_path' should have a .npy extension"
 
         if save_path.is_file():
             if not overwrite:
-                raise FileExistsError("The specified path exists! Use overwrite=True to overwrite it.")
+                raise FileExistsError(
+                    "The specified path exists! Use overwrite=True to overwrite it."
+                )
             else:
                 save_path.unlink()
 
@@ -103,19 +122,30 @@ class NumpySegmentationExtractor(SegmentationExtractor):
     a file format for which there is currently no support. To construct this,
     all data must be entered manually as arguments.
     """
-    extractor_name = 'NumpySegmentationExtractor'
+
+    extractor_name = "NumpySegmentationExtractor"
     installed = True  # check at class level if installed or not
     is_writable = True
-    mode = 'file'
+    mode = "file"
     installation_mesg = ""  # error message when not installed
 
-    def __init__(self, image_masks, raw=None,
-                 dff=None, deconvolved=None, neuropil=None,
-                 accepted_lst=None,
-                 mean_image=None, correlation_image=None,
-                 roi_ids=None, roi_locations=None, sampling_frequency=None,
-                 rejected_list=None, channel_names=None,
-                 movie_dims=None):
+    def __init__(
+        self,
+        image_masks,
+        raw=None,
+        dff=None,
+        deconvolved=None,
+        neuropil=None,
+        accepted_lst=None,
+        mean_image=None,
+        correlation_image=None,
+        roi_ids=None,
+        roi_locations=None,
+        sampling_frequency=None,
+        rejected_list=None,
+        channel_names=None,
+        movie_dims=None,
+    ):
         """
         Parameters:
         ----------
@@ -152,38 +182,46 @@ def __init__(self, image_masks, raw=None,
         if isinstance(image_masks, (str, Path)):
             image_masks = Path(image_masks)
             if image_masks.is_file():
-                assert image_masks.suffix == '.npy', "'image_masks' file is not a numpy file (.npy)"
+                assert (
+                    image_masks.suffix == ".npy"
+                ), "'image_masks' file is not a numpy file (.npy)"
 
                 self.is_dumpable = True
-                self._image_masks = np.load(image_masks, mmap_mode='r')
+                self._image_masks = np.load(image_masks, mmap_mode="r")
 
                 if raw is not None:
                     raw = Path(raw)
-                    assert raw.suffix == '.npy', "'raw' file is not a numpy file (.npy)"
-                    self._roi_response_raw = np.load(raw, mmap_mode='r')
+                    assert raw.suffix == ".npy", "'raw' file is not a numpy file (.npy)"
+                    self._roi_response_raw = np.load(raw, mmap_mode="r")
                 if dff is not None:
                     dff = Path(dff)
-                    assert dff.suffix == '.npy', "'dff' file is not a numpy file (.npy)"
-                    self._roi_response_dff = np.load(dff, mmap_mode='r')
-                    self._roi_response_neuropil = np.load(neuropil, mmap_mode='r')
+                    assert dff.suffix == ".npy", "'dff' file is not a numpy file (.npy)"
+                    self._roi_response_dff = np.load(dff, mmap_mode="r")
+                    self._roi_response_neuropil = np.load(neuropil, mmap_mode="r")
                 if deconvolved is not None:
                     deconvolved = Path(deconvolved)
-                    assert deconvolved.suffix == '.npy', "'deconvolved' file is not a numpy file (.npy)"
-                    self._roi_response_deconvolved = np.load(deconvolved, mmap_mode='r')
+                    assert (
+                        deconvolved.suffix == ".npy"
+                    ), "'deconvolved' file is not a numpy file (.npy)"
+                    self._roi_response_deconvolved = np.load(deconvolved, mmap_mode="r")
                 if neuropil is not None:
                     neuropil = Path(neuropil)
-                    assert neuropil.suffix == '.npy', "'neuropil' file is not a numpy file (.npy)"
-                    self._roi_response_neuropil = np.load(neuropil, mmap_mode='r')
+                    assert (
+                        neuropil.suffix == ".npy"
+                    ), "'neuropil' file is not a numpy file (.npy)"
+                    self._roi_response_neuropil = np.load(neuropil, mmap_mode="r")
 
-                self._kwargs = {'image_masks': str(Path(image_masks).absolute())}
+                self._kwargs = {"image_masks": str(Path(image_masks).absolute())}
                 if raw is not None:
-                    self._kwargs.update({'raw': str(Path(raw).absolute())})
+                    self._kwargs.update({"raw": str(Path(raw).absolute())})
                 if raw is not None:
-                    self._kwargs.update({'dff': str(Path(dff).absolute())})
+                    self._kwargs.update({"dff": str(Path(dff).absolute())})
                 if raw is not None:
-                    self._kwargs.update({'neuropil': str(Path(neuropil).absolute())})
+                    self._kwargs.update({"neuropil": str(Path(neuropil).absolute())})
                 if raw is not None:
-                    self._kwargs.update({'deconvolved': str(Path(deconvolved).absolute())})
+                    self._kwargs.update(
+                        {"deconvolved": str(Path(deconvolved).absolute())}
+                    )
 
             else:
                 raise ValueError("'timeeseries' is does not exist")
@@ -199,11 +237,13 @@ def __init__(self, image_masks, raw=None,
             self._roi_response_dff = dff
             self._roi_response_neuropil = neuropil
             self._roi_response_deconvolved = deconvolved
-            self._kwargs = {'image_masks': image_masks,
-                            'signal': raw,
-                            'dff': dff,
-                            'neuropil': neuropil,
-                            'deconvolved': deconvolved}
+            self._kwargs = {
+                "image_masks": image_masks,
+                "signal": raw,
+                "dff": dff,
+                "neuropil": neuropil,
+                "deconvolved": deconvolved,
+            }
         else:
             raise TypeError("'image_masks' can be a str or a numpy array")
         self._movie_dims = movie_dims if movie_dims is not None else image_masks.shape
@@ -231,7 +271,11 @@ def get_accepted_list(self):
 
     def get_rejected_list(self):
         if self._rejected_list is None:
-            return [a for a in range(self.get_num_rois()) if a not in set(self.get_accepted_list())]
+            return [
+                a
+                for a in range(self.get_num_rois())
+                if a not in set(self.get_accepted_list())
+            ]
         else:
             return self._rejected_list
 
@@ -240,10 +284,12 @@ def roi_locations(self):
         if self._roi_locs is None:
             num_ROIs = self.get_num_rois()
             raw_images = self._image_masks
-            roi_location = np.ndarray([2, num_ROIs], dtype='int')
+            roi_location = np.ndarray([2, num_ROIs], dtype="int")
             for i in range(num_ROIs):
                 temp = np.where(raw_images[:, :, i] == np.amax(raw_images[:, :, i]))
-                roi_location[:, i] = np.array([np.median(temp[0]), np.median(temp[1])]).T
+                roi_location[:, i] = np.array(
+                    [np.median(temp[0]), np.median(temp[1])]
+                ).T
             return roi_location
         else:
             return self._roi_locs
diff --git a/roiextractors/extractors/nwbextractors/nwbextractors.py b/roiextractors/extractors/nwbextractors/nwbextractors.py
index 81ebbd6e..68a31056 100644
--- a/roiextractors/extractors/nwbextractors/nwbextractors.py
+++ b/roiextractors/extractors/nwbextractors/nwbextractors.py
@@ -16,26 +16,46 @@
     from pynwb.base import Images
     from pynwb.file import Subject
     from pynwb.image import GrayscaleImage
-    from pynwb.ophys import ImageSegmentation, Fluorescence, OpticalChannel, TwoPhotonSeries
+    from pynwb.ophys import (
+        ImageSegmentation,
+        Fluorescence,
+        OpticalChannel,
+        TwoPhotonSeries,
+    )
 
     HAVE_NWB = True
 except ImportError:
     HAVE_NWB = False
 
-from ...extraction_tools import PathType, FloatType, IntType, \
-    check_get_frames_args, check_get_videos_args, \
-    dict_recursive_update
+from ...extraction_tools import (
+    PathType,
+    FloatType,
+    IntType,
+    check_get_frames_args,
+    check_get_videos_args,
+    dict_recursive_update,
+)
 from ...imagingextractor import ImagingExtractor
 from ...multisegmentationextractor import MultiSegmentationExtractor
 from ...segmentationextractor import SegmentationExtractor
 
 
 def check_nwb_install():
-    assert HAVE_NWB, "To use the Nwb extractors, install pynwb: \n\n pip install pynwb\n\n"
-
-
-def set_dynamic_table_property(dynamic_table, ids, row_ids, property_name, values, index=False,
-                               default_value=np.nan, description='no description'):
+    assert (
+        HAVE_NWB
+    ), "To use the Nwb extractors, install pynwb: \n\n pip install pynwb\n\n"
+
+
+def set_dynamic_table_property(
+    dynamic_table,
+    ids,
+    row_ids,
+    property_name,
+    values,
+    index=False,
+    default_value=np.nan,
+    description="no description",
+):
     check_nwb_install()
     if not isinstance(row_ids, list) or not all(isinstance(x, int) for x in row_ids):
         raise TypeError("'ids' must be a list of integers")
@@ -51,24 +71,18 @@ def set_dynamic_table_property(dynamic_table, ids, row_ids, property_name, value
             for (row_id, value) in zip(row_ids, values):
                 dynamic_table[property_name].data[ids.index(row_id)] = value
         else:
-            col_data = [default_value]*len(ids)  # init with default val
+            col_data = [default_value] * len(ids)  # init with default val
             for (row_id, value) in zip(row_ids, values):
                 col_data[ids.index(row_id)] = value
             dynamic_table.add_column(
-                name=property_name,
-                description=description,
-                data=col_data,
-                index=index
+                name=property_name, description=description, data=col_data, index=index
             )
     else:
         if property_name in dynamic_table:
             raise NotImplementedError
         else:
             dynamic_table.add_column(
-                name=property_name,
-                description=description,
-                data=values,
-                index=index
+                name=property_name, description=description, data=values, index=index
             )
 
 
@@ -89,26 +103,53 @@ def update_dict(d, u):
 
 
 def get_default_nwb_metadata():
-    metadata = {'NWBFile': {'session_start_time': datetime.now(),
-                            'identifier': str(uuid.uuid4()),
-                            'session_description': 'no description'},
-                'Ophys': {'Device': [{'name': 'Microscope'}],
-                          'Fluorescence': {'roi_response_series': [{'name': 'RoiResponseSeries',
-                                                                    'description': 'array of raw fluorescence traces'}]},
-                          'ImageSegmentation': {'plane_segmentations': [{'description': 'Segmented ROIs',
-                                                                         'name': 'PlaneSegmentation'}]},
-                          'ImagingPlane': [{'name': 'ImagingPlane',
-                                            'description': 'no description',
-                                            'excitation_lambda': np.nan,
-                                            'indicator': 'unknown',
-                                            'location': 'unknown',
-                                            'optical_channel': [{'name': 'OpticalChannel',
-                                                                 'emission_lambda': np.nan,
-                                                                 'description': 'no description'}]}],
-                          'TwoPhotonSeries': [{'name': 'TwoPhotonSeries',
-                                               'description': 'no description',
-                                               'comments': 'Generalized from RoiInterface',
-                                               'unit': 'n.a.'}]}}
+    metadata = {
+        "NWBFile": {
+            "session_start_time": datetime.now(),
+            "identifier": str(uuid.uuid4()),
+            "session_description": "no description",
+        },
+        "Ophys": {
+            "Device": [{"name": "Microscope"}],
+            "Fluorescence": {
+                "roi_response_series": [
+                    {
+                        "name": "RoiResponseSeries",
+                        "description": "array of raw fluorescence traces",
+                    }
+                ]
+            },
+            "ImageSegmentation": {
+                "plane_segmentations": [
+                    {"description": "Segmented ROIs", "name": "PlaneSegmentation"}
+                ]
+            },
+            "ImagingPlane": [
+                {
+                    "name": "ImagingPlane",
+                    "description": "no description",
+                    "excitation_lambda": np.nan,
+                    "indicator": "unknown",
+                    "location": "unknown",
+                    "optical_channel": [
+                        {
+                            "name": "OpticalChannel",
+                            "emission_lambda": np.nan,
+                            "description": "no description",
+                        }
+                    ],
+                }
+            ],
+            "TwoPhotonSeries": [
+                {
+                    "name": "TwoPhotonSeries",
+                    "description": "no description",
+                    "comments": "Generalized from RoiInterface",
+                    "unit": "n.a.",
+                }
+            ],
+        },
+    }
     return metadata
 
 
@@ -118,13 +159,15 @@ class NwbImagingExtractor(ImagingExtractor):
     static method to write any format specific object to NWB.
     """
 
-    extractor_name = 'NwbImaging'
+    extractor_name = "NwbImaging"
     installed = HAVE_NWB  # check at class level if installed or not
     is_writable = True
-    mode = 'file'
+    mode = "file"
     installation_mesg = "To use the Nwb Extractor run:\n\n pip install pynwb\n\n"  # error message when not installed
 
-    def __init__(self, file_path: PathType, optical_series_name: str = 'TwoPhotonSeries'):
+    def __init__(
+        self, file_path: PathType, optical_series_name: str = "TwoPhotonSeries"
+    ):
         """
         Parameters
         ----------
@@ -136,30 +179,34 @@ def __init__(self, file_path: PathType, optical_series_name: str = 'TwoPhotonSer
         ImagingExtractor.__init__(self)
         self._path = file_path
 
-        self.io = NWBHDF5IO(str(self._path), 'r')
+        self.io = NWBHDF5IO(str(self._path), "r")
         self.nwbfile = self.io.read()
         if optical_series_name is not None:
             self._optical_series_name = optical_series_name
         else:
             a_names = list(self.nwbfile.acquisition)
             if len(a_names) > 1:
-                raise ValueError('More than one acquisition found. You must specify two_photon_series.')
+                raise ValueError(
+                    "More than one acquisition found. You must specify two_photon_series."
+                )
             if len(a_names) == 0:
-                raise ValueError('No acquisitions found in the .nwb file.')
+                raise ValueError("No acquisitions found in the .nwb file.")
             self._optical_series_name = a_names[0]
 
         opts = self.nwbfile.acquisition[self._optical_series_name]
-        assert isinstance(opts, TwoPhotonSeries), "The optical series must be of type pynwb.TwoPhotonSeries"
+        assert isinstance(
+            opts, TwoPhotonSeries
+        ), "The optical series must be of type pynwb.TwoPhotonSeries"
 
         # TODO if external file --> return another proper extractor (e.g. TiffImagingExtractor)
         assert opts.external_file is None, "Only 'raw' format is currently supported"
 
-        if hasattr(opts, 'timestamps') and opts.timestamps:
-            self._sampling_frequency = 1./np.median(np.diff(opts.timestamps))
+        if hasattr(opts, "timestamps") and opts.timestamps:
+            self._sampling_frequency = 1.0 / np.median(np.diff(opts.timestamps))
             self._imaging_start_time = opts.timestamps[0]
         else:
             self._sampling_frequency = opts.rate
-            self._imaging_start_time = opts.fields.get('starting_time', 0.)
+            self._imaging_start_time = opts.fields.get("starting_time", 0.0)
 
         if len(opts.data.shape) == 3:
             self._num_frames, self._size_x, self._size_y = opts.data.shape
@@ -173,22 +220,27 @@ def __init__(self, file_path: PathType, optical_series_name: str = 'TwoPhotonSer
         if self.nwbfile.epochs is not None:
             df_epochs = self.nwbfile.epochs.to_dataframe()
             # TODO implement add_epoch() method in base class
-            self._epochs = {row['tags'][0]: {
-                'start_frame': self.time_to_frame(row['start_time']),
-                'end_frame': self.time_to_frame(row['stop_time'])}
-                for _, row in df_epochs.iterrows()}
-
-        self._kwargs = {'file_path': str(Path(file_path).absolute()),
-                        'optical_series_name': optical_series_name}
+            self._epochs = {
+                row["tags"][0]: {
+                    "start_frame": self.time_to_frame(row["start_time"]),
+                    "end_frame": self.time_to_frame(row["stop_time"]),
+                }
+                for _, row in df_epochs.iterrows()
+            }
+
+        self._kwargs = {
+            "file_path": str(Path(file_path).absolute()),
+            "optical_series_name": optical_series_name,
+        }
 
     def __del__(self):
         self.io.close()
 
     def time_to_frame(self, time: FloatType):
-        return int((time - self._imaging_start_time)*self.get_sampling_frequency())
+        return int((time - self._imaging_start_time) * self.get_sampling_frequency())
 
     def frame_to_time(self, frame: IntType):
-        return float(frame/self.get_sampling_frequency() + self._imaging_start_time)
+        return float(frame / self.get_sampling_frequency() + self._imaging_start_time)
 
     def make_nwb_metadata(self, nwbfile, opts):
         # Metadata dictionary - useful for constructing a nwb file
@@ -198,18 +250,12 @@ def make_nwb_metadata(self, nwbfile, opts):
                 identifier=nwbfile.identifier,
                 session_start_time=nwbfile.session_start_time,
                 institution=nwbfile.institution,
-                lab=nwbfile.lab
+                lab=nwbfile.lab,
             ),
             Ophys=dict(
-                Device=[
-                    dict(name=dev) for dev in nwbfile.devices
-                ],
-                TwoPhotonSeries=[
-                    dict(
-                        name=opts.name
-                    )
-                ]
-            )
+                Device=[dict(name=dev) for dev in nwbfile.devices],
+                TwoPhotonSeries=[dict(name=opts.name)],
+            ),
         )
 
     @check_get_frames_args
@@ -262,9 +308,9 @@ def add_devices(imaging, nwbfile, metadata):
         # Devices
         metadata = dict_recursive_update(get_default_nwb_metadata(), metadata)
         # Tests if devices exist in nwbfile, if not create them from metadata
-        for dev in metadata['Ophys']['Device']:
-            if dev['name'] not in nwbfile.devices:
-                nwbfile.create_device(name=dev['name'])
+        for dev in metadata["Ophys"]["Device"]:
+            if dev["name"] not in nwbfile.devices:
+                nwbfile.create_device(name=dev["name"])
 
         return nwbfile
 
@@ -278,29 +324,35 @@ def add_two_photon_series(imaging, nwbfile, metadata, buffer_size=10):
         metadata = update_dict(metadata, NwbImagingExtractor.get_nwb_metadata(imaging))
         # Tests if ElectricalSeries already exists in acquisition
         nwb_es_names = [ac for ac in nwbfile.acquisition]
-        opts = metadata['Ophys']['TwoPhotonSeries'][0]
-        if opts['name'] not in nwb_es_names:
+        opts = metadata["Ophys"]["TwoPhotonSeries"][0]
+        if opts["name"] not in nwb_es_names:
             # retrieve device
             device = nwbfile.devices[list(nwbfile.devices.keys())[0]]
-            metadata['Ophys']['ImagingPlane'][0]['optical_channel'] = \
-                [OpticalChannel(**i) for i in metadata['Ophys']['ImagingPlane'][0]['optical_channel']]
-            metadata['Ophys']['ImagingPlane'][0] = update_dict(metadata['Ophys']['ImagingPlane'][0], {'device': device})
+            metadata["Ophys"]["ImagingPlane"][0]["optical_channel"] = [
+                OpticalChannel(**i)
+                for i in metadata["Ophys"]["ImagingPlane"][0]["optical_channel"]
+            ]
+            metadata["Ophys"]["ImagingPlane"][0] = update_dict(
+                metadata["Ophys"]["ImagingPlane"][0], {"device": device}
+            )
 
-            imaging_plane = nwbfile.create_imaging_plane(**metadata['Ophys']['ImagingPlane'][0])
+            imaging_plane = nwbfile.create_imaging_plane(
+                **metadata["Ophys"]["ImagingPlane"][0]
+            )
 
             def data_generator(imaging):
                 for i in range(imaging.get_num_frames()):
                     yield imaging.get_frames(frame_idxs=[i]).T
 
-            data = H5DataIO(DataChunkIterator(data_generator(imaging), buffer_size=buffer_size), compression=True)
-            acquisition_name = opts['name']
+            data = H5DataIO(
+                DataChunkIterator(data_generator(imaging), buffer_size=buffer_size),
+                compression=True,
+            )
 
             # using internal data. this data will be stored inside the NWB file
             two_p_series_kwargs = update_dict(
-                metadata['Ophys']['TwoPhotonSeries'][0],
-                dict(
-                    data=data,
-                    imaging_plane=imaging_plane)
+                metadata["Ophys"]["TwoPhotonSeries"][0],
+                dict(data=data, imaging_plane=imaging_plane),
             )
             ophys_ts = TwoPhotonSeries(**two_p_series_kwargs)
 
@@ -318,20 +370,24 @@ def add_epochs(imaging, nwbfile):
         for (name, ep) in imaging._epochs.items():
             if nwbfile.epochs is None:
                 nwbfile.add_epoch(
-                    start_time=imaging.frame_to_time(ep['start_frame']),
-                    stop_time=imaging.frame_to_time(ep['end_frame']),
-                    tags=name
+                    start_time=imaging.frame_to_time(ep["start_frame"]),
+                    stop_time=imaging.frame_to_time(ep["end_frame"]),
+                    tags=name,
                 )
             else:
-                if [name] in nwbfile.epochs['tags'][:]:
-                    ind = nwbfile.epochs['tags'][:].index([name])
-                    nwbfile.epochs['start_time'].data[ind] = imaging.frame_to_time(ep['start_frame'])
-                    nwbfile.epochs['stop_time'].data[ind] = imaging.frame_to_time(ep['end_frame'])
+                if [name] in nwbfile.epochs["tags"][:]:
+                    ind = nwbfile.epochs["tags"][:].index([name])
+                    nwbfile.epochs["start_time"].data[ind] = imaging.frame_to_time(
+                        ep["start_frame"]
+                    )
+                    nwbfile.epochs["stop_time"].data[ind] = imaging.frame_to_time(
+                        ep["end_frame"]
+                    )
                 else:
                     nwbfile.add_epoch(
-                        start_time=imaging.frame_to_time(ep['start_frame']),
-                        stop_time=imaging.frame_to_time(ep['end_frame']),
-                        tags=name
+                        start_time=imaging.frame_to_time(ep["start_frame"]),
+                        stop_time=imaging.frame_to_time(ep["end_frame"]),
+                        tags=name,
                     )
 
         return nwbfile
@@ -349,31 +405,45 @@ def get_nwb_metadata(imgextractor: ImagingExtractor):
         for i in range(imgextractor.get_num_channels()):
             ch_name = imgextractor.get_channel_names()[i]
             if i == 0:
-                metadata['Ophys']['ImagingPlane'][0]['optical_channel'][i]['name'] = ch_name
+                metadata["Ophys"]["ImagingPlane"][0]["optical_channel"][i][
+                    "name"
+                ] = ch_name
             else:
-                metadata['Ophys']['ImagingPlane'][0]['optical_channel'].append(dict(
-                    name=ch_name,
-                    emission_lambda=np.nan,
-                    description=f'{ch_name} description'
-                ))
+                metadata["Ophys"]["ImagingPlane"][0]["optical_channel"].append(
+                    dict(
+                        name=ch_name,
+                        emission_lambda=np.nan,
+                        description=f"{ch_name} description",
+                    )
+                )
 
         # set imaging plane rate:
-        rate = np.float(
-            'NaN') if imgextractor.get_sampling_frequency() is None else imgextractor.get_sampling_frequency()
+        rate = (
+            np.float("NaN")
+            if imgextractor.get_sampling_frequency() is None
+            else imgextractor.get_sampling_frequency()
+        )
         # adding imaging_rate:
-        metadata['Ophys']['ImagingPlane'][0].update(imaging_rate=rate)
+        metadata["Ophys"]["ImagingPlane"][0].update(imaging_rate=rate)
         # TwoPhotonSeries update:
-        metadata['Ophys']['TwoPhotonSeries'][0].update(
+        metadata["Ophys"]["TwoPhotonSeries"][0].update(
             dimension=imgextractor.get_image_size(),
-            rate=imgextractor.get_sampling_frequency())
+            rate=imgextractor.get_sampling_frequency(),
+        )
         # remove what Segmentation extractor will input:
-        _ = metadata['Ophys'].pop('ImageSegmentation')
-        _ = metadata['Ophys'].pop('Fluorescence')
+        _ = metadata["Ophys"].pop("ImageSegmentation")
+        _ = metadata["Ophys"].pop("Fluorescence")
         return metadata
 
     @staticmethod
-    def write_imaging(imaging: ImagingExtractor, save_path: PathType = None, nwbfile=None,
-                      metadata: dict = None, overwrite: bool = False, buffer_size: int = 10):
+    def write_imaging(
+        imaging: ImagingExtractor,
+        save_path: PathType = None,
+        nwbfile=None,
+        metadata: dict = None,
+        overwrite: bool = False,
+        buffer_size: int = 10,
+    ):
         """
         Parameters
         ----------
@@ -400,70 +470,75 @@ def write_imaging(imaging: ImagingExtractor, save_path: PathType = None, nwbfile
         """
         assert HAVE_NWB, NwbImagingExtractor.installation_mesg
 
-        assert save_path is None or nwbfile is None, \
-            'Either pass a save_path location, or nwbfile object, but not both!'
+        assert (
+            save_path is None or nwbfile is None
+        ), "Either pass a save_path location, or nwbfile object, but not both!"
 
         if nwbfile is not None:
-            assert isinstance(nwbfile, NWBFile), "'nwbfile' should be of type pynwb.NWBFile"
+            assert isinstance(
+                nwbfile, NWBFile
+            ), "'nwbfile' should be of type pynwb.NWBFile"
 
         # Update any previous metadata with user passed dictionary
         if metadata is None:
             metadata = dict()
-        if hasattr(imaging, 'nwb_metadata'):
+        if hasattr(imaging, "nwb_metadata"):
             metadata = update_dict(imaging.nwb_metadata, metadata)
         # update with default arguments:
-        metadata = dict_recursive_update(NwbImagingExtractor.get_nwb_metadata(imaging), metadata)
+        metadata = dict_recursive_update(
+            NwbImagingExtractor.get_nwb_metadata(imaging), metadata
+        )
         if nwbfile is None:
             save_path = Path(save_path)
-            assert save_path.suffix == '.nwb', "'save_path' file is not an .nwb file"
+            assert save_path.suffix == ".nwb", "'save_path' file is not an .nwb file"
 
             if save_path.is_file():
                 if not overwrite:
-                    read_mode = 'r+'
+                    read_mode = "r+"
                 else:
                     save_path.unlink()
-                    read_mode = 'w'
+                    read_mode = "w"
             else:
-                read_mode = 'w'
+                read_mode = "w"
 
             with NWBHDF5IO(str(save_path), mode=read_mode) as io:
-                if read_mode == 'r+':
+                if read_mode == "r+":
                     nwbfile = io.read()
                 else:
-                    nwbfile = NWBFile(**metadata['NWBFile'])
+                    nwbfile = NWBFile(**metadata["NWBFile"])
 
-                    NwbImagingExtractor.add_devices(imaging=imaging,
-                                                    nwbfile=nwbfile,
-                                                    metadata=metadata)
+                    NwbImagingExtractor.add_devices(
+                        imaging=imaging, nwbfile=nwbfile, metadata=metadata
+                    )
 
-                    NwbImagingExtractor.add_two_photon_series(imaging=imaging,
-                                                              nwbfile=nwbfile,
-                                                              metadata=metadata,
-                                                              buffer_size=buffer_size)
+                    NwbImagingExtractor.add_two_photon_series(
+                        imaging=imaging,
+                        nwbfile=nwbfile,
+                        metadata=metadata,
+                        buffer_size=buffer_size,
+                    )
 
-                    NwbImagingExtractor.add_epochs(imaging=imaging,
-                                                   nwbfile=nwbfile)
+                    NwbImagingExtractor.add_epochs(imaging=imaging, nwbfile=nwbfile)
 
                 # Write to file
                 io.write(nwbfile)
         else:
-            NwbImagingExtractor.add_devices(imaging=imaging,
-                                            nwbfile=nwbfile,
-                                            metadata=metadata)
+            NwbImagingExtractor.add_devices(
+                imaging=imaging, nwbfile=nwbfile, metadata=metadata
+            )
 
-            NwbImagingExtractor.add_two_photon_series(imaging=imaging,
-                                                      nwbfile=nwbfile,
-                                                      metadata=metadata)
+            NwbImagingExtractor.add_two_photon_series(
+                imaging=imaging, nwbfile=nwbfile, metadata=metadata
+            )
 
-            NwbImagingExtractor.add_epochs(imaging=imaging,
-                                           nwbfile=nwbfile)
+            NwbImagingExtractor.add_epochs(imaging=imaging, nwbfile=nwbfile)
 
 
 class NwbSegmentationExtractor(SegmentationExtractor):
-    extractor_name = 'NwbSegmentationExtractor'
+    extractor_name = "NwbSegmentationExtractor"
     installed = True  # check at class level if installed or not
     is_writable = False
-    mode = 'file'
+    mode = "file"
     installation_mesg = ""  # error message when not installed
 
     def __init__(self, file_path: PathType):
@@ -478,73 +553,93 @@ def __init__(self, file_path: PathType):
         SegmentationExtractor.__init__(self)
         file_path = Path(file_path)
         if not file_path.is_file():
-            raise Exception('file does not exist')
+            raise Exception("file does not exist")
 
         self.file_path = file_path
         self._image_masks = None
         self._roi_locs = None
         self._accepted_list = None
         self._rejected_list = None
-        self._io = NWBHDF5IO(str(file_path), mode='r')
+        self._io = NWBHDF5IO(str(file_path), mode="r")
         self.nwbfile = self._io.read()
 
-        ophys = self.nwbfile.processing.get('ophys')
+        ophys = self.nwbfile.processing.get("ophys")
         if ophys is None:
-            raise Exception('could not find ophys processing module in nwbfile')
+            raise Exception("could not find ophys processing module in nwbfile")
         else:
             # Extract roi_response:
             fluorescence = None
             dfof = None
             any_roi_response_series_found = False
-            if 'Fluorescence' in ophys.data_interfaces:
-                fluorescence = ophys.data_interfaces['Fluorescence']
-            if 'DfOverF' in ophys.data_interfaces:
-                dfof = ophys.data_interfaces['DfOverF']
+            if "Fluorescence" in ophys.data_interfaces:
+                fluorescence = ophys.data_interfaces["Fluorescence"]
+            if "DfOverF" in ophys.data_interfaces:
+                dfof = ophys.data_interfaces["DfOverF"]
             if fluorescence is None and dfof is None:
-                raise Exception('could not find Fluorescence/DfOverF module in nwbfile')
-            for trace_name in ['RoiResponseSeries', 'Dff', 'Neuropil', 'Deconvolved']:
-                trace_name_segext = 'raw' if trace_name == 'RoiResponseSeries' else trace_name.lower()
-                container = dfof if trace_name == 'Dff' else fluorescence
-                if container is not None and trace_name in container.roi_response_series:
+                raise Exception("could not find Fluorescence/DfOverF module in nwbfile")
+            for trace_name in ["RoiResponseSeries", "Dff", "Neuropil", "Deconvolved"]:
+                trace_name_segext = (
+                    "raw" if trace_name == "RoiResponseSeries" else trace_name.lower()
+                )
+                container = dfof if trace_name == "Dff" else fluorescence
+                if (
+                    container is not None
+                    and trace_name in container.roi_response_series
+                ):
                     any_roi_response_series_found = True
-                    setattr(self, f'_roi_response_{trace_name_segext}',
-                            DatasetView(container.roi_response_series[trace_name].data).lazy_transpose())
+                    setattr(
+                        self,
+                        f"_roi_response_{trace_name_segext}",
+                        DatasetView(
+                            container.roi_response_series[trace_name].data
+                        ).lazy_transpose(),
+                    )
                     if self._sampling_frequency is None:
-                        self._sampling_frequency = container.roi_response_series[trace_name].rate
+                        self._sampling_frequency = container.roi_response_series[
+                            trace_name
+                        ].rate
             if not any_roi_response_series_found:
                 raise Exception(
-                    'could not find any of \'RoiResponseSeries\'/\'Dff\'/\'Neuropil\'/\'Deconvolved\' named RoiResponseSeries in nwbfile')
+                    "could not find any of 'RoiResponseSeries'/'Dff'/'Neuropil'/'Deconvolved'"
+                    "named RoiResponseSeries in nwbfile"
+                )
 
             # Extract image_mask/background:
-            if 'ImageSegmentation' in ophys.data_interfaces:
-                image_seg = ophys.data_interfaces['ImageSegmentation']
-                if 'PlaneSegmentation' in image_seg.plane_segmentations:  # this requirement in nwbfile is enforced
-                    ps = image_seg.plane_segmentations['PlaneSegmentation']
-                    if 'image_mask' in ps.colnames:
-                        self._image_masks = DatasetView(ps['image_mask'].data).lazy_transpose([2, 1, 0])
+            if "ImageSegmentation" in ophys.data_interfaces:
+                image_seg = ophys.data_interfaces["ImageSegmentation"]
+                if (
+                    "PlaneSegmentation" in image_seg.plane_segmentations
+                ):  # this requirement in nwbfile is enforced
+                    ps = image_seg.plane_segmentations["PlaneSegmentation"]
+                    if "image_mask" in ps.colnames:
+                        self._image_masks = DatasetView(
+                            ps["image_mask"].data
+                        ).lazy_transpose([2, 1, 0])
                     else:
-                        raise Exception('could not find any image_masks in nwbfile')
-                    if 'RoiCentroid' in ps.colnames:
-                        self._roi_locs = ps['RoiCentroid']
-                    if 'Accepted' in ps.colnames:
-                        self._accepted_list = ps['Accepted'].data[:]
-                    if 'Rejected' in ps.colnames:
-                        self._rejected_list = ps['Rejected'].data[:]
+                        raise Exception("could not find any image_masks in nwbfile")
+                    if "RoiCentroid" in ps.colnames:
+                        self._roi_locs = ps["RoiCentroid"]
+                    if "Accepted" in ps.colnames:
+                        self._accepted_list = ps["Accepted"].data[:]
+                    if "Rejected" in ps.colnames:
+                        self._rejected_list = ps["Rejected"].data[:]
                     self._roi_idx = np.array(ps.id.data)
                 else:
-                    raise Exception('could not find any PlaneSegmentation in nwbfile')
+                    raise Exception("could not find any PlaneSegmentation in nwbfile")
 
             # Extracting stores images as GrayscaleImages:
-            if 'SegmentationImages' in ophys.data_interfaces:
-                images_container = ophys.data_interfaces['SegmentationImages']
-                if 'correlation' in images_container.images:
-                    self._image_correlation = images_container.images['correlation'].data[()].T
-                if 'mean' in images_container.images:
-                    self._image_mean = images_container.images['mean'].data[()].T
+            if "SegmentationImages" in ophys.data_interfaces:
+                images_container = ophys.data_interfaces["SegmentationImages"]
+                if "correlation" in images_container.images:
+                    self._image_correlation = (
+                        images_container.images["correlation"].data[()].T
+                    )
+                if "mean" in images_container.images:
+                    self._image_mean = images_container.images["mean"].data[()].T
 
         # Imaging plane:
-        if 'ImagingPlane' in self.nwbfile.imaging_planes:
-            imaging_plane = self.nwbfile.imaging_planes['ImagingPlane']
+        if "ImagingPlane" in self.nwbfile.imaging_planes:
+            imaging_plane = self.nwbfile.imaging_planes["ImagingPlane"]
             self._channel_names = [i.name for i in imaging_plane.optical_channel]
 
     def __del__(self):
@@ -586,104 +681,139 @@ def get_nwb_metadata(sgmextractor):
         for i in range(sgmextractor.get_num_channels()):
             ch_name = sgmextractor.get_channel_names()[i]
             if i == 0:
-                metadata['Ophys']['ImagingPlane'][0]['optical_channel'][i]['name'] = ch_name
+                metadata["Ophys"]["ImagingPlane"][0]["optical_channel"][i][
+                    "name"
+                ] = ch_name
             else:
-                metadata['Ophys']['ImagingPlane'][0]['optical_channel'].append(dict(
-                    name=ch_name,
-                    emission_lambda=np.nan,
-                    description=f'{ch_name} description'
-                ))
+                metadata["Ophys"]["ImagingPlane"][0]["optical_channel"].append(
+                    dict(
+                        name=ch_name,
+                        emission_lambda=np.nan,
+                        description=f"{ch_name} description",
+                    )
+                )
 
         # set roi_response_series rate:
-        rate = np.float(
-            'NaN') if sgmextractor.get_sampling_frequency() is None else sgmextractor.get_sampling_frequency()
+        rate = (
+            np.float("NaN")
+            if sgmextractor.get_sampling_frequency() is None
+            else sgmextractor.get_sampling_frequency()
+        )
         for trace_name, trace_data in sgmextractor.get_traces_dict().items():
-            if trace_name == 'raw':
+            if trace_name == "raw":
                 if trace_data is not None:
-                    metadata['Ophys']['Fluorescence']['roi_response_series'][0].update(rate=rate)
+                    metadata["Ophys"]["Fluorescence"]["roi_response_series"][0].update(
+                        rate=rate
+                    )
                 continue
             if trace_data is not None and len(trace_data.shape) != 0:
-                metadata['Ophys']['Fluorescence']['roi_response_series'].append(dict(
-                    name=trace_name.capitalize(),
-                    description=f'description of {trace_name} traces',
-                    rate=rate
-                ))
+                metadata["Ophys"]["Fluorescence"]["roi_response_series"].append(
+                    dict(
+                        name=trace_name.capitalize(),
+                        description=f"description of {trace_name} traces",
+                        rate=rate,
+                    )
+                )
         # adding imaging_rate:
-        metadata['Ophys']['ImagingPlane'][0].update(imaging_rate=rate)
+        metadata["Ophys"]["ImagingPlane"][0].update(imaging_rate=rate)
         # remove what imaging extractor will input:
-        _ = metadata['Ophys'].pop('TwoPhotonSeries')
+        _ = metadata["Ophys"].pop("TwoPhotonSeries")
         return metadata
 
     @staticmethod
-    def write_segmentation(segext_obj: SegmentationExtractor, save_path: PathType = None,
-                           plane_num=0, metadata: dict = None, overwrite: bool = True,
-                           buffer_size: int = 10, nwbfile=None):
-        assert save_path is None or nwbfile is None, \
-            'Either pass a save_path location, or nwbfile object, but not both!'
+    def write_segmentation(
+        segext_obj: SegmentationExtractor,
+        save_path: PathType = None,
+        plane_num=0,
+        metadata: dict = None,
+        overwrite: bool = True,
+        buffer_size: int = 10,
+        nwbfile=None,
+    ):
+        assert (
+            save_path is None or nwbfile is None
+        ), "Either pass a save_path location, or nwbfile object, but not both!"
 
         # parse metadata correctly:
         if isinstance(segext_obj, MultiSegmentationExtractor):
             segext_objs = segext_obj.segmentations
             if metadata is not None:
-                assert isinstance(metadata, list), "For MultiSegmentationExtractor enter 'metadata' as a list of " \
-                                                   "SegmentationExtractor metadata"
-                assert len(metadata) == len(segext_objs), "The 'metadata' argument should be a list with the same " \
-                                                          "number of elements as the segmentations in the " \
-                                                          "MultiSegmentationExtractor"
+                assert isinstance(metadata, list), (
+                    "For MultiSegmentationExtractor enter 'metadata' as a list of "
+                    "SegmentationExtractor metadata"
+                )
+                assert len(metadata) == len(segext_objs), (
+                    "The 'metadata' argument should be a list with the same "
+                    "number of elements as the segmentations in the "
+                    "MultiSegmentationExtractor"
+                )
         else:
             segext_objs = [segext_obj]
             if metadata is not None and not isinstance(metadata, list):
                 metadata = [metadata]
-        metadata_base_list = [NwbSegmentationExtractor.get_nwb_metadata(sgobj) for sgobj in segext_objs]
-        print(f'writing nwb for {segext_obj.extractor_name}\n')
+        metadata_base_list = [
+            NwbSegmentationExtractor.get_nwb_metadata(sgobj) for sgobj in segext_objs
+        ]
+        print(f"writing nwb for {segext_obj.extractor_name}\n")
         # updating base metadata with new:
         for num, data in enumerate(metadata_base_list):
             metadata_input = metadata[num] if metadata else {}
-            metadata_base_list[num] = dict_recursive_update(metadata_base_list[num], metadata_input)
+            metadata_base_list[num] = dict_recursive_update(
+                metadata_base_list[num], metadata_input
+            )
         metadata_base_common = metadata_base_list[0]
 
         # build/retrieve nwbfile:
         if nwbfile is not None:
-            assert isinstance(nwbfile, NWBFile), "'nwbfile' should be of type pynwb.NWBFile"
+            assert isinstance(
+                nwbfile, NWBFile
+            ), "'nwbfile' should be of type pynwb.NWBFile"
             write = False
         else:
             write = True
             save_path = Path(save_path)
-            assert save_path.suffix == '.nwb'
+            assert save_path.suffix == ".nwb"
             if save_path.is_file() and not overwrite:
                 nwbfile_exist = True
-                file_mode = 'r+'
+                file_mode = "r+"
             else:
                 if save_path.is_file():
                     os.remove(save_path)
                 if not save_path.parent.is_dir():
                     save_path.parent.mkdir(parents=True)
                 nwbfile_exist = False
-                file_mode = 'w'
+                file_mode = "w"
             io = NWBHDF5IO(str(save_path), file_mode)
             if nwbfile_exist:
                 nwbfile = io.read()
             else:
-                nwbfile = NWBFile(**metadata_base_common['NWBFile'])
+                nwbfile = NWBFile(**metadata_base_common["NWBFile"])
 
         # Subject:
-        if metadata_base_common.get('Subject') and nwbfile.subject is None:
-            nwbfile.subject = Subject(**metadata_base_common['Subject'])
+        if metadata_base_common.get("Subject") and nwbfile.subject is None:
+            nwbfile.subject = Subject(**metadata_base_common["Subject"])
 
         # Processing Module:
-        if 'ophys' not in nwbfile.processing:
-            ophys = nwbfile.create_processing_module('ophys',
-                                                     'contains optical physiology processed data')
+        if "ophys" not in nwbfile.processing:
+            ophys = nwbfile.create_processing_module(
+                "ophys", "contains optical physiology processed data"
+            )
         else:
-            ophys = nwbfile.get_processing_module('ophys')
+            ophys = nwbfile.get_processing_module("ophys")
 
-        for plane_no_loop, (segext_obj, metadata) in enumerate(zip(segext_objs, metadata_base_list)):
+        for plane_no_loop, (segext_obj, metadata) in enumerate(
+            zip(segext_objs, metadata_base_list)
+        ):
             # Device:
-            if metadata['Ophys']['Device'][0]['name'] not in nwbfile.devices:
-                nwbfile.create_device(**metadata['Ophys']['Device'][0])
+            if metadata["Ophys"]["Device"][0]["name"] not in nwbfile.devices:
+                nwbfile.create_device(**metadata["Ophys"]["Device"][0])
 
             # ImageSegmentation:
-            image_segmentation_name = 'ImageSegmentation' if plane_no_loop == 0 else f'ImageSegmentation_Plane{plane_no_loop}'
+            image_segmentation_name = (
+                "ImageSegmentation"
+                if plane_no_loop == 0
+                else f"ImageSegmentation_Plane{plane_no_loop}"
+            )
             if image_segmentation_name not in ophys.data_interfaces:
                 image_segmentation = ImageSegmentation(name=image_segmentation_name)
                 ophys.add(image_segmentation)
@@ -691,38 +821,47 @@ def write_segmentation(segext_obj: SegmentationExtractor, save_path: PathType =
                 image_segmentation = ophys.data_interfaces.get(image_segmentation_name)
 
             # OpticalChannel:
-            optical_channels = [OpticalChannel(**i) for i in
-                                metadata['Ophys']['ImagingPlane'][0]['optical_channel']]
+            optical_channels = [
+                OpticalChannel(**i)
+                for i in metadata["Ophys"]["ImagingPlane"][0]["optical_channel"]
+            ]
 
             # ImagingPlane:
-            image_plane_name = 'ImagingPlane' if plane_no_loop == 0 else f'ImagePlane_{plane_no_loop}'
+            image_plane_name = (
+                "ImagingPlane" if plane_no_loop == 0 else f"ImagePlane_{plane_no_loop}"
+            )
             if image_plane_name not in nwbfile.imaging_planes.keys():
                 input_kwargs = dict(
                     name=image_plane_name,
-                    device=nwbfile.get_device(metadata_base_common['Ophys']['Device'][0]['name']),
+                    device=nwbfile.get_device(
+                        metadata_base_common["Ophys"]["Device"][0]["name"]
+                    ),
                 )
-                metadata['Ophys']['ImagingPlane'][0]['optical_channel'] = optical_channels
-                input_kwargs.update(**metadata['Ophys']['ImagingPlane'][0])
-                if 'imaging_rate' in input_kwargs:
-                    input_kwargs['imaging_rate'] = float(input_kwargs['imaging_rate'])
+                metadata["Ophys"]["ImagingPlane"][0][
+                    "optical_channel"
+                ] = optical_channels
+                input_kwargs.update(**metadata["Ophys"]["ImagingPlane"][0])
+                if "imaging_rate" in input_kwargs:
+                    input_kwargs["imaging_rate"] = float(input_kwargs["imaging_rate"])
                 imaging_plane = nwbfile.create_imaging_plane(**input_kwargs)
             else:
                 imaging_plane = nwbfile.imaging_planes[image_plane_name]
 
             # PlaneSegmentation:
             input_kwargs = dict(
-                description='output from segmenting imaging plane',
-                imaging_plane=imaging_plane
+                description="output from segmenting imaging plane",
+                imaging_plane=imaging_plane,
             )
-            ps_metadata = metadata['Ophys']['ImageSegmentation']['plane_segmentations'][0]
-            if ps_metadata['name'] not in image_segmentation.plane_segmentations:
+            ps_metadata = metadata["Ophys"]["ImageSegmentation"]["plane_segmentations"][
+                0
+            ]
+            if ps_metadata["name"] not in image_segmentation.plane_segmentations:
                 ps_exist = False
             else:
-                ps = image_segmentation.get_plane_segmentation(ps_metadata['name'])
+                ps = image_segmentation.get_plane_segmentation(ps_metadata["name"])
                 ps_exist = True
 
             roi_ids = segext_obj.get_roi_ids()
-            num_rois = segext_obj.get_num_rois()
             accepted_list = segext_obj.get_accepted_list()
             accepted_list = [] if accepted_list is None else accepted_list
             rejected_list = segext_obj.get_rejected_list()
@@ -740,58 +879,95 @@ def image_mask_iterator():
                 input_kwargs.update(
                     **ps_metadata,
                     columns=[
-                        VectorData(data=H5DataIO(DataChunkIterator(image_mask_iterator(), buffer_size=buffer_size),
-                                                 compression=True, compression_opts=9),
-                                   name='image_mask',
-                                   description='image masks'),
-                        VectorData(data=roi_locations,
-                                   name='RoiCentroid',
-                                   description='x,y location of centroid of the roi in image_mask'),
-                        VectorData(data=accepted_ids,
-                                   name='Accepted',
-                                   description='1 if ROi was accepted or 0 if rejected as a cell during segmentation operation'),
-                        VectorData(data=rejected_ids,
-                                   name='Rejected',
-                                   description='1 if ROi was rejected or 0 if accepted as a cell during segmentation operation')
+                        VectorData(
+                            data=H5DataIO(
+                                DataChunkIterator(
+                                    image_mask_iterator(), buffer_size=buffer_size
+                                ),
+                                compression=True,
+                                compression_opts=9,
+                            ),
+                            name="image_mask",
+                            description="image masks",
+                        ),
+                        VectorData(
+                            data=roi_locations,
+                            name="RoiCentroid",
+                            description="x,y location of centroid of the roi in image_mask",
+                        ),
+                        VectorData(
+                            data=accepted_ids,
+                            name="Accepted",
+                            description="1 if ROi was accepted or 0 if rejected as a cell during segmentation operation",
+                        ),
+                        VectorData(
+                            data=rejected_ids,
+                            name="Rejected",
+                            description="1 if ROi was rejected or 0 if accepted as a cell during segmentation operation",
+                        ),
                     ],
-                    id=roi_ids)
+                    id=roi_ids,
+                )
 
                 ps = image_segmentation.create_plane_segmentation(**input_kwargs)
 
             # Fluorescence Traces:
-            if 'Flourescence' not in ophys.data_interfaces:
+            if "Flourescence" not in ophys.data_interfaces:
                 fluorescence = Fluorescence()
                 ophys.add(fluorescence)
             else:
-                fluorescence = ophys.data_interfaces['Fluorescence']
+                fluorescence = ophys.data_interfaces["Fluorescence"]
             roi_response_dict = segext_obj.get_traces_dict()
-            roi_table_region = ps.create_roi_table_region(description=f'region for Imaging plane{plane_no_loop}',
-                                                          region=list(range(segext_obj.get_num_rois())))
-            rate = np.float(
-                'NaN') if segext_obj.get_sampling_frequency() is None else segext_obj.get_sampling_frequency()
+            roi_table_region = ps.create_roi_table_region(
+                description=f"region for Imaging plane{plane_no_loop}",
+                region=list(range(segext_obj.get_num_rois())),
+            )
+            rate = (
+                np.float("NaN")
+                if segext_obj.get_sampling_frequency() is None
+                else segext_obj.get_sampling_frequency()
+            )
             for i, j in roi_response_dict.items():
-                data = getattr(segext_obj, f'_roi_response_{i}')
+                data = getattr(segext_obj, f"_roi_response_{i}")
                 if data is not None:
                     data = np.asarray(data)
-                    trace_name = 'RoiResponseSeries' if i == 'raw' else i.capitalize()
-                    trace_name = trace_name if plane_no_loop == 0 else trace_name + f'_Plane{plane_no_loop}'
-                    input_kwargs = dict(name=trace_name, data=data.T, rois=roi_table_region, rate=rate, unit='n.a.')
+                    trace_name = "RoiResponseSeries" if i == "raw" else i.capitalize()
+                    trace_name = (
+                        trace_name
+                        if plane_no_loop == 0
+                        else trace_name + f"_Plane{plane_no_loop}"
+                    )
+                    input_kwargs = dict(
+                        name=trace_name,
+                        data=data.T,
+                        rois=roi_table_region,
+                        rate=rate,
+                        unit="n.a.",
+                    )
                     if trace_name not in fluorescence.roi_response_series:
                         fluorescence.create_roi_response_series(**input_kwargs)
 
             # create Two Photon Series:
-            if 'TwoPhotonSeries' not in nwbfile.acquisition:
-                warn('could not find TwoPhotonSeries, using ImagingExtractor to create an nwbfile')
+            if "TwoPhotonSeries" not in nwbfile.acquisition:
+                warn(
+                    "could not find TwoPhotonSeries, using ImagingExtractor to create an nwbfile"
+                )
 
             # adding images:
             images_dict = segext_obj.get_images_dict()
             if any([image is not None for image in images_dict.values()]):
-                images_name = 'SegmentationImages' if plane_no_loop == 0 else f'SegmentationImages_Plane{plane_no_loop}'
+                images_name = (
+                    "SegmentationImages"
+                    if plane_no_loop == 0
+                    else f"SegmentationImages_Plane{plane_no_loop}"
+                )
                 if images_name not in ophys.data_interfaces:
                     images = Images(images_name)
                     for img_name, img_no in images_dict.items():
                         if img_no is not None:
-                            images.add_image(GrayscaleImage(name=img_name, data=img_no.T))
+                            images.add_image(
+                                GrayscaleImage(name=img_name, data=img_no.T)
+                            )
                     ophys.add(images)
 
             # saving NWB file:
@@ -799,5 +975,5 @@ def image_mask_iterator():
                 io.write(nwbfile)
                 io.close()
                 # test read
-                with NWBHDF5IO(str(save_path), 'r') as io:
+                with NWBHDF5IO(str(save_path), "r") as io:
                     io.read()
diff --git a/roiextractors/extractors/sbximagingextractor/__init__.py b/roiextractors/extractors/sbximagingextractor/__init__.py
index 44576859..1f76a590 100644
--- a/roiextractors/extractors/sbximagingextractor/__init__.py
+++ b/roiextractors/extractors/sbximagingextractor/__init__.py
@@ -1,1 +1,1 @@
-from .sbximagingextractor import SbxImagingExtractor
\ No newline at end of file
+from .sbximagingextractor import SbxImagingExtractor
diff --git a/roiextractors/extractors/sbximagingextractor/sbximagingextractor.py b/roiextractors/extractors/sbximagingextractor/sbximagingextractor.py
index 560335f1..51224dcd 100644
--- a/roiextractors/extractors/sbximagingextractor/sbximagingextractor.py
+++ b/roiextractors/extractors/sbximagingextractor/sbximagingextractor.py
@@ -16,10 +16,10 @@
 
 
 class SbxImagingExtractor(ImagingExtractor):
-    extractor_name = 'SbxImaging'
+    extractor_name = "SbxImaging"
     installed = HAVE_Scipy  # check at class level if installed or not
     is_writable = True
-    mode = 'folder'
+    mode = "folder"
     installation_mesg = "To use the Sbx Extractor run:\n\n pip install scipy\n\n"  # error message when not installed
 
     def __init__(self, file_path: PathType, sampling_frequency: float = None):
@@ -28,28 +28,31 @@ def __init__(self, file_path: PathType, sampling_frequency: float = None):
         self.mat_file_path, self.sbx_file_path = self._check_file_path(file_path)
         self._info = self._loadmat()
         self._data = self._sbx_read()
-        self._sampling_frequency = sampling_frequency or float(self._info['frame_rate'])
+        self._sampling_frequency = sampling_frequency or float(self._info["frame_rate"])
         # channel names:
-        self._channel_names = self._info.get('channel_names', None)
+        self._channel_names = self._info.get("channel_names", None)
         if self._channel_names is None:
-            self._channel_names = [f'channel_{ch}' for ch in range(self._info['nChan'])]
+            self._channel_names = [f"channel_{ch}" for ch in range(self._info["nChan"])]
 
-        self._kwargs = {'file_path': str(Path(file_path).absolute()),
-                        'sampling_frequency': self._sampling_frequency, 'channel_names': self._channel_names}
+        self._kwargs = {
+            "file_path": str(Path(file_path).absolute()),
+            "sampling_frequency": self._sampling_frequency,
+            "channel_names": self._channel_names,
+        }
 
     @staticmethod
     def _check_file_path(file_path):
         file_path = Path(file_path)
-        assertion_msg = 'for file_path arg, provide a path to one .sbx /  .mat file'
+        assertion_msg = "for file_path arg, provide a path to one .sbx /  .mat file"
         file_type = file_path.suffix
-        assert file_type in ['.mat', '.sbx'], assertion_msg
-        if file_type == '.mat':
+        assert file_type in [".mat", ".sbx"], assertion_msg
+        if file_type == ".mat":
             mat_file_path = file_path
-            sbx_file_path = file_path.with_suffix('.sbx')
+            sbx_file_path = file_path.with_suffix(".sbx")
             assert sbx_file_path.is_file(), assertion_msg
         else:
             sbx_file_path = file_path
-            mat_file_path = file_path.with_suffix('.mat')
+            mat_file_path = file_path.with_suffix(".mat")
             assert mat_file_path.is_file(), assertion_msg
         return mat_file_path, sbx_file_path
 
@@ -64,60 +67,72 @@ def _loadmat(self):
         https://github.com/losonczylab/sima/blob/0b16818d9ba47fe4aae6d4aad1a9735d16da00dc/sima/imaging_parameters.py
         """
         data = spio.loadmat(self.mat_file_path, struct_as_record=False, squeeze_me=True)
-        info = check_keys(data)['info']
+        info = check_keys(data)["info"]
         # Defining number of channels/size factor
-        if info['channels'] == 1:
-            info['nChan'] = 2
+        if info["channels"] == 1:
+            info["nChan"] = 2
             factor = 1
-        elif info['channels'] == 2:
-            info['nChan'] = 1
+        elif info["channels"] == 2:
+            info["nChan"] = 1
             factor = 2
-        elif info['channels'] == 3:
-            info['nChan'] = 1
+        elif info["channels"] == 3:
+            info["nChan"] = 1
             factor = 2
         else:
             raise UserWarning("wrong 'channels' argument")
 
-        if info['scanmode'] == 0:
-            info['recordsPerBuffer'] *= 2
+        if info["scanmode"] == 0:
+            info["recordsPerBuffer"] *= 2
 
-        if 'fold_lines' in info:
-            if info['fold_lines'] > 0:
-                info['fov_repeats'] = int(info['config']['lines']/info['fold_lines'])
+        if "fold_lines" in info:
+            if info["fold_lines"] > 0:
+                info["fov_repeats"] = int(info["config"]["lines"] / info["fold_lines"])
             else:
-                info['fov_repeats'] = 1
+                info["fov_repeats"] = 1
         else:
-            info['fold_lines'] = 0
-            info['fov_repeats'] = 1
-
-        info['frame_rate'] = np.int(info['resfreq']/info['config']['lines']*(2 - info['scanmode'])*info['fov_repeats'])
+            info["fold_lines"] = 0
+            info["fov_repeats"] = 1
+
+        info["frame_rate"] = np.int(
+            info["resfreq"]
+            / info["config"]["lines"]
+            * (2 - info["scanmode"])
+            * info["fov_repeats"]
+        )
         # SIMA:
-        info['nsamples'] = info['sz'][1]*info['recordsPerBuffer']* \
-                           info['nChan']*2
+        info["nsamples"] = info["sz"][1] * info["recordsPerBuffer"] * info["nChan"] * 2
         # SIMA:
-        if ('volscan' in info and info['volscan'] > 0) or \
-                ('volscan' not in info and len(info.get('otwave', []))):
-            info['nplanes'] = len(info['otwave'])
+        if ("volscan" in info and info["volscan"] > 0) or (
+            "volscan" not in info and len(info.get("otwave", []))
+        ):
+            info["nplanes"] = len(info["otwave"])
         else:
-            info['nplanes'] = 1
+            info["nplanes"] = 1
         # SIMA:
-        if info.get('scanbox_version', -1) >= 2:
-            info['max_idx'] = os.path.getsize(self.sbx_file_path)//info['nsamples'] - 1
+        if info.get("scanbox_version", -1) >= 2:
+            info["max_idx"] = (
+                os.path.getsize(self.sbx_file_path) // info["nsamples"] - 1
+            )
         else:
-            info['max_idx'] = os.path.getsize(self.sbx_file_path)//info['bytesPerBuffer']*factor - 1
+            info["max_idx"] = (
+                os.path.getsize(self.sbx_file_path) // info["bytesPerBuffer"] * factor
+                - 1
+            )
         # SIMA: Fix for old scanbox versions
-        if 'sz' not in info:
-            info['sz'] = np.array([512, 796])
+        if "sz" not in info:
+            info["sz"] = np.array([512, 796])
         return info
 
     def _sbx_read(self):
-        nrows = self._info['recordsPerBuffer']
-        ncols = self._info['sz'][1]
-        nchannels = self._info['nChan']
-        nplanes = self._info['nplanes']
-        nframes = (self._info['max_idx'] + 1)//nplanes
+        nrows = self._info["recordsPerBuffer"]
+        ncols = self._info["sz"][1]
+        nchannels = self._info["nChan"]
+        nplanes = self._info["nplanes"]
+        nframes = (self._info["max_idx"] + 1) // nplanes
         shape = (nchannels, ncols, nrows, nplanes, nframes)
-        np_data = np.memmap(self.sbx_file_path, dtype='uint16', mode='r', shape=shape, order='F')
+        np_data = np.memmap(
+            self.sbx_file_path, dtype="uint16", mode="r", shape=shape, order="F"
+        )
         return np_data
 
     def get_frames(self, frame_idxs: ArrayType, channel: int = 0) -> np.array:
@@ -125,13 +140,13 @@ def get_frames(self, frame_idxs: ArrayType, channel: int = 0) -> np.array:
         for frame_no in frame_idxs:
             frames_list.append(self._data[channel, :, :, 0, frame_no])
         frame_out = np.stack(frames_list, axis=2).T.squeeze()
-        return np.iinfo('uint16').max - frame_out
+        return np.iinfo("uint16").max - frame_out
 
     def get_image_size(self) -> ArrayType:
-        return self._info['sz']
+        return self._info["sz"]
 
     def get_num_frames(self) -> int:
-        return (self._info['max_idx'] + 1)//self._info['nplanes']
+        return (self._info["max_idx"] + 1) // self._info["nplanes"]
 
     def get_sampling_frequency(self) -> float:
         return self._sampling_frequency
@@ -140,7 +155,7 @@ def get_channel_names(self) -> list:
         return self._channel_names
 
     def get_num_channels(self) -> int:
-        return self._info['nChan']
+        return self._info["nChan"]
 
     @staticmethod
     def write_imaging(imaging, save_path: PathType, overwrite: bool = False):
diff --git a/roiextractors/extractors/schnitzerextractor/cnmfesegmentationextractor.py b/roiextractors/extractors/schnitzerextractor/cnmfesegmentationextractor.py
index 22ef7ee1..23ad9986 100644
--- a/roiextractors/extractors/schnitzerextractor/cnmfesegmentationextractor.py
+++ b/roiextractors/extractors/schnitzerextractor/cnmfesegmentationextractor.py
@@ -28,10 +28,11 @@ class CnmfeSegmentationExtractor(SegmentationExtractor):
     its funtionality specifically applied to the dataset output from
     the \'CNMF-E\' ROI segmentation method.
     """
-    extractor_name = 'CnmfeSegmentation'
+
+    extractor_name = "CnmfeSegmentation"
     installed = HAVE_H5PY  # check at class level if installed or not
     is_writable = False
-    mode = 'file'
+    mode = "file"
     installation_mesg = "To use Cnmfe install h5py: \n\n pip install h5py \n\n"  # error message when not installed
 
     def __init__(self, file_path: PathType):
@@ -47,36 +48,45 @@ def __init__(self, file_path: PathType):
         self._image_masks = self._image_mask_extractor_read()
         self._roi_response_raw = self._trace_extractor_read()
         self._raw_movie_file_location = self._raw_datafile_read()
-        self._sampling_frequency = self._roi_response_raw.shape[1]/self._tot_exptime_extractor_read()
+        self._sampling_frequency = (
+            self._roi_response_raw.shape[1] / self._tot_exptime_extractor_read()
+        )
         self._image_correlation = self._summary_image_read()
 
     def __del__(self):
         self._dataset_file.close()
 
     def _file_extractor_read(self):
-        f = h5py.File(self.file_path, 'r')
+        f = h5py.File(self.file_path, "r")
         _group0_temp = list(f.keys())
-        _group0 = [a for a in _group0_temp if '#' not in a]
+        _group0 = [a for a in _group0_temp if "#" not in a]
         return f, _group0
 
     def _image_mask_extractor_read(self):
-        return DatasetView(self._dataset_file[self._group0[0]]['extractedImages']).lazy_transpose([1, 2, 0])
+        return DatasetView(
+            self._dataset_file[self._group0[0]]["extractedImages"]
+        ).lazy_transpose([1, 2, 0])
 
     def _trace_extractor_read(self):
-        extracted_signals = DatasetView(self._dataset_file[self._group0[0]]['extractedSignals'])
+        extracted_signals = DatasetView(
+            self._dataset_file[self._group0[0]]["extractedSignals"]
+        )
         return extracted_signals.T
 
     def _tot_exptime_extractor_read(self):
-        return self._dataset_file[self._group0[0]]['time']['totalTime'][0][0]
+        return self._dataset_file[self._group0[0]]["time"]["totalTime"][0][0]
 
     def _summary_image_read(self):
-        summary_image = self._dataset_file[self._group0[0]]['Cn']
+        summary_image = self._dataset_file[self._group0[0]]["Cn"]
         return np.array(summary_image)
 
     def _raw_datafile_read(self):
-        if self._dataset_file[self._group0[0]].get('movieList'):
-            charlist = [chr(i) for i in np.squeeze(self._dataset_file[self._group0[0]]['movieList'][:])]
-            return ''.join(charlist)
+        if self._dataset_file[self._group0[0]].get("movieList"):
+            charlist = [
+                chr(i)
+                for i in np.squeeze(self._dataset_file[self._group0[0]]["movieList"][:])
+            ]
+            return "".join(charlist)
 
     def get_accepted_list(self):
         return list(range(self.get_num_rois()))
@@ -86,13 +96,19 @@ def get_rejected_list(self):
         return [a for a in range(self.get_num_rois()) if a not in ac_set]
 
     @staticmethod
-    def write_segmentation(segmentation_object: SegmentationExtractor, save_path, overwrite=True):
-        assert HAVE_SCIPY and HAVE_H5PY, "To use Cnmfe install scipy/h5py: \n\n pip install scipy/h5py \n\n"
+    def write_segmentation(
+        segmentation_object: SegmentationExtractor, save_path, overwrite=True
+    ):
+        assert (
+            HAVE_SCIPY and HAVE_H5PY
+        ), "To use Cnmfe install scipy/h5py: \n\n pip install scipy/h5py \n\n"
         save_path = Path(save_path)
-        assert save_path.suffix == '.mat', "'save_path' must be a *.mat file"
+        assert save_path.suffix == ".mat", "'save_path' must be a *.mat file"
         if save_path.is_file():
             if not overwrite:
-                raise FileExistsError("The specified path exists! Use overwrite=True to overwrite it.")
+                raise FileExistsError(
+                    "The specified path exists! Use overwrite=True to overwrite it."
+                )
             else:
                 save_path.unlink()
 
@@ -101,35 +117,54 @@ def write_segmentation(segmentation_object: SegmentationExtractor, save_path, ov
         if isinstance(segmentation_object, MultiSegmentationExtractor):
             segext_objs = segmentation_object.segmentations
             for plane_num, segext_obj in enumerate(segext_objs):
-                save_path_plane = folder_path/f'Plane_{plane_num}'/file_name
-                CnmfeSegmentationExtractor.write_segmentation(segext_obj, save_path_plane)
+                save_path_plane = folder_path / f"Plane_{plane_num}" / file_name
+                CnmfeSegmentationExtractor.write_segmentation(
+                    segext_obj, save_path_plane
+                )
         if not folder_path.is_dir():
             folder_path.mkdir(parents=True)
 
-        with h5py.File(save_path, 'a') as f:
+        with h5py.File(save_path, "a") as f:
             # create base groups:
-            _ = f.create_group('#refs#')
-            main = f.create_group('cnmfeAnalysisOutput')
+            _ = f.create_group("#refs#")
+            main = f.create_group("cnmfeAnalysisOutput")
             # create datasets:
-            main.create_dataset('extractedImages', data=segmentation_object.get_roi_image_masks().T)
-            main.create_dataset('extractedSignals', data=segmentation_object.get_traces().T)
-            time = main.create_group('time')
+            main.create_dataset(
+                "extractedImages", data=segmentation_object.get_roi_image_masks().T
+            )
+            main.create_dataset(
+                "extractedSignals", data=segmentation_object.get_traces().T
+            )
+            time = main.create_group("time")
             if segmentation_object.get_sampling_frequency() is not None:
-                time.create_dataset('totalTime', (1, 1), data=segmentation_object.get_roi_image_masks().shape[1]/
-                                                              segmentation_object.get_sampling_frequency())
-            if getattr(segmentation_object, '_raw_movie_file_location', None):
-                main.create_dataset('movieList',
-                                    data=[ord(alph) for alph in str(segmentation_object._raw_movie_file_location)])
-            if segmentation_object.get_traces(name='deconvolved') is not None:
-                image_mask_csc = csc_matrix(segmentation_object.get_traces(name='deconvolved'))
-                main.create_dataset('extractedPeaks/data', data=image_mask_csc.data)
-                main.create_dataset('extractedPeaks/ir', data=image_mask_csc.indices)
-                main.create_dataset('extractedPeaks/jc', data=image_mask_csc.indptr)
+                time.create_dataset(
+                    "totalTime",
+                    (1, 1),
+                    data=segmentation_object.get_roi_image_masks().shape[1]
+                    / segmentation_object.get_sampling_frequency(),
+                )
+            if getattr(segmentation_object, "_raw_movie_file_location", None):
+                main.create_dataset(
+                    "movieList",
+                    data=[
+                        ord(alph)
+                        for alph in str(segmentation_object._raw_movie_file_location)
+                    ],
+                )
+            if segmentation_object.get_traces(name="deconvolved") is not None:
+                image_mask_csc = csc_matrix(
+                    segmentation_object.get_traces(name="deconvolved")
+                )
+                main.create_dataset("extractedPeaks/data", data=image_mask_csc.data)
+                main.create_dataset("extractedPeaks/ir", data=image_mask_csc.indices)
+                main.create_dataset("extractedPeaks/jc", data=image_mask_csc.indptr)
             if segmentation_object.get_image() is not None:
-                main.create_dataset('Cn', data=segmentation_object.get_image())
-            inputoptions = main.create_group('inputOptions')
+                main.create_dataset("Cn", data=segmentation_object.get_image())
+            inputoptions = main.create_group("inputOptions")
             if segmentation_object.get_sampling_frequency() is not None:
-                inputoptions.create_dataset('Fs', data=segmentation_object.get_sampling_frequency())
+                inputoptions.create_dataset(
+                    "Fs", data=segmentation_object.get_sampling_frequency()
+                )
 
     # defining the abstract class enformed methods:
     def get_roi_ids(self):
diff --git a/roiextractors/extractors/schnitzerextractor/extractsegmentationextractor.py b/roiextractors/extractors/schnitzerextractor/extractsegmentationextractor.py
index c36840de..e5a8e3f7 100644
--- a/roiextractors/extractors/schnitzerextractor/extractsegmentationextractor.py
+++ b/roiextractors/extractors/schnitzerextractor/extractsegmentationextractor.py
@@ -21,10 +21,11 @@ class ExtractSegmentationExtractor(SegmentationExtractor):
     its funtionality specifically applied to the dataset output from
     the \'EXTRACT\' ROI segmentation method.
     """
-    extractor_name = 'ExtractSegmentation'
+
+    extractor_name = "ExtractSegmentation"
     installed = HAVE_H5PY  # check at class level if installed or not
     is_writable = False
-    mode = 'file'
+    mode = "file"
     installation_mesg = "To use extract install h5py: \n\n pip install h5py \n\n"  # error message when not installed
 
     def __init__(self, file_path: PathType):
@@ -40,36 +41,43 @@ def __init__(self, file_path: PathType):
         self._image_masks = self._image_mask_extractor_read()
         self._roi_response_raw = self._trace_extractor_read()
         self._raw_movie_file_location = self._raw_datafile_read()
-        self._sampling_frequency = self._roi_response_raw.shape[1]/self._tot_exptime_extractor_read()
+        self._sampling_frequency = (
+            self._roi_response_raw.shape[1] / self._tot_exptime_extractor_read()
+        )
         self._image_correlation = self._summary_image_read()
 
     def __del__(self):
         self._dataset_file.close()
 
     def _file_extractor_read(self):
-        f = h5py.File(self.file_path, 'r')
+        f = h5py.File(self.file_path, "r")
         _group0_temp = list(f.keys())
-        _group0 = [a for a in _group0_temp if '#' not in a]
+        _group0 = [a for a in _group0_temp if "#" not in a]
         return f, _group0
 
     def _image_mask_extractor_read(self):
-        return DatasetView(self._dataset_file[self._group0[0]]['filters']).lazy_transpose([1, 2, 0])
+        return DatasetView(
+            self._dataset_file[self._group0[0]]["filters"]
+        ).lazy_transpose([1, 2, 0])
 
     def _trace_extractor_read(self):
-        extracted_signals = DatasetView(self._dataset_file[self._group0[0]]['traces'])
+        extracted_signals = DatasetView(self._dataset_file[self._group0[0]]["traces"])
         return extracted_signals.T
 
     def _tot_exptime_extractor_read(self):
-        return self._dataset_file[self._group0[0]]['time']['totalTime'][0][0]
+        return self._dataset_file[self._group0[0]]["time"]["totalTime"][0][0]
 
     def _summary_image_read(self):
-        summary_image = self._dataset_file[self._group0[0]]['info']['summary_image']
+        summary_image = self._dataset_file[self._group0[0]]["info"]["summary_image"]
         return np.array(summary_image)
 
     def _raw_datafile_read(self):
-        if self._dataset_file[self._group0[0]].get('file'):
-            charlist = [chr(i) for i in np.squeeze(self._dataset_file[self._group0[0]]['file'][:])]
-            return ''.join(charlist)
+        if self._dataset_file[self._group0[0]].get("file"):
+            charlist = [
+                chr(i)
+                for i in np.squeeze(self._dataset_file[self._group0[0]]["file"][:])
+            ]
+            return "".join(charlist)
 
     def get_accepted_list(self):
         return list(range(self.get_num_rois()))
@@ -79,12 +87,16 @@ def get_rejected_list(self):
         return [a for a in range(self.get_num_rois()) if a not in ac_set]
 
     @staticmethod
-    def write_segmentation(segmentation_object: SegmentationExtractor, save_path, overwrite=True):
+    def write_segmentation(
+        segmentation_object: SegmentationExtractor, save_path, overwrite=True
+    ):
         save_path = Path(save_path)
-        assert save_path.suffix == '.mat', "'save_path' must be a *.mat file"
+        assert save_path.suffix == ".mat", "'save_path' must be a *.mat file"
         if save_path.is_file():
             if not overwrite:
-                raise FileExistsError("The specified path exists! Use overwrite=True to overwrite it.")
+                raise FileExistsError(
+                    "The specified path exists! Use overwrite=True to overwrite it."
+                )
             else:
                 save_path.unlink()
 
@@ -93,28 +105,43 @@ def write_segmentation(segmentation_object: SegmentationExtractor, save_path, ov
         if isinstance(segmentation_object, MultiSegmentationExtractor):
             segext_objs = segmentation_object.segmentations
             for plane_num, segext_obj in enumerate(segext_objs):
-                save_path_plane = folder_path/f'Plane_{plane_num}'/file_name
-                ExtractSegmentationExtractor.write_segmentation(segext_obj, save_path_plane)
+                save_path_plane = folder_path / f"Plane_{plane_num}" / file_name
+                ExtractSegmentationExtractor.write_segmentation(
+                    segext_obj, save_path_plane
+                )
         if not folder_path.is_dir():
             folder_path.mkdir(parents=True)
 
-        with h5py.File(save_path, 'a') as f:
+        with h5py.File(save_path, "a") as f:
             # create base groups:
-            _ = f.create_group('#refs#')
-            main = f.create_group('extractAnalysisOutput')
+            _ = f.create_group("#refs#")
+            main = f.create_group("extractAnalysisOutput")
             # create datasets:
-            main.create_dataset('filters', data=segmentation_object.get_roi_image_masks().T)
-            main.create_dataset('traces', data=segmentation_object.get_traces())
-            if getattr(segmentation_object, '_raw_movie_file_location', None):
-                main.create_dataset('file',
-                                    data=[ord(alph) for alph in str(segmentation_object._raw_movie_file_location)])
-            info = main.create_group('info')
+            main.create_dataset(
+                "filters", data=segmentation_object.get_roi_image_masks().T
+            )
+            main.create_dataset("traces", data=segmentation_object.get_traces())
+            if getattr(segmentation_object, "_raw_movie_file_location", None):
+                main.create_dataset(
+                    "file",
+                    data=[
+                        ord(alph)
+                        for alph in str(segmentation_object._raw_movie_file_location)
+                    ],
+                )
+            info = main.create_group("info")
             if segmentation_object.get_image() is not None:
-                info.create_dataset('summary_image', data=segmentation_object.get_image())
-            time = main.create_group('time')
+                info.create_dataset(
+                    "summary_image", data=segmentation_object.get_image()
+                )
+            time = main.create_group("time")
             if segmentation_object.get_sampling_frequency() is not None:
-                time.create_dataset('totalTime', (1, 1), data=segmentation_object.get_roi_image_masks().shape[1]/
-                                                              segmentation_object.get_sampling_frequency())
+                time.create_dataset(
+                    "totalTime",
+                    (1, 1),
+                    data=segmentation_object.get_roi_image_masks().shape[1]
+                    / segmentation_object.get_sampling_frequency(),
+                )
 
     # defining the abstract class informed methods:
     def get_roi_ids(self):
diff --git a/roiextractors/extractors/simaextractor/__init__.py b/roiextractors/extractors/simaextractor/__init__.py
index 638dce54..a42c6d42 100644
--- a/roiextractors/extractors/simaextractor/__init__.py
+++ b/roiextractors/extractors/simaextractor/__init__.py
@@ -1,1 +1,1 @@
-from .simasegmentationextractor import SimaSegmentationExtractor
\ No newline at end of file
+from .simasegmentationextractor import SimaSegmentationExtractor
diff --git a/roiextractors/extractors/simaextractor/simasegmentationextractor.py b/roiextractors/extractors/simaextractor/simasegmentationextractor.py
index d36b3a16..1dcba81b 100644
--- a/roiextractors/extractors/simaextractor/simasegmentationextractor.py
+++ b/roiextractors/extractors/simaextractor/simasegmentationextractor.py
@@ -23,13 +23,15 @@ class SimaSegmentationExtractor(SegmentationExtractor):
     its functionality specifically applied to the dataset output from
     the \'SIMA\' ROI segmentation method.
     """
-    extractor_name = 'SimaSegmentation'
+
+    extractor_name = "SimaSegmentation"
     installed = HAVE_SIMA  # check at class level if installed or not
     is_writable = False
-    mode = 'file'
-    installation_mesg = "To use the SimaSegmentationExtractor install sima and dill: \n\n pip install sima/dill\n\n"  # error message when not installed
+    mode = "file"
+    # error message when not installed
+    installation_mesg = "To use the SimaSegmentationExtractor install sima and dill: \n\n pip install sima/dill\n\n"
 
-    def __init__(self, file_path: PathType, sima_segmentation_label: str = 'auto_ROIs'):
+    def __init__(self, file_path: PathType, sima_segmentation_label: str = "auto_ROIs"):
         """
         Parameters
         ----------
@@ -67,20 +69,22 @@ def _convert_sima(old_pkl_loc):
             Path of the pickle file to be converted
         """
         # Make a name for the new pickle
-        old_pkl_loc = old_pkl_loc + '/'
+        old_pkl_loc = old_pkl_loc + "/"
         for dirpath, dirnames, filenames in os.walk(old_pkl_loc):
-            _exit = [True for file in filenames if '_p2.pkl' in file]
+            _exit = [True for file in filenames if "_p2.pkl" in file]
             if True in _exit:
-                print('pickle already in Py3 format')
+                print("pickle already in Py3 format")
                 continue
             for file in filenames:
-                if '.pkl' in file:
+                if ".pkl" in file:
                     old_pkl = os.path.join(dirpath, file)
                     print(old_pkl)
                     # Make a name for the new pickle
-                    new_pkl_name = os.path.splitext(os.path.basename(old_pkl))[0] + "_p2.pkl"
+                    new_pkl_name = (
+                        os.path.splitext(os.path.basename(old_pkl))[0] + "_p2.pkl"
+                    )
                     base_directory = os.path.split(old_pkl)[0]
-                    new_pkl = base_directory + '/' + new_pkl_name
+                    new_pkl = base_directory + "/" + new_pkl_name
                     # Convert Python 2 "ObjectType" to Python 3 object
                     dill._dill._reverse_typemap["ObjectType"] = object
 
@@ -104,13 +108,16 @@ def _image_mask_extractor_read(self):
             if self.sima_segmentation_label in list(_sima_rois.keys()):
                 _sima_rois_data = _sima_rois[self.sima_segmentation_label]
             else:
-                raise Exception('Enter a valid name of ROIs from: {}'.format(
-                    ','.join(list(_sima_rois.keys()))))
+                raise Exception(
+                    "Enter a valid name of ROIs from: {}".format(
+                        ",".join(list(_sima_rois.keys()))
+                    )
+                )
         elif len(_sima_rois) == 1:
             _sima_rois_data = list(_sima_rois.values())[0]
             self.sima_segmentation_label = list(_sima_rois.keys())[0]
         else:
-            raise Exception('no ROIs found in the sima file')
+            raise Exception("no ROIs found in the sima file")
         image_masks_ = [np.squeeze(np.array(roi_dat)).T for roi_dat in _sima_rois_data]
         return np.array(image_masks_).T
 
@@ -120,22 +127,26 @@ def _trace_extractor_read(self):
                 if labels:
                     _active_channel = channel_now
                     break
-            print('extracting signal from channel {} from {} no of channels'.
-                  format(_active_channel, self._num_of_channels))
+            print(
+                "extracting signal from channel {} from {} no of channels".format(
+                    _active_channel, self._num_of_channels
+                )
+            )
         # label for the extraction method in SIMA:
         for labels in self._dataset_file.signals(channel=_active_channel):
             _count = 0
-            if not re.findall(r'[\d]{4}-[\d]{2}-[\d]{2}-', labels):
+            if not re.findall(r"[\d]{4}-[\d]{2}-[\d]{2}-", labels):
                 _count = _count + 1
                 _label = labels
                 break
         if _count > 1:
-            print('multiple labels found for extract method using {}'.format(_label))
+            print("multiple labels found for extract method using {}".format(_label))
         elif _count == 0:
-            print('no label found for extract method using {}'.format(labels))
+            print("no label found for extract method using {}".format(labels))
             _label = labels
-        extracted_signals = np.array(self._dataset_file.signals(
-            channel=_active_channel)[_label]['raw'][0])
+        extracted_signals = np.array(
+            self._dataset_file.signals(channel=_active_channel)[_label]["raw"][0]
+        )
         return extracted_signals
 
     def _summary_image_read(self):
@@ -146,7 +157,11 @@ def get_accepted_list(self):
         return list(range(self.get_num_rois()))
 
     def get_rejected_list(self):
-        return [a for a in range(self.get_num_rois()) if a not in set(self.get_accepted_list())]
+        return [
+            a
+            for a in range(self.get_num_rois())
+            if a not in set(self.get_accepted_list())
+        ]
 
     @staticmethod
     def write_segmentation(segmentation_object, savepath):
diff --git a/roiextractors/extractors/suite2p/__init__.py b/roiextractors/extractors/suite2p/__init__.py
index 6718dfe4..f3ba893f 100644
--- a/roiextractors/extractors/suite2p/__init__.py
+++ b/roiextractors/extractors/suite2p/__init__.py
@@ -1,1 +1,1 @@
-from .suite2psegmentationextractor import *
\ No newline at end of file
+from .suite2psegmentationextractor import Suite2pSegmentationExtractor
diff --git a/roiextractors/extractors/suite2p/suite2psegmentationextractor.py b/roiextractors/extractors/suite2p/suite2psegmentationextractor.py
index 3baeb8a6..416a11f8 100644
--- a/roiextractors/extractors/suite2p/suite2psegmentationextractor.py
+++ b/roiextractors/extractors/suite2p/suite2psegmentationextractor.py
@@ -11,13 +11,15 @@
 
 
 class Suite2pSegmentationExtractor(SegmentationExtractor):
-    extractor_name = 'Suite2pSegmentationExtractor'
+    extractor_name = "Suite2pSegmentationExtractor"
     installed = True  # check at class level if installed or not
     is_writable = False
-    mode = 'file'
+    mode = "file"
     installation_mesg = ""  # error message when not installed
 
-    def __init__(self, file_path: PathType, combined: bool = False, plane_no: IntType = 0):
+    def __init__(
+        self, file_path: PathType, combined: bool = False, plane_no: IntType = 0
+    ):
         """
         Creating SegmentationExtractor object out of suite 2p data type.
         Parameters
@@ -33,20 +35,22 @@ def __init__(self, file_path: PathType, combined: bool = False, plane_no: IntTyp
         self.combined = combined
         self.plane_no = plane_no
         self.file_path = file_path
-        self.stat = self._load_npy('stat.npy')
-        self._roi_response_raw = self._load_npy('F.npy', mmap_mode='r')
-        self._roi_response_neuropil = self._load_npy('Fneu.npy', mmap_mode='r')
-        self._roi_response_deconvolved = self._load_npy('spks.npy', mmap_mode='r')
-        self.iscell = self._load_npy('iscell.npy', mmap_mode='r')
-        self.ops = self._load_npy('ops.npy').item()
-        self._channel_names = [f'OpticalChannel{i}' for i in range(self.ops['nchannels'])]
-        self._sampling_frequency = self.ops['fs'] * [2 if self.combined else 1][0]
-        self._raw_movie_file_location = self.ops.get('filelist',[None])[0]
-        self._image_correlation = self._summary_image_read('Vcorr')
-        self._image_mean = self._summary_image_read('meanImg')
+        self.stat = self._load_npy("stat.npy")
+        self._roi_response_raw = self._load_npy("F.npy", mmap_mode="r")
+        self._roi_response_neuropil = self._load_npy("Fneu.npy", mmap_mode="r")
+        self._roi_response_deconvolved = self._load_npy("spks.npy", mmap_mode="r")
+        self.iscell = self._load_npy("iscell.npy", mmap_mode="r")
+        self.ops = self._load_npy("ops.npy").item()
+        self._channel_names = [
+            f"OpticalChannel{i}" for i in range(self.ops["nchannels"])
+        ]
+        self._sampling_frequency = self.ops["fs"] * [2 if self.combined else 1][0]
+        self._raw_movie_file_location = self.ops.get("filelist", [None])[0]
+        self._image_correlation = self._summary_image_read("Vcorr")
+        self._image_mean = self._summary_image_read("meanImg")
 
     def _load_npy(self, filename, mmap_mode=None):
-        fpath = os.path.join(self.file_path, f'plane{self.plane_no}', filename)
+        fpath = os.path.join(self.file_path, f"plane{self.plane_no}", filename)
         return np.load(fpath, mmap_mode=mmap_mode, allow_pickle=mmap_mode is None)
 
     def get_accepted_list(self):
@@ -55,76 +59,99 @@ def get_accepted_list(self):
     def get_rejected_list(self):
         return list(np.where(self.iscell[:, 0] == 0)[0])
 
-    def _summary_image_read(self, bstr='meanImg'):
+    def _summary_image_read(self, bstr="meanImg"):
         img = None
         if bstr in self.ops:
-            if bstr == 'Vcorr' or bstr == 'max_proj':
-                img = np.zeros((self.ops['Ly'], self.ops['Lx']), np.float32)
-                img[(self.ops['Ly']-self.ops['yrange'][-1]):(self.ops['Ly']-self.ops['yrange'][0]),
-                self.ops['xrange'][0]:self.ops['xrange'][-1]] = self.ops[bstr]
+            if bstr == "Vcorr" or bstr == "max_proj":
+                img = np.zeros((self.ops["Ly"], self.ops["Lx"]), np.float32)
+                img[
+                    (self.ops["Ly"] - self.ops["yrange"][-1]): (
+                        self.ops["Ly"] - self.ops["yrange"][0]
+                    ),
+                    self.ops["xrange"][0]: self.ops["xrange"][-1],
+                ] = self.ops[bstr]
             else:
                 img = self.ops[bstr]
         return img
 
     @property
     def roi_locations(self):
-        return np.array([j['med'] for j in self.stat]).T.astype(int)
+        return np.array([j["med"] for j in self.stat]).T.astype(int)
 
     @staticmethod
-    def write_segmentation(segmentation_object: SegmentationExtractor, save_path, overwrite=True):
+    def write_segmentation(
+        segmentation_object: SegmentationExtractor, save_path, overwrite=True
+    ):
         save_path = Path(save_path)
         assert not save_path.is_file(), "'save_path' must be a folder"
         if save_path.is_dir():
-            if len(list(save_path.glob('*'))) > 0 and not overwrite:
-                raise FileExistsError("The specified folder is not empty! Use overwrite=True to overwrite it.")
+            if len(list(save_path.glob("*"))) > 0 and not overwrite:
+                raise FileExistsError(
+                    "The specified folder is not empty! Use overwrite=True to overwrite it."
+                )
             else:
                 shutil.rmtree(str(save_path))
         if isinstance(segmentation_object, MultiSegmentationExtractor):
             segext_objs = segmentation_object.segmentations
             for plane_num, segext_obj in enumerate(segext_objs):
-                save_path_plane = save_path / f'plane{plane_num}'
-                Suite2pSegmentationExtractor.write_segmentation(segext_obj, save_path_plane)
+                save_path_plane = save_path / f"plane{plane_num}"
+                Suite2pSegmentationExtractor.write_segmentation(
+                    segext_obj, save_path_plane
+                )
         if not save_path.is_dir():
             save_path.mkdir(parents=True)
-        if 'plane' not in save_path.stem:
-            save_path = save_path/'plane0'
+        if "plane" not in save_path.stem:
+            save_path = save_path / "plane0"
 
         # saving traces:
-        if segmentation_object.get_traces(name='raw') is not None:
-            np.save(save_path / 'F.npy', segmentation_object.get_traces(name='raw'))
-        if segmentation_object.get_traces(name='neuropil') is not None:
-            np.save(save_path / 'Fneu.npy', segmentation_object.get_traces(name='neuropil'))
-        if segmentation_object.get_traces(name='deconvolved') is not None:
-            np.save(save_path / 'spks.npy', segmentation_object.get_traces(name='deconvolved'))
+        if segmentation_object.get_traces(name="raw") is not None:
+            np.save(save_path / "F.npy", segmentation_object.get_traces(name="raw"))
+        if segmentation_object.get_traces(name="neuropil") is not None:
+            np.save(
+                save_path / "Fneu.npy", segmentation_object.get_traces(name="neuropil")
+            )
+        if segmentation_object.get_traces(name="deconvolved") is not None:
+            np.save(
+                save_path / "spks.npy",
+                segmentation_object.get_traces(name="deconvolved"),
+            )
         # save stat
-        stat = np.zeros(segmentation_object.get_num_rois(), 'O')
+        stat = np.zeros(segmentation_object.get_num_rois(), "O")
         roi_locs = segmentation_object.roi_locations.T
-        pixel_masks = segmentation_object.get_roi_pixel_masks(roi_ids=range(segmentation_object.get_num_rois()))
+        pixel_masks = segmentation_object.get_roi_pixel_masks(
+            roi_ids=range(segmentation_object.get_num_rois())
+        )
         for no, i in enumerate(stat):
-            stat[no] = {'med': roi_locs[no, :].tolist(),
-                        'ypix': segmentation_object.get_image_size()[0]-1-pixel_masks[no][:, 0],
-                        'xpix': pixel_masks[no][:, 1],
-                        'lam': pixel_masks[no][:, 2]}
-        np.save(save_path / 'stat.npy', stat)
+            stat[no] = {
+                "med": roi_locs[no, :].tolist(),
+                "ypix": segmentation_object.get_image_size()[0]
+                - 1
+                - pixel_masks[no][:, 0],
+                "xpix": pixel_masks[no][:, 1],
+                "lam": pixel_masks[no][:, 2],
+            }
+        np.save(save_path / "stat.npy", stat)
         # saving iscell
         iscell = np.ones([segmentation_object.get_num_rois(), 2])
         iscell[segmentation_object.get_rejected_list(), 0] = 0
-        np.save(save_path / 'iscell.npy', iscell)
+        np.save(save_path / "iscell.npy", iscell)
         # saving ops
-        ops = dict(nframes=segmentation_object.get_num_frames(),
-                   Lx=segmentation_object.get_image_size()[1],
-                   Ly=segmentation_object.get_image_size()[0],
-                   xrange=[0, segmentation_object.get_image_size()[1]],
-                   yrange=[0, segmentation_object.get_image_size()[0]],
-                   fs=segmentation_object.get_sampling_frequency(),
-                   nchannels=1,
-                   meanImg=segmentation_object.get_image('mean'),
-                   Vcorr=segmentation_object.get_image('correlation'))
-        if getattr(segmentation_object, '_raw_movie_file_location', None):
+        ops = dict(
+            nframes=segmentation_object.get_num_frames(),
+            Lx=segmentation_object.get_image_size()[1],
+            Ly=segmentation_object.get_image_size()[0],
+            xrange=[0, segmentation_object.get_image_size()[1]],
+            yrange=[0, segmentation_object.get_image_size()[0]],
+            fs=segmentation_object.get_sampling_frequency(),
+            nchannels=1,
+            meanImg=segmentation_object.get_image("mean"),
+            Vcorr=segmentation_object.get_image("correlation"),
+        )
+        if getattr(segmentation_object, "_raw_movie_file_location", None):
             ops.update(dict(filelist=[segmentation_object._raw_movie_file_location]))
         else:
             ops.update(dict(filelist=[None]))
-        np.save(save_path / 'ops.npy', ops)
+        np.save(save_path / "ops.npy", ops)
 
     # defining the abstract class enforced methods:
     def get_roi_ids(self):
@@ -137,15 +164,24 @@ def get_roi_image_masks(self, roi_ids=None):
             roi_idx = [np.where(np.array(i) == self.get_roi_ids())[0] for i in roi_ids]
             ele = [i for i, j in enumerate(roi_idx) if j.size == 0]
             roi_idx_ = [j[0] for i, j in enumerate(roi_idx) if i not in ele]
-        return _image_mask_extractor(self.get_roi_pixel_masks(roi_ids=roi_idx_), list(range(len(roi_idx_))),
-                                     self.get_image_size())
+        return _image_mask_extractor(
+            self.get_roi_pixel_masks(roi_ids=roi_idx_),
+            list(range(len(roi_idx_))),
+            self.get_image_size(),
+        )
 
     def get_roi_pixel_masks(self, roi_ids=None):
         pixel_mask = []
         for i in range(self.get_num_rois()):
-            pixel_mask.append(np.vstack([self.ops['Ly']-1-self.stat[i]['ypix'],
-                                         self.stat[i]['xpix'],
-                                         self.stat[i]['lam']]).T)
+            pixel_mask.append(
+                np.vstack(
+                    [
+                        self.ops["Ly"] - 1 - self.stat[i]["ypix"],
+                        self.stat[i]["xpix"],
+                        self.stat[i]["lam"],
+                    ]
+                ).T
+            )
         if roi_ids is None:
             roi_idx_ = range(self.get_num_rois())
         else:
@@ -155,4 +191,4 @@ def get_roi_pixel_masks(self, roi_ids=None):
         return [pixel_mask[i] for i in roi_idx_]
 
     def get_image_size(self):
-        return [self.ops['Ly'], self.ops['Lx']]
+        return [self.ops["Ly"], self.ops["Lx"]]
diff --git a/roiextractors/extractors/tiffimagingextractor/tiffimagingextractor.py b/roiextractors/extractors/tiffimagingextractor/tiffimagingextractor.py
index 796fdad5..587b0616 100644
--- a/roiextractors/extractors/tiffimagingextractor/tiffimagingextractor.py
+++ b/roiextractors/extractors/tiffimagingextractor/tiffimagingextractor.py
@@ -3,7 +3,13 @@
 import numpy as np
 from tqdm import tqdm
 
-from ...extraction_tools import PathType, get_video_shape, check_get_frames_args, FloatType, ArrayType
+from ...extraction_tools import (
+    PathType,
+    get_video_shape,
+    check_get_frames_args,
+    FloatType,
+    ArrayType,
+)
 from ...imagingextractor import ImagingExtractor
 
 try:
@@ -15,40 +21,53 @@
 
 
 class TiffImagingExtractor(ImagingExtractor):
-    extractor_name = 'TiffImaging'
+    extractor_name = "TiffImaging"
     installed = HAVE_TIFF  # check at class level if installed or not
     is_writable = True
-    mode = 'file'
-    installation_mesg = "To use the TiffImagingExtractor install tifffile: \n\n pip install tifffile\n\n"  # error message when not installed
-
-    def __init__(self, file_path: PathType, sampling_frequency: FloatType,
-                 channel_names: ArrayType = None):
+    mode = "file"
+    installation_mesg = "To use the TiffImagingExtractor install tifffile: \n\n pip install tifffile\n\n"
+
+    def __init__(
+        self,
+        file_path: PathType,
+        sampling_frequency: FloatType,
+        channel_names: ArrayType = None,
+    ):
         assert HAVE_TIFF, self.installation_mesg
         ImagingExtractor.__init__(self)
         self.file_path = Path(file_path)
         self._sampling_frequency = sampling_frequency
         self._channel_names = channel_names
-        assert self.file_path.suffix in ['.tiff', '.tif', '.TIFF', '.TIF']
+        assert self.file_path.suffix in [".tiff", ".tif", ".TIFF", ".TIF"]
 
         with tifffile.TiffFile(self.file_path) as tif:
             self._num_channels = len(tif.series)
 
         # deal with multiple channels
-        self._video = tifffile.memmap(self.file_path, mode='r')
-        self._num_channels, self._num_frames, self._size_x, self._size_y = get_video_shape(self._video)
+        self._video = tifffile.memmap(self.file_path, mode="r")
+        (
+            self._num_channels,
+            self._num_frames,
+            self._size_x,
+            self._size_y,
+        ) = get_video_shape(self._video)
 
         if len(self._video.shape) == 3:
             # check if this converts to np.ndarray
             self._video = self._video[np.newaxis, :]
 
         if self._channel_names is not None:
-            assert len(self._channel_names) == self._num_channels, "'channel_names' length is different than number " \
-                                                                   "of channels"
+            assert len(self._channel_names) == self._num_channels, (
+                "'channel_names' length is different than number " "of channels"
+            )
         else:
-            self._channel_names = [f'channel_{ch}' for ch in range(self._num_channels)]
+            self._channel_names = [f"channel_{ch}" for ch in range(self._num_channels)]
 
-        self._kwargs = {'file_path': str(Path(file_path).absolute()),
-                        'sampling_frequency': sampling_frequency, 'channel_names': channel_names}
+        self._kwargs = {
+            "file_path": str(Path(file_path).absolute()),
+            "sampling_frequency": sampling_frequency,
+            "channel_names": channel_names,
+        }
 
     @check_get_frames_args
     def get_frames(self, frame_idxs, channel=0):
@@ -84,13 +103,22 @@ def get_num_channels(self):
         return self._num_channels
 
     @staticmethod
-    def write_imaging(imaging, save_path, overwrite: bool = False, chunk_size=None, verbose=True):
+    def write_imaging(
+        imaging, save_path, overwrite: bool = False, chunk_size=None, verbose=True
+    ):
         save_path = Path(save_path)
-        assert save_path.suffix in ['.tiff', '.tif', '.TIFF', '.TIF'], "'save_path' file is not an .tiff file"
+        assert save_path.suffix in [
+            ".tiff",
+            ".tif",
+            ".TIFF",
+            ".TIF",
+        ], "'save_path' file is not an .tiff file"
 
         if save_path.is_file():
             if not overwrite:
-                raise FileExistsError("The specified path exists! Use overwrite=True to overwrite it.")
+                raise FileExistsError(
+                    "The specified path exists! Use overwrite=True to overwrite it."
+                )
             else:
                 save_path.unlink()
 
@@ -108,7 +136,9 @@ def write_imaging(imaging, save_path, overwrite: bool = False, chunk_size=None,
                 chunks = range(n_chunk)
             with tifffile.TiffWriter(save_path) as tif:
                 for i in chunks:
-                    video = imaging.get_video(start_frame=i * chunk_size,
-                                              end_frame=min((i + 1) * chunk_size, num_frames))
+                    video = imaging.get_video(
+                        start_frame=i * chunk_size,
+                        end_frame=min((i + 1) * chunk_size, num_frames),
+                    )
                     chunk_frames = np.squeeze(video)
                     tif.save(chunk_frames, contiguous=True, metadata=None)
diff --git a/roiextractors/imagingextractor.py b/roiextractors/imagingextractor.py
index f2503b46..9b4bb541 100644
--- a/roiextractors/imagingextractor.py
+++ b/roiextractors/imagingextractor.py
@@ -2,12 +2,20 @@
 
 from spikeextractors.baseextractor import BaseExtractor
 
-from .extraction_tools import ArrayType, PathType, NumpyArray, DtypeType, IntType, FloatType, check_get_videos_args
+from .extraction_tools import (
+    ArrayType,
+    PathType,
+    NumpyArray,
+    DtypeType,
+    IntType,
+    FloatType,
+    check_get_videos_args,
+)
 
 
 class ImagingExtractor(ABC, BaseExtractor):
     """An abstract class that contains all the meta-data and input data from
-       the imaging data.
+    the imaging data.
     """
 
     def __init__(self):
@@ -57,11 +65,13 @@ def get_dtype(self) -> DtypeType:
         return self.get_frames(0, 0).dtype
 
     @check_get_videos_args
-    def get_video(self, start_frame: int = None, end_frame: int = None, channel: int = 0) -> NumpyArray:
+    def get_video(
+        self, start_frame: int = None, end_frame: int = None, channel: int = 0
+    ) -> NumpyArray:
         return self.get_frames(range(start_frame, end_frame), channel)
 
     def frame_to_time(self, frame: IntType):
-        '''This function converts a user-inputted frame index to a time with units of seconds.
+        """This function converts a user-inputted frame index to a time with units of seconds.
 
         Parameters
         ----------
@@ -72,12 +82,12 @@ def frame_to_time(self, frame: IntType):
         -------
         time: float
             The corresponding time in seconds
-        '''
+        """
         # Default implementation
         return frame / self.get_sampling_frequency()
 
     def time_to_frame(self, time: FloatType):
-        '''This function converts a user-inputted time (in seconds) to a frame index.
+        """This function converts a user-inputted time (in seconds) to a frame index.
 
         Parameters
         -------
@@ -88,7 +98,7 @@ def time_to_frame(self, time: FloatType):
         -------
         frame: float
             The corresponding frame index
-        '''
+        """
         # Default implementation
         return time * self.get_sampling_frequency()
 
diff --git a/roiextractors/memmapextractors.py b/roiextractors/memmapextractors.py
index ac9ec8fb..2bc5cd7a 100644
--- a/roiextractors/memmapextractors.py
+++ b/roiextractors/memmapextractors.py
@@ -11,19 +11,25 @@
 
 
 class MemmapImagingExtractor(ImagingExtractor):
-    def __init__(self, imaging_extractor: ImagingExtractor, save_path: PathType = None,
-                 verbose: bool = False):
+    def __init__(
+        self,
+        imaging_extractor: ImagingExtractor,
+        save_path: PathType = None,
+        verbose: bool = False,
+    ):
         ImagingExtractor.__init__(self)
         self.imaging = imaging_extractor
         tmp_folder = self.get_tmp_folder()
 
         if save_path is None:
             self._is_tmp = True
-            self._tmp_file = tempfile.NamedTemporaryFile(suffix=".dat", dir=tmp_folder).name
+            self._tmp_file = tempfile.NamedTemporaryFile(
+                suffix=".dat", dir=tmp_folder
+            ).name
         else:
             save_path = Path(save_path)
-            if save_path.suffix != '.dat' and save_path.suffix != '.bin':
-                save_path = save_path.with_suffix('.dat')
+            if save_path.suffix != ".dat" and save_path.suffix != ".bin":
+                save_path = save_path.with_suffix(".dat")
             if not save_path.parent.is_dir():
                 os.makedirs(save_path.parent)
             self._is_tmp = False
@@ -41,11 +47,17 @@ def __del__(self):
 
     def _save_memmap_video(self, verbose=False):
         save_path = Path(self._tmp_file)
-        self._video = np.memmap(save_path, shape=(self.imaging.get_num_channels(),
-                                                  self.imaging.get_num_frames(),
-                                                  self.imaging.get_image_size()[0],
-                                                  self.imaging.get_image_size()[1]),
-                                dtype=self.imaging.get_dtype(), mode='w+')
+        self._video = np.memmap(
+            save_path,
+            shape=(
+                self.imaging.get_num_channels(),
+                self.imaging.get_num_frames(),
+                self.imaging.get_image_size()[0],
+                self.imaging.get_image_size()[1],
+            ),
+            dtype=self.imaging.get_dtype(),
+            mode="w+",
+        )
 
         if verbose:
             for ch in range(self.imaging.get_num_channels()):
@@ -65,17 +77,23 @@ def filename(self):
 
     def move_to(self, save_path):
         save_path = Path(save_path)
-        if save_path.suffix != '.dat' and save_path.suffix != '.bin':
-            save_path = save_path.with_suffix('.dat')
+        if save_path.suffix != ".dat" and save_path.suffix != ".bin":
+            save_path = save_path.with_suffix(".dat")
         if not save_path.parent.is_dir():
             os.makedirs(save_path.parent)
         shutil.move(self._tmp_file, str(save_path))
         self._tmp_file = str(save_path)
-        self._video = np.memmap(save_path, shape=(self.imaging.get_num_channels(),
-                                                  self.imaging.get_num_frames(),
-                                                  self.imaging.get_image_size()[0],
-                                                  self.imaging.get_image_size()[0]),
-                                dtype=self.imaging.get_dtype(), mode='r')
+        self._video = np.memmap(
+            save_path,
+            shape=(
+                self.imaging.get_num_channels(),
+                self.imaging.get_num_frames(),
+                self.imaging.get_image_size()[0],
+                self.imaging.get_image_size()[0],
+            ),
+            dtype=self.imaging.get_dtype(),
+            mode="r",
+        )
 
     @check_get_frames_args
     def get_frames(self, frame_idxs, channel=0):
diff --git a/roiextractors/multisegmentationextractor.py b/roiextractors/multisegmentationextractor.py
index 4b8a1da2..ab6fc88c 100644
--- a/roiextractors/multisegmentationextractor.py
+++ b/roiextractors/multisegmentationextractor.py
@@ -10,11 +10,19 @@ def _get_from_roi_map(self, roi_ids=None, **kwargs):
             roi_ids = np.array(self._all_roi_ids)
         else:
             roi_ids = np.array(roi_ids)
-        seg_id = np.array([self._roi_map[roi_id]['segmentation_id'] for roi_id in roi_ids])
-        roi_id_segmentation = np.array([self._roi_map[roi_id]['roi_id'] for roi_id in roi_ids])
+        seg_id = np.array(
+            [self._roi_map[roi_id]["segmentation_id"] for roi_id in roi_ids]
+        )
+        roi_id_segmentation = np.array(
+            [self._roi_map[roi_id]["roi_id"] for roi_id in roi_ids]
+        )
         for i in np.unique(seg_id):
             seg_roi_ids = roi_id_segmentation[seg_id == i]
-            out.append(getattr(self._segmentations[i], func.__name__)(roi_ids=seg_roi_ids, **kwargs))
+            out.append(
+                getattr(self._segmentations[i], func.__name__)(
+                    roi_ids=seg_roi_ids, **kwargs
+                )
+            )
         return func(self)(out)
 
     return _get_from_roi_map
@@ -25,10 +33,11 @@ class MultiSegmentationExtractor(SegmentationExtractor):
     This class is used to concatenate multi-plane recordings from the same device and session
     of experiment.
     """
-    extractor_name = 'MultiSegmentationExtractor'
+
+    extractor_name = "MultiSegmentationExtractor"
     installed = True  # check at class level if installed or not
     is_writable = False
-    mode = 'file'
+    mode = "file"
     installation_mesg = ""  # error message when not installed
 
     def __init__(self, segmentatation_extractors_list, plane_names=None):
@@ -42,16 +51,20 @@ def __init__(self, segmentatation_extractors_list, plane_names=None):
         """
         SegmentationExtractor.__init__(self)
         if not isinstance(segmentatation_extractors_list, list):
-            raise Exception('Enter a list of segmentation extractor objects as argument')
+            raise Exception(
+                "Enter a list of segmentation extractor objects as argument"
+            )
         self._no_planes = len(segmentatation_extractors_list)
         if plane_names:
             plane_names = list(plane_names)
             if len(plane_names) >= self._no_planes:
-                plane_names = plane_names[:self._no_planes]
+                plane_names = plane_names[: self._no_planes]
             else:
-                plane_names.extend([f'Plane{i}' for i in range(self._no_planes - len(plane_names))])
+                plane_names.extend(
+                    [f"Plane{i}" for i in range(self._no_planes - len(plane_names))]
+                )
         else:
-            plane_names = [f'Plane{i}' for i in range(self._no_planes)]
+            plane_names = [f"Plane{i}" for i in range(self._no_planes)]
         self._segmentations = segmentatation_extractors_list
         self._all_roi_ids = []
         self._roi_map = {}
@@ -61,13 +74,16 @@ def __init__(self, segmentatation_extractors_list, plane_names=None):
             roi_ids = segmentation.get_roi_ids()
             for roi_id in roi_ids:
                 self._all_roi_ids.append(s_id)
-                self._roi_map[s_id] = {'segmentation_id': s_i, 'roi_id': roi_id}
+                self._roi_map[s_id] = {"segmentation_id": s_i, "roi_id": roi_id}
                 s_id += 1
         self._plane_names = plane_names
         self._sampling_frequency = self._segmentations[0].get_sampling_frequency()
         self._raw_movie_file_location = self._segmentations[0]._raw_movie_file_location
         self._channel_names = []
-        _ = [self._channel_names.extend(self._segmentations[i].get_channel_names()) for i in range(self._no_planes)]
+        _ = [
+            self._channel_names.extend(self._segmentations[i].get_channel_names())
+            for i in range(self._no_planes)
+        ]
 
     @property
     def no_planes(self):
@@ -78,34 +94,38 @@ def segmentations(self):
         return self._segmentations
 
     def get_num_channels(self):
-        return np.sum([self._segmentations[i].get_num_channels() for i in range(self._no_planes)])
+        return np.sum(
+            [self._segmentations[i].get_num_channels() for i in range(self._no_planes)]
+        )
 
     def get_num_rois(self):
         return len(self._all_roi_ids)
 
-    def get_images(self, name='correlation_plane0'):
+    def get_images(self, name="correlation_plane0"):
         plane_no = int(name[-1])
-        return self._segmentations[plane_no].get_images(name=name.split('_')[0])
+        return self._segmentations[plane_no].get_images(name=name.split("_")[0])
 
     def get_images_dict(self):
         return_dict = dict()
         for i in range(self._no_planes):
             for image_name, image in self._segmentations[i].get_images_dict().items():
-                return_dict.update({f'{image_name}_Plane{i}': image})
+                return_dict.update({f"{image_name}_Plane{i}": image})
         return return_dict
 
     def get_traces_dict(self):
         return_dict = dict()
         for i in range(self._no_planes):
             for trace_name, trace in self._segmentations[i].get_traces_dict().items():
-                return_dict.update({f'{trace_name}_Plane{i}': trace})
+                return_dict.update({f"{trace_name}_Plane{i}": trace})
         return return_dict
 
     def get_image_size(self):
         return self._segmentations[0].get_image_size()
 
     @concatenate_output
-    def get_traces(self, roi_ids=None, start_frame=None, end_frame=None, name='Fluorescence'):
+    def get_traces(
+        self, roi_ids=None, start_frame=None, end_frame=None, name="Fluorescence"
+    ):
         return lambda x: np.concatenate(x, axis=0)
 
     @concatenate_output
@@ -124,14 +144,17 @@ def get_roi_locations(self, roi_ids=None):
         return lambda x: np.concatenate(x, axis=1)
 
     def get_num_frames(self):
-        return np.sum([self._segmentations[i].get_num_frames() for i in range(self._no_planes)])
+        return np.sum(
+            [self._segmentations[i].get_num_frames() for i in range(self._no_planes)]
+        )
 
     def get_accepted_list(self):
         accepted_list_all = []
         for i in range(self._no_planes):
             ids_loop = self._segmentations[i].get_accepted_list()
             accepted_list_all.extend(
-                [j for j in self._all_roi_ids if self._roi_map[j]['roi_id'] in ids_loop])
+                [j for j in self._all_roi_ids if self._roi_map[j]["roi_id"] in ids_loop]
+            )
         return accepted_list_all
 
     def get_rejected_list(self):
@@ -139,5 +162,6 @@ def get_rejected_list(self):
         for i in range(self._no_planes):
             ids_loop = self._segmentations[i].get_rejected_list()
             rejected_list_all.extend(
-                [j for j in self._all_roi_ids if self._roi_map[j]['roi_id'] in ids_loop])
+                [j for j in self._all_roi_ids if self._roi_map[j]["roi_id"] in ids_loop]
+            )
         return rejected_list_all
diff --git a/roiextractors/segmentationextractor.py b/roiextractors/segmentationextractor.py
index 2747a96b..205e1ca5 100644
--- a/roiextractors/segmentationextractor.py
+++ b/roiextractors/segmentationextractor.py
@@ -16,6 +16,7 @@ class SegmentationExtractor(ABC, BaseExtractor):
     All the methods with @abstract decorator have to be defined by the
     format specific classes that inherit from this.
     """
+
     installed = True
     installation_mesg = ""
 
@@ -23,7 +24,7 @@ def __init__(self):
         assert self.installed, self.installation_mesg
         BaseExtractor.__init__(self)
         self._sampling_frequency = None
-        self._channel_names = ['OpticalChannel']
+        self._channel_names = ["OpticalChannel"]
         self._num_planes = 1
         self._roi_response_raw = None
         self._roi_response_dff = None
@@ -90,7 +91,7 @@ def get_roi_locations(self, roi_ids=None) -> np.array:
         else:
             all_ids = self.get_roi_ids()
             roi_idx_ = [all_ids.index(i) for i in roi_ids]
-        roi_location = np.zeros([2, len(roi_idx_)], dtype='int')
+        roi_location = np.zeros([2, len(roi_idx_)], dtype="int")
         for c, i in enumerate(roi_idx_):
             image_mask = self.get_roi_image_masks(roi_ids=[i])
             temp = np.where(image_mask == np.amax(image_mask))
@@ -146,7 +147,9 @@ def get_roi_pixel_masks(self, roi_ids=None) -> np.array:
         """
         if roi_ids is None:
             return None
-        return _pixel_mask_extractor(self.get_roi_image_masks(roi_ids=roi_ids), range(len(roi_ids)))
+        return _pixel_mask_extractor(
+            self.get_roi_image_masks(roi_ids=roi_ids), range(len(roi_ids))
+        )
 
     @abstractmethod
     def get_image_size(self) -> ArrayType:
@@ -160,7 +163,7 @@ def get_image_size(self) -> ArrayType:
         """
         pass
 
-    def get_traces(self, roi_ids=None, start_frame=None, end_frame=None, name='raw'):
+    def get_traces(self, roi_ids=None, start_frame=None, end_frame=None, name="raw"):
         """
         Return RoiResponseSeries
         Returns
@@ -169,7 +172,9 @@ def get_traces(self, roi_ids=None, start_frame=None, end_frame=None, name='raw')
             2-D array (ROI x timepoints)
         """
         if name not in self.get_traces_dict():
-            raise ValueError(f'traces for {name} not found, enter one of {list(self.get_traces_dict().keys())}')
+            raise ValueError(
+                f"traces for {name} not found, enter one of {list(self.get_traces_dict().keys())}"
+            )
         if roi_ids is None:
             roi_idx_ = range(self.get_num_rois())
         else:
@@ -188,10 +193,12 @@ def get_traces_dict(self):
             dictionary with key, values representing different types of RoiResponseSeries
             Flourescence, Neuropil, Deconvolved, Background etc
         """
-        return dict(raw=self._roi_response_raw,
-                    dff=self._roi_response_dff,
-                    neuropil=self._roi_response_neuropil,
-                    deconvolved=self._roi_response_deconvolved)
+        return dict(
+            raw=self._roi_response_raw,
+            dff=self._roi_response_dff,
+            neuropil=self._roi_response_neuropil,
+            deconvolved=self._roi_response_deconvolved,
+        )
 
     def get_images_dict(self):
         """
@@ -202,10 +209,9 @@ def get_images_dict(self):
             dictionary with key, values representing different types of Images used in segmentation:
             Mean, Correlation image
         """
-        return dict(mean=self._image_mean,
-                    correlation=self._image_correlation)
+        return dict(mean=self._image_mean, correlation=self._image_correlation)
 
-    def get_image(self, name='correlation'):
+    def get_image(self, name="correlation"):
         """
         Return specific images: mean or correlation
         Parameters
@@ -217,7 +223,9 @@ def get_image(self, name='correlation'):
         images: np.ndarray
         """
         if name not in self.get_images_dict():
-            raise ValueError(f'could not find {name} image, enter one of {list(self.get_images_dict().keys())}')
+            raise ValueError(
+                f"could not find {name} image, enter one of {list(self.get_images_dict().keys())}"
+            )
         return self.get_images_dict().get(name)
 
     def get_sampling_frequency(self):
diff --git a/roiextractors/version.py b/roiextractors/version.py
index 2e20de5d..63fe8297 100644
--- a/roiextractors/version.py
+++ b/roiextractors/version.py
@@ -1,1 +1,1 @@
-version = '0.3.1'
+version = "0.3.1"
diff --git a/setup.py b/setup.py
index a424743b..b661e7a8 100644
--- a/setup.py
+++ b/setup.py
@@ -2,9 +2,9 @@
 
 d = {}
 exec(open("roiextractors/version.py").read(), None, d)
-version = d['version']
+version = d["version"]
 pkg_name = "roiextractors"
-with open('README.md') as rd:
+with open("README.md") as rd:
     long_description = rd.read()
 
 setup(
@@ -19,14 +19,14 @@
     packages=find_packages(),
     package_data={},
     install_requires=[
-        'spikeextractors',
-        'tqdm',
-        'lazy_ops',
+        "spikeextractors",
+        "tqdm",
+        "lazy_ops",
     ],
     classifiers=(
         "Programming Language :: Python :: 3",
         "License :: OSI Approved :: Apache Software License",
         "Operating System :: OS Independent",
-        "Intended Audience :: Science/Research"
-    )
+        "Intended Audience :: Science/Research",
+    ),
 )


Test patch:
diff --git a/roiextractors/testing.py b/roiextractors/testing.py
index e01a26bd..c8150be0 100644
--- a/roiextractors/testing.py
+++ b/roiextractors/testing.py
@@ -30,11 +30,15 @@ def _assert_iterable_element_dtypes(iterable, dtypes):
         for iter in iterable:
             _assert_iterable_element_dtypes(iter, dtypes)
     else:
-        assert isinstance(iterable, dtypes), f'array is none of the types {dtypes}'
+        assert isinstance(iterable, dtypes), f"array is none of the types {dtypes}"
 
 
-def _assert_iterable_complete(iterable, dtypes=None, element_dtypes=None, shape=None, shape_max=None):
-    assert isinstance(iterable, dtypes), f'iterable {type(iterable)} is none of the types {dtypes}'
+def _assert_iterable_complete(
+    iterable, dtypes=None, element_dtypes=None, shape=None, shape_max=None
+):
+    assert isinstance(
+        iterable, dtypes
+    ), f"iterable {type(iterable)} is none of the types {dtypes}"
     if not isinstance(iterable, NoneType):
         if shape is not None:
             _assert_iterable_shape(iterable, shape=shape)
@@ -54,10 +58,13 @@ def check_segmentations_equal(seg1: SegmentationExtractor, seg2: SegmentationExt
     assert seg1.get_sampling_frequency() == seg2.get_sampling_frequency()
     assert_array_equal(seg1.get_channel_names(), seg2.get_channel_names())
     assert_array_equal(seg1.get_image_size(), seg2.get_image_size())
-    assert_array_equal(seg1.get_roi_image_masks(roi_ids=seg1.get_roi_ids()[:1]),
-                       seg2.get_roi_image_masks(roi_ids=seg2.get_roi_ids()[:1]))
-    assert set(seg1.get_roi_pixel_masks(roi_ids=seg1.get_roi_ids()[:1])[0].flatten()) == \
-           set(seg2.get_roi_pixel_masks(roi_ids=seg1.get_roi_ids()[:1])[0].flatten())
+    assert_array_equal(
+        seg1.get_roi_image_masks(roi_ids=seg1.get_roi_ids()[:1]),
+        seg2.get_roi_image_masks(roi_ids=seg2.get_roi_ids()[:1]),
+    )
+    assert set(
+        seg1.get_roi_pixel_masks(roi_ids=seg1.get_roi_ids()[:1])[0].flatten()
+    ) == set(seg2.get_roi_pixel_masks(roi_ids=seg1.get_roi_ids()[:1])[0].flatten())
     assert_array_equal(seg1.get_image(), seg2.get_image())
     assert_array_equal(seg1.get_accepted_list(), seg2.get_accepted_list())
     assert_array_equal(seg1.get_rejected_list(), seg2.get_rejected_list())
@@ -76,51 +83,70 @@ def check_segmentation_return_types(seg: SegmentationExtractor):
     assert isinstance(seg.get_num_frames(), int)
     assert isinstance(seg.get_num_channels(), int)
     assert isinstance(seg.get_sampling_frequency(), (NoneType, floattype))
-    _assert_iterable_complete(seg.get_channel_names(),
-                              dtypes=list,
-                              element_dtypes=str,
-                              shape_max=(seg.get_num_channels(),))
-    _assert_iterable_complete(seg.get_image_size(),
-                              dtypes=Iterable,
-                              element_dtypes=inttype,
-                              shape=(2,))
-    _assert_iterable_complete(seg.get_roi_image_masks(roi_ids=seg.get_roi_ids()[:1]),
-                              dtypes=(np.ndarray,),
-                              element_dtypes=floattype,
-                              shape=(*seg.get_image_size(), 1))
-    _assert_iterable_complete(seg.get_roi_ids(),
-                              dtypes=(list,),
-                              shape=(seg.get_num_rois(),),
-                              element_dtypes=inttype)
+    _assert_iterable_complete(
+        seg.get_channel_names(),
+        dtypes=list,
+        element_dtypes=str,
+        shape_max=(seg.get_num_channels(),),
+    )
+    _assert_iterable_complete(
+        seg.get_image_size(), dtypes=Iterable, element_dtypes=inttype, shape=(2,)
+    )
+    _assert_iterable_complete(
+        seg.get_roi_image_masks(roi_ids=seg.get_roi_ids()[:1]),
+        dtypes=(np.ndarray,),
+        element_dtypes=floattype,
+        shape=(*seg.get_image_size(), 1),
+    )
+    _assert_iterable_complete(
+        seg.get_roi_ids(),
+        dtypes=(list,),
+        shape=(seg.get_num_rois(),),
+        element_dtypes=inttype,
+    )
     assert isinstance(seg.get_roi_pixel_masks(roi_ids=seg.get_roi_ids()[:2]), list)
-    _assert_iterable_complete(seg.get_roi_pixel_masks(roi_ids=seg.get_roi_ids()[:1])[0],
-                              dtypes=(np.ndarray,),
-                              element_dtypes=floattype,
-                              shape_max=(np.prod(seg.get_image_size()), 3))
-    _assert_iterable_complete(seg.get_image(),
-                              dtypes=(np.ndarray, NoneType),
-                              element_dtypes=floattype,
-                              shape_max=(*seg.get_image_size(),))
-    _assert_iterable_complete(seg.get_accepted_list(),
-                              dtypes=(list, NoneType),
-                              element_dtypes=inttype,
-                              shape_max=(seg.get_num_rois(),))
-    _assert_iterable_complete(seg.get_rejected_list(),
-                              dtypes=(list, NoneType),
-                              element_dtypes=inttype,
-                              shape_max=(seg.get_num_rois(),))
-    _assert_iterable_complete(seg.get_roi_locations(),
-                              dtypes=(np.ndarray,),
-                              shape=(2, seg.get_num_rois()),
-                              element_dtypes=inttype)
-    _assert_iterable_complete(seg.get_traces(),
-                              dtypes=(np.ndarray, NoneType),
-                              element_dtypes=floattype,
-                              shape=(np.prod(seg.get_num_rois()), None))
+    _assert_iterable_complete(
+        seg.get_roi_pixel_masks(roi_ids=seg.get_roi_ids()[:1])[0],
+        dtypes=(np.ndarray,),
+        element_dtypes=floattype,
+        shape_max=(np.prod(seg.get_image_size()), 3),
+    )
+    _assert_iterable_complete(
+        seg.get_image(),
+        dtypes=(np.ndarray, NoneType),
+        element_dtypes=floattype,
+        shape_max=(*seg.get_image_size(),),
+    )
+    _assert_iterable_complete(
+        seg.get_accepted_list(),
+        dtypes=(list, NoneType),
+        element_dtypes=inttype,
+        shape_max=(seg.get_num_rois(),),
+    )
+    _assert_iterable_complete(
+        seg.get_rejected_list(),
+        dtypes=(list, NoneType),
+        element_dtypes=inttype,
+        shape_max=(seg.get_num_rois(),),
+    )
+    _assert_iterable_complete(
+        seg.get_roi_locations(),
+        dtypes=(np.ndarray,),
+        shape=(2, seg.get_num_rois()),
+        element_dtypes=inttype,
+    )
+    _assert_iterable_complete(
+        seg.get_traces(),
+        dtypes=(np.ndarray, NoneType),
+        element_dtypes=floattype,
+        shape=(np.prod(seg.get_num_rois()), None),
+    )
     assert isinstance(seg.get_traces_dict(), dict)
     assert isinstance(seg.get_images_dict(), dict)
-    assert {'raw', 'dff', 'neuropil', 'deconvolved'} == set(seg.get_traces_dict().keys())
-    assert {'mean', 'correlation'} == set(seg.get_images_dict().keys())
+    assert {"raw", "dff", "neuropil", "deconvolved"} == set(
+        seg.get_traces_dict().keys()
+    )
+    assert {"mean", "correlation"} == set(seg.get_images_dict().keys())
 
 
 def check_imaging_equal(img1: ImagingExtractor, img2: ImagingExtractor):
@@ -132,8 +158,8 @@ def check_imaging_equal(img1: ImagingExtractor, img2: ImagingExtractor):
     assert img1.get_sampling_frequency() == img2.get_sampling_frequency()
     assert_array_equal(img1.get_channel_names(), img2.get_channel_names())
     assert_array_equal(img1.get_image_size(), img2.get_image_size())
-    assert_array_equal(img1.get_frames(frame_idxs=[0]),
-                       img2.get_frames(frame_idxs=[0]))
+    assert_array_equal(img1.get_frames(frame_idxs=[0]), img2.get_frames(frame_idxs=[0]))
+
 
 def check_imaging_return_types(img_ex: ImagingExtractor):
     """
@@ -144,15 +170,18 @@ def check_imaging_return_types(img_ex: ImagingExtractor):
     assert isinstance(img_ex.get_num_frames(), inttype)
     assert isinstance(img_ex.get_num_channels(), inttype)
     assert isinstance(img_ex.get_sampling_frequency(), (NoneType, floattype, inttype))
-    _assert_iterable_complete(img_ex.get_channel_names(),
-                              dtypes=list,
-                              element_dtypes=str,
-                              shape_max=(img_ex.get_num_channels(),))
-    _assert_iterable_complete(img_ex.get_image_size(),
-                              dtypes=Iterable,
-                              element_dtypes=inttype,
-                              shape=(2,))
-    _assert_iterable_complete(img_ex.get_frames(frame_idxs=[0,1]),
-                              dtypes=(np.ndarray,),
-                              element_dtypes=inttype,
-                              shape=(2, *img_ex.get_image_size()))
\ No newline at end of file
+    _assert_iterable_complete(
+        img_ex.get_channel_names(),
+        dtypes=list,
+        element_dtypes=str,
+        shape_max=(img_ex.get_num_channels(),),
+    )
+    _assert_iterable_complete(
+        img_ex.get_image_size(), dtypes=Iterable, element_dtypes=inttype, shape=(2,)
+    )
+    _assert_iterable_complete(
+        img_ex.get_frames(frame_idxs=[0, 1]),
+        dtypes=(np.ndarray,),
+        element_dtypes=inttype,
+        shape=(2, *img_ex.get_image_size()),
+    )
diff --git a/tests/test_conversions.py b/tests/test_conversions.py
index 7d8dc715..6a1d1d91 100644
--- a/tests/test_conversions.py
+++ b/tests/test_conversions.py
@@ -5,67 +5,89 @@
 from datalad.api import install, Dataset
 from parameterized import parameterized
 
-from roiextractors import NwbSegmentationExtractor, \
-    CaimanSegmentationExtractor, ExtractSegmentationExtractor, \
-    Suite2pSegmentationExtractor, CnmfeSegmentationExtractor, \
-    TiffImagingExtractor, Hdf5ImagingExtractor, SbxImagingExtractor, NwbImagingExtractor
+from roiextractors import (
+    NwbSegmentationExtractor,
+    CaimanSegmentationExtractor,
+    ExtractSegmentationExtractor,
+    Suite2pSegmentationExtractor,
+    CnmfeSegmentationExtractor,
+    TiffImagingExtractor,
+    Hdf5ImagingExtractor,
+    SbxImagingExtractor,
+    NwbImagingExtractor,
+)
 from roiextractors.testing import check_segmentations_equal, check_imaging_equal
 
 
 class TestNwbConversions(unittest.TestCase):
-
     def setUp(self):
-        pt = Path.cwd()/'ophys_testing_data'
+        pt = Path.cwd() / "ophys_testing_data"
         if pt.exists():
             self.dataset = Dataset(pt)
         else:
-            self.dataset = install('https://gin.g-node.org/CatalystNeuro/ophys_testing_data')
+            self.dataset = install(
+                "https://gin.g-node.org/CatalystNeuro/ophys_testing_data"
+            )
         self.savedir = Path(tempfile.mkdtemp())
 
     def get_data(self, rt_write_fname, rt_read_fname, save_fname, dataset_path):
         if rt_read_fname is None:
             rt_read_fname = rt_write_fname
-        save_path = self.savedir/save_fname
-        rt_write_path = self.savedir/rt_write_fname
-        rt_read_path = self.savedir/rt_read_fname
+        save_path = self.savedir / save_fname
+        rt_write_path = self.savedir / rt_write_fname
+        rt_read_path = self.savedir / rt_read_fname
         resp = self.dataset.get(dataset_path)
 
         return rt_write_path, rt_read_path, save_path
 
-    @parameterized.expand([
-        (
+    @parameterized.expand(
+        [
+            (
                 CaimanSegmentationExtractor,
-                'segmentation_datasets/caiman/caiman_analysis.hdf5',
-                'segmentation_datasets/caiman/caiman_analysis.hdf5',
-                'caiman_test.nwb',
-                'caiman_test.hdf5'
-        ), (
+                "segmentation_datasets/caiman/caiman_analysis.hdf5",
+                "segmentation_datasets/caiman/caiman_analysis.hdf5",
+                "caiman_test.nwb",
+                "caiman_test.hdf5",
+            ),
+            (
                 CnmfeSegmentationExtractor,
-                'segmentation_datasets/cnmfe/2014_04_01_p203_m19_check01_cnmfeAnalysis.mat',
-                'segmentation_datasets/cnmfe/2014_04_01_p203_m19_check01_cnmfeAnalysis.mat',
-                'cnmfe_test.nwb',
-                'cnmfe_test.mat'
-        ), (
+                "segmentation_datasets/cnmfe/2014_04_01_p203_m19_check01_cnmfeAnalysis.mat",
+                "segmentation_datasets/cnmfe/2014_04_01_p203_m19_check01_cnmfeAnalysis.mat",
+                "cnmfe_test.nwb",
+                "cnmfe_test.mat",
+            ),
+            (
                 ExtractSegmentationExtractor,
-                'segmentation_datasets/extract/2014_04_01_p203_m19_check01_extractAnalysis.mat',
-                'segmentation_datasets/extract/2014_04_01_p203_m19_check01_extractAnalysis.mat',
-                'extract_test.nwb',
-                'extract_test.mat'
-        ), (
+                "segmentation_datasets/extract/2014_04_01_p203_m19_check01_extractAnalysis.mat",
+                "segmentation_datasets/extract/2014_04_01_p203_m19_check01_extractAnalysis.mat",
+                "extract_test.nwb",
+                "extract_test.mat",
+            ),
+            (
                 Suite2pSegmentationExtractor,
-                'segmentation_datasets/suite2p/plane0',
-                'segmentation_datasets/suite2p',
-                'suite2p_test.nwb',
-                'suite2p_test/plane0',
-                'suite2p_test'
+                "segmentation_datasets/suite2p/plane0",
+                "segmentation_datasets/suite2p",
+                "suite2p_test.nwb",
+                "suite2p_test/plane0",
+                "suite2p_test",
+            ),
+        ]
+    )
+    def test_convert_seg_interface_to_nwb(
+        self,
+        roi_ex_class,
+        dataset_path,
+        dataset_path_arg,
+        save_fname,
+        rt_write_fname,
+        rt_read_fname=None,
+    ):
+
+        rt_write_path, rt_read_path, save_path = self.get_data(
+            rt_write_fname, rt_read_fname, save_fname, dataset_path
         )
-    ])
-    def test_convert_seg_interface_to_nwb(self, roi_ex_class, dataset_path,
-                                          dataset_path_arg, save_fname, rt_write_fname, rt_read_fname=None):
-
-        rt_write_path, rt_read_path, save_path = self.get_data(rt_write_fname, rt_read_fname, save_fname, dataset_path)
 
-        path = Path.cwd()/'ophys_testing_data'/dataset_path_arg
+        path = Path.cwd() / "ophys_testing_data" / dataset_path_arg
         roi_ex = roi_ex_class(path)
         NwbSegmentationExtractor.write_segmentation(roi_ex, save_path)
         nwb_seg_ex = NwbSegmentationExtractor(save_path)
@@ -76,35 +98,48 @@ def test_convert_seg_interface_to_nwb(self, roi_ex_class, dataset_path,
             return
         seg_ex_rt = roi_ex_class(rt_read_path)
 
-    @parameterized.expand([
-        (
+    @parameterized.expand(
+        [
+            (
                 TiffImagingExtractor,
-                'imaging_datasets/Tif/demoMovie.tif',
-                'imaging_datasets/Tif/demoMovie.tif',
-                'tiff_imaging_test.nwb',
-                'tiff_imaging_test.tif',
-        ), (
+                "imaging_datasets/Tif/demoMovie.tif",
+                "imaging_datasets/Tif/demoMovie.tif",
+                "tiff_imaging_test.nwb",
+                "tiff_imaging_test.tif",
+            ),
+            (
                 Hdf5ImagingExtractor,
-                'imaging_datasets/hdf5/demoMovie.hdf5',
-                'imaging_datasets/hdf5/demoMovie.hdf5',
-                'hdf5_imaging_test.nwb',
-                'hdf5_imaging_test.hdf5',
-        ), (
+                "imaging_datasets/hdf5/demoMovie.hdf5",
+                "imaging_datasets/hdf5/demoMovie.hdf5",
+                "hdf5_imaging_test.nwb",
+                "hdf5_imaging_test.hdf5",
+            ),
+            (
                 SbxImagingExtractor,
-                'imaging_datasets/Scanbox',
-                'imaging_datasets/Scanbox/sample.mat',
-                'sbx_imaging_test.nwb',
-                'sbx_imaging_test.sbx',
+                "imaging_datasets/Scanbox",
+                "imaging_datasets/Scanbox/sample.mat",
+                "sbx_imaging_test.nwb",
+                "sbx_imaging_test.sbx",
+            ),
+        ]
+    )
+    def test_convert_img_interface_to_nwb(
+        self,
+        roi_ex_class,
+        dataset_path,
+        dataset_path_arg,
+        save_fname,
+        rt_write_fname,
+        rt_read_fname=None,
+    ):
+
+        rt_write_path, rt_read_path, save_path = self.get_data(
+            rt_write_fname, rt_read_fname, save_fname, dataset_path
         )
-    ])
-    def test_convert_img_interface_to_nwb(self, roi_ex_class, dataset_path,
-                                          dataset_path_arg, save_fname, rt_write_fname, rt_read_fname=None):
-
-        rt_write_path, rt_read_path, save_path = self.get_data(rt_write_fname, rt_read_fname, save_fname, dataset_path)
 
         sampling_freq = 20.0
 
-        path = Path.cwd() / 'ophys_testing_data' / dataset_path_arg
+        path = Path.cwd() / "ophys_testing_data" / dataset_path_arg
         roi_ex = roi_ex_class(file_path=path, sampling_frequency=sampling_freq)
         NwbImagingExtractor.write_imaging(roi_ex, save_path)
         nwb_img_ex = NwbImagingExtractor(save_path)
@@ -113,8 +148,10 @@ def test_convert_img_interface_to_nwb(self, roi_ex_class, dataset_path,
             roi_ex_class.write_imaging(nwb_img_ex, rt_write_path)
         except NotImplementedError:
             return
-        img_ex_rt = roi_ex_class(file_path=rt_read_path, sampling_frequency=sampling_freq)
+        img_ex_rt = roi_ex_class(
+            file_path=rt_read_path, sampling_frequency=sampling_freq
+        )
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     unittest.main()