Repository: spacetx/starfish

Issue:
Codebook docstrings need to be updated
The docstrings in `codebook.py` need to be updated. I didn't make an exhaustive search, but a few things I noticed:
* the round dimensions are still listed as "h" instead of "r"
* the input arguments are wrong in the class docstring example (should be `n_channel` instead of `n_ch`)

Discussion:
codecov-io: # [Codecov](https://codecov.io/gh/spacetx/starfish/pull/1061?src=pr&el=h1) Report
> Merging [#1061](https://codecov.io/gh/spacetx/starfish/pull/1061?src=pr&el=desc) into [master](https://codecov.io/gh/spacetx/starfish/commit/0b909d22b0a21d73d492c054e6a1e556b6ed2d41?src=pr&el=desc) will **increase** coverage by `1.02%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/spacetx/starfish/pull/1061/graphs/tree.svg?width=650&token=kliQHejt6T&height=150&src=pr)](https://codecov.io/gh/spacetx/starfish/pull/1061?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master    #1061      +/-   ##
==========================================
+ Coverage   88.56%   89.58%   +1.02%     
==========================================
  Files         167      169       +2     
  Lines        6216     7199     +983     
==========================================
+ Hits         5505     6449     +944     
- Misses        711      750      +39
```


| [Impacted Files](https://codecov.io/gh/spacetx/starfish/pull/1061?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [starfish/test/dataset\_fixtures.py](https://codecov.io/gh/spacetx/starfish/pull/1061/diff?src=pr&el=tree#diff-c3RhcmZpc2gvdGVzdC9kYXRhc2V0X2ZpeHR1cmVzLnB5) | `51.85% <100%> (ø)` | :arrow_up: |
| [starfish/test/codebook/test\_from\_code\_array.py](https://codecov.io/gh/spacetx/starfish/pull/1061/diff?src=pr&el=tree#diff-c3RhcmZpc2gvdGVzdC9jb2RlYm9vay90ZXN0X2Zyb21fY29kZV9hcnJheS5weQ==) | `100% <100%> (ø)` | :arrow_up: |
| [starfish/codebook/codebook.py](https://codecov.io/gh/spacetx/starfish/pull/1061/diff?src=pr&el=tree#diff-c3RhcmZpc2gvY29kZWJvb2svY29kZWJvb2sucHk=) | `96.66% <100%> (ø)` | :arrow_up: |
| [...rfish/test/full\_pipelines/cli/get\_cli\_test\_data.py](https://codecov.io/gh/spacetx/starfish/pull/1061/diff?src=pr&el=tree#diff-c3RhcmZpc2gvdGVzdC9mdWxsX3BpcGVsaW5lcy9jbGkvZ2V0X2NsaV90ZXN0X2RhdGEucHk=) | `88.88% <0%> (-11.12%)` | :arrow_down: |
| [starfish/\_\_init\_\_.py](https://codecov.io/gh/spacetx/starfish/pull/1061/diff?src=pr&el=tree#diff-c3RhcmZpc2gvX19pbml0X18ucHk=) | `87.5% <0%> (-5.84%)` | :arrow_down: |
| [starfish/image/\_filter/white\_tophat.py](https://codecov.io/gh/spacetx/starfish/pull/1061/diff?src=pr&el=tree#diff-c3RhcmZpc2gvaW1hZ2UvX2ZpbHRlci93aGl0ZV90b3BoYXQucHk=) | `97.95% <0%> (-2.05%)` | :arrow_down: |
| [starfish/image/\_filter/scale\_by\_percentile.py](https://codecov.io/gh/spacetx/starfish/pull/1061/diff?src=pr&el=tree#diff-c3RhcmZpc2gvaW1hZ2UvX2ZpbHRlci9zY2FsZV9ieV9wZXJjZW50aWxlLnB5) | `98.07% <0%> (-1.93%)` | :arrow_down: |
| [...tarfish/image/\_filter/zero\_by\_channel\_magnitude.py](https://codecov.io/gh/spacetx/starfish/pull/1061/diff?src=pr&el=tree#diff-c3RhcmZpc2gvaW1hZ2UvX2ZpbHRlci96ZXJvX2J5X2NoYW5uZWxfbWFnbml0dWRlLnB5) | `98.07% <0%> (-1.93%)` | :arrow_down: |
| [starfish/spots/\_detector/detect.py](https://codecov.io/gh/spacetx/starfish/pull/1061/diff?src=pr&el=tree#diff-c3RhcmZpc2gvc3BvdHMvX2RldGVjdG9yL2RldGVjdC5weQ==) | `97.05% <0%> (-1.31%)` | :arrow_down: |
| [starfish/image/\_filter/gaussian\_low\_pass.py](https://codecov.io/gh/spacetx/starfish/pull/1061/diff?src=pr&el=tree#diff-c3RhcmZpc2gvaW1hZ2UvX2ZpbHRlci9nYXVzc2lhbl9sb3dfcGFzcy5weQ==) | `96.07% <0%> (-0.99%)` | :arrow_down: |
| ... and [25 more](https://codecov.io/gh/spacetx/starfish/pull/1061/diff?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/spacetx/starfish/pull/1061?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/spacetx/starfish/pull/1061?src=pr&el=footer). Last update [0b909d2...85a8668](https://codecov.io/gh/spacetx/starfish/pull/1061?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/docs/source/usage/iss/iss_cli.sh b/docs/source/usage/iss/iss_cli.sh
index cd8875ba..ed759b5e 100644
--- a/docs/source/usage/iss/iss_cli.sh
+++ b/docs/source/usage/iss/iss_cli.sh
@@ -4,10 +4,10 @@ mkdir -p /tmp/starfish/registered
 mkdir -p /tmp/starfish/filtered
 mkdir -p /tmp/starfish/results
 
-python examples/get_iss_data.py /tmp/starfish/raw /tmp/starfish/formatted --d 1
+python data_formatting_examples/format_iss_data.py /tmp/starfish/raw /tmp/starfish/formatted --d 1
 
 starfish registration \
-    -i /tmp/starfish/formatted/primary_image-fov_000.json \
+    -i /tmp/starfish/formatted/primary_images-fov_000.json \
     -o /tmp/starfish/registered/primary_images.json \
     FourierShiftRegistration \
     --reference-stack /tmp/starfish/formatted/nuclei-fov_000.json \
@@ -35,23 +35,23 @@ starfish detect_spots \
     --input /tmp/starfish/filtered/primary_images.json \
     --output /tmp/starfish/results/spots.nc \
     --blobs-stack /tmp/starfish/filtered/dots.json \
-    GaussianSpotDetector \
+    BlobDetector \
     --min-sigma 4 \
     --max-sigma 6 \
     --num-sigma 20 \
     --threshold 0.01
 
 starfish segment \
-    --primary-image-stack /tmp/starfish/filtered/primary_images.json \
-    --nuclei-stack /tmp/starfish/filtered/nuclei.json \
-    -o /tmp/starfish/results/regions.geojson \
+    --primary-images /tmp/starfish/filtered/primary_images.json \
+    --nuclei /tmp/starfish/filtered/nuclei.json \
+    -o /tmp/starfish/results/label_image.png \
     Watershed \
-    --dapi-threshold .16 \
+    --nuclei-threshold .16 \
     --input-threshold .22 \
     --min-distance 57
 
 starfish target_assignment \
-    --coordinates-geojson /tmp/starfish/results/regions.geojson \
+    --label-image /tmp/starfish/results/label_image.png \
     --intensities /tmp/starfish/results/spots.nc \
     --output /tmp/starfish/results/targeted-spots.nc \
     Label
@@ -61,3 +61,4 @@ starfish decode \
     --codebook /tmp/starfish/formatted/codebook.json \
     -o /tmp/starfish/results/decoded-spots.nc \
     PerRoundMaxChannelDecoder
+
diff --git a/starfish/codebook/codebook.py b/starfish/codebook/codebook.py
index 874458e7..60a8876d 100644
--- a/starfish/codebook/codebook.py
+++ b/starfish/codebook/codebook.py
@@ -36,10 +36,10 @@ class Codebook(xr.DataArray):
 
     Methods
     -------
-    from_code_array(code_array, n_round, n_ch)
+    from_code_array(code_array, n_round, n_channel)
         construct a codebook from a spaceTx-spec array of codewords
 
-    from_json(json_codebook, n_round, n_ch)
+    from_json(json_codebook, n_round, n_channel)
         load a codebook from a spaceTx spec-compliant json file
 
     to_json(filename)
@@ -64,9 +64,9 @@ class Codebook(xr.DataArray):
     Build a codebook using ``Codebook.synthetic_one_hot_codebook``::
 
         >>> from starfish import Codebook
-        >>> sd = Codebook.synthetic_one_hot_codebook(n_ch=3, n_round=4, n_codes=2)
+        >>> sd = Codebook.synthetic_one_hot_codebook(n_channel=3, n_round=4, n_codes=2)
         >>> sd.codebook()
-        <xarray.Codebook (target: 2, c: 3, h: 4)>
+        <xarray.Codebook (target: 2, c: 3, r: 4)>
         array([[[0, 0, 0, 0],
                 [0, 0, 1, 1],
                 [1, 1, 0, 0]],
@@ -77,7 +77,7 @@ class Codebook(xr.DataArray):
         Coordinates:
           * target     (target) object 08b1a822-a1b4-4e06-81ea-8a4bd2b004a9 ...
           * c          (c) int64 0 1 2
-          * h          (h) int64 0 1 2 3
+          * r          (r) int64 0 1 2 3
 
     See Also
     --------
@@ -91,14 +91,14 @@ class Codebook(xr.DataArray):
         return int(np.dot(*self.shape[1:]))
 
     @classmethod
-    def _empty_codebook(cls, code_names: Sequence[str], n_ch: int, n_round: int):
-        """create an empty codebook of shape (code_names, n_ch, n_round)
+    def _empty_codebook(cls, code_names: Sequence[str], n_channel: int, n_round: int):
+        """create an empty codebook of shape (code_names, n_channel, n_round)
 
         Parameters
         ----------
         code_names : Sequence[str]
             the targets to be coded
-        n_ch : int
+        n_channel : int
             number of channels used to build the codes
         n_round : int
             number of imaging rounds used to build the codes
@@ -106,8 +106,8 @@ class Codebook(xr.DataArray):
         Examples
         --------
         >>> from starfish import Codebook
-        >>> Codebook._empty_codebook(['ACTA', 'ACTB'], n_ch=3, n_round=2)
-        <xarray.Codebook (target: 2, c: 3, h: 2)>
+        >>> Codebook._empty_codebook(['ACTA', 'ACTB'], n_channel=3, n_round=2)
+        <xarray.Codebook (target: 2, c: 3, r: 2)>
         array([[[0, 0],
                 [0, 0],
                 [0, 0]],
@@ -118,7 +118,7 @@ class Codebook(xr.DataArray):
         Coordinates:
           * target     (target) object 'ACTA' 'ACTB'
           * c          (c) int64 0 1 2
-          * h          (h) int64 0 1
+          * r          (r) int64 0 1
 
         Returns
         -------
@@ -126,31 +126,37 @@ class Codebook(xr.DataArray):
             codebook whose values are all zero
 
         """
-        data = np.zeros((len(code_names), n_ch, n_round), dtype=np.uint8)
-        return cls._create_codebook(code_names, n_ch, n_round, data)
+        data = np.zeros((len(code_names), n_channel, n_round), dtype=np.uint8)
+        return cls._create_codebook(code_names, n_channel, n_round, data)
 
     @classmethod
-    def _create_codebook(cls, code_names: Sequence[str], n_ch: int, n_round: int, data: np.ndarray):
-        """create a codebook of shape (code_names, n_ch, n_round) with the given data
+    def _create_codebook(
+            cls,
+            code_names: Sequence[str],
+            n_channel: int,
+            n_round: int,
+            data: np.ndarray,
+    ) -> "Codebook":
+        """create a codebook of shape (code_names, n_channel, n_round) with the given data
 
         Parameters
         ----------
         code_names : Sequence[str]
             the targets to be coded
-        n_ch : int
+        n_channel : int
             number of channels used to build the codes
         n_round : int
             number of imaging rounds used to build the codes
         data : np.ndarray
-            array of unit8 values with len(code_names) x n_ch x _nround elements
+            array of unit8 values with len(code_names) x n_channel x n_round elements
 
         Examples
         --------
         >>> import numpy as np
         >>> from starfish import Codebook
         >>> data = np.zeros((3, 2, 2), dtype=np.uint8)
-        >>> Codebook._create_codebook(['ACTA', 'ACTB'], n_ch=3, n_round=2, data)
-        <xarray.Codebook (target: 2, c: 3, h: 2)>
+        >>> Codebook._create_codebook(['ACTA', 'ACTB'], n_channel=3, n_round=2, data=data)
+        <xarray.Codebook (target: 2, c: 3, r: 2)>
         array([[[0, 0],
                 [0, 0],
                 [0, 0]],
@@ -161,7 +167,7 @@ class Codebook(xr.DataArray):
         Coordinates:
           * target     (target) object 'ACTA' 'ACTB'
           * c          (c) int64 0 1 2
-          * h          (h) int64 0 1
+          * r          (r) int64 0 1
 
         Returns
         -------
@@ -173,7 +179,7 @@ class Codebook(xr.DataArray):
             data=data,
             coords=(
                 pd.Index(code_names, name=Features.TARGET),
-                pd.Index(np.arange(n_ch), name=Axes.CH.value),
+                pd.Index(np.arange(n_channel), name=Axes.CH.value),
                 pd.Index(np.arange(n_round), name=Axes.ROUND.value),
             )
         )
@@ -190,7 +196,7 @@ class Codebook(xr.DataArray):
     @classmethod
     def from_code_array(
             cls, code_array: List[Dict[Union[str, Any], Any]],
-            n_round: Optional[int]=None, n_ch: Optional[int]=None) -> "Codebook":
+            n_round: Optional[int]=None, n_channel: Optional[int]=None) -> "Codebook":
         """construct a codebook from a spaceTx-spec array of codewords
 
         Parameters
@@ -199,7 +205,7 @@ class Codebook(xr.DataArray):
             Array of dictionaries, each containing a codeword and target
         n_round : Optional[int]
             The number of imaging rounds used in the codes. Will be inferred if not provided
-        n_ch : Optional[int]
+        n_channel : Optional[int]
             The number of channels used in the codes. Will be inferred if not provided
 
         Examples
@@ -225,7 +231,7 @@ class Codebook(xr.DataArray):
             >>>     },
             >>> ]
             >>> Codebook.from_code_array(codebook)
-            <xarray.Codebook (target: 2, c: 4, h: 2)>
+            <xarray.Codebook (target: 2, c: 4, r: 2)>
             array([[[0, 0],
                     [0, 0],
                     [0, 0],
@@ -238,7 +244,7 @@ class Codebook(xr.DataArray):
             Coordinates:
               * target     (target) object 'ACTB_human' 'ACTB_mouse'
               * c          (c) int64 0 1 2 3
-              * h          (h) int64 0 1
+              * r          (r) int64 0 1
 
             Codebook.from_json(json_codebook)
 
@@ -257,19 +263,19 @@ class Codebook(xr.DataArray):
                 max_round = max(max_round, entry[Axes.ROUND])
                 max_ch = max(max_ch, entry[Axes.CH])
 
-        # set n_ch and n_round if either were not provided
+        # set n_channel and n_round if either were not provided
         n_round = n_round if n_round is not None else max_round + 1
-        n_ch = n_ch if n_ch is not None else max_ch + 1
+        n_channel = n_channel if n_channel is not None else max_ch + 1
 
-        # raise errors if provided n_round or n_ch are out of range
+        # raise errors if provided n_round or n_channel are out of range
         if max_round + 1 > n_round:
             raise ValueError(
                 f'code detected that requires an imaging round value ({max_round + 1}) that is '
                 f'greater than provided n_round: {max_round}')
-        if max_ch + 1 > n_ch:
+        if max_ch + 1 > n_channel:
             raise ValueError(
                 f'code detected that requires a channel value ({max_ch + 1}) that is greater '
-                f'than provided n_ch: {n_ch}')
+                f'than provided n_channel: {n_channel}')
 
         # verify codebook structure and fields
         for code in code_array:
@@ -288,19 +294,19 @@ class Codebook(xr.DataArray):
         target_names = [w[Features.TARGET] for w in code_array]
 
         # fill the codebook
-        data = np.zeros((len(target_names), n_ch, n_round), dtype=np.uint8)
+        data = np.zeros((len(target_names), n_channel, n_round), dtype=np.uint8)
         for i, code_dict in enumerate(code_array):
             for bit in code_dict[Features.CODEWORD]:
                 ch = int(bit[Axes.CH])
                 r = int(bit[Axes.ROUND])
                 data[i, ch, r] = int(bit[Features.CODE_VALUE])
-        return cls._create_codebook(target_names, n_ch, n_round, data)
+        return cls._create_codebook(target_names, n_channel, n_round, data)
 
     @classmethod
     def from_json(
             cls, json_codebook: str,
             n_round: Optional[int]=None,
-            n_ch: Optional[int]=None,
+            n_channel: Optional[int]=None,
     ) -> "Codebook":
         """Load a codebook from a spaceTx spec-compliant json file or a url pointing to such a file
         Loads configuration from StarfishConfig.
@@ -311,7 +317,7 @@ class Codebook(xr.DataArray):
             path or url to json file containing a spaceTx codebook
         n_round : Optional[int]
             The number of imaging rounds used in the codes. Will be inferred if not provided
-        n_ch : Optional[int]
+        n_channel : Optional[int]
             The number of channels used in the codes. Will be inferred if not provided
 
         Examples
@@ -346,7 +352,7 @@ class Codebook(xr.DataArray):
             >>>     json.dump(codebook, f)
             >>> # read codebook from file
             >>> Codebook.from_json(json_codebook)
-           <xarray.Codebook (target: 2, c: 4, h: 2)>
+           <xarray.Codebook (target: 2, c: 4, r: 2)>
             array([[[0, 0],
                     [0, 0],
                     [0, 0],
@@ -359,7 +365,7 @@ class Codebook(xr.DataArray):
             Coordinates:
               * target     (target) object 'ACTB_human' 'ACTB_mouse'
               * c          (c) int64 0 1 2 3
-              * h          (h) int64 0 1
+              * r          (r) int64 0 1
 
         Returns
         -------
@@ -388,7 +394,7 @@ class Codebook(xr.DataArray):
         version_str = codebook_doc[DocumentKeys.VERSION_KEY]
         cls._verify_version(version_str)
 
-        return cls.from_code_array(codebook_doc[DocumentKeys.MAPPINGS_KEY], n_round, n_ch)
+        return cls.from_code_array(codebook_doc[DocumentKeys.MAPPINGS_KEY], n_round, n_channel)
 
     def to_json(self, filename: str) -> None:
         """save a codebook to json
@@ -610,7 +616,7 @@ class Codebook(xr.DataArray):
             Parameters
             ----------
             array : np.ndarray
-                2-dimensional numpy array of shape (n_observations, (n_ch * n_round)) where
+                2-dimensional numpy array of shape (n_observations, (n_channel * n_round)) where
                 observations may be either features or codes.
 
             Returns
@@ -677,7 +683,7 @@ class Codebook(xr.DataArray):
 
             >>> from starfish import Codebook
             >>> Codebook.synthetic_one_hot_codebook(n_round=2, n_channel=3, n_codes=2)
-            <xarray.Codebook (target: 2, c: 3, h: 2)>
+            <xarray.Codebook (target: 2, c: 3, r: 2)>
             array([[[0, 1],
                     [0, 0],
                     [1, 0]],
@@ -721,4 +727,4 @@ class Codebook(xr.DataArray):
         codebook = [{Features.CODEWORD: w, Features.TARGET: g}
                     for w, g in zip(codewords, target_names)]
 
-        return cls.from_code_array(codebook, n_round=n_round, n_ch=n_channel)
+        return cls.from_code_array(codebook, n_round=n_round, n_channel=n_channel)
diff --git a/starfish/imagestack/imagestack.py b/starfish/imagestack/imagestack.py
index e32e298c..e7e0a8a8 100644
--- a/starfish/imagestack/imagestack.py
+++ b/starfish/imagestack/imagestack.py
@@ -27,8 +27,6 @@ import pandas as pd
 import skimage.io
 import xarray as xr
 from scipy.ndimage.filters import gaussian_filter
-from scipy.stats import scoreatpercentile
-from skimage import exposure
 from skimage import img_as_float32, img_as_uint
 from slicedimage import (
     ImageFormat,
@@ -568,55 +566,6 @@ class ImageStack:
 
         self._data.loc[slice_list] = data
 
-    def _get_scaled_clipped_linear_view(self, selector, rescale, p_min, p_max):
-
-        # get the requested chunk, linearize the remaining data into a sequence of tiles
-        data, remaining_inds = self.get_slice(selector)
-
-        # identify the dimensionality of data with all dimensions other than x, y linearized
-        if len(data.shape) >= 3:
-            n_tiles = np.product(data.shape[:-2])
-        else:
-            raise ValueError(
-                f'a stack with dimensionality >= 3 is required, the provided indexer produced a '
-                f'stack with shape {data.shape}')
-
-        # linearize the array
-        linear_view: np.ndarray = data.reshape((n_tiles,) + data.shape[-2:])
-
-        # set the labels for the linearized tiles
-        labels: List[List[str]] = []
-        for index, size in zip(remaining_inds, data.shape[:-2]):
-            labels.append([f'{index}{n}' for n in range(size)])
-
-        # mypy thinks this has an incompatible type "Iterator[Tuple[Any, ...]]";
-        # it expects "Iterable[List[str]]"
-        labels = list(product(*labels))  # type: ignore
-
-        n_tiles = linear_view.shape[0]
-
-        if rescale and any((p_min, p_max)):
-            raise ValueError('select one of rescale and p_min/p_max to rescale image, not both.')
-
-        elif rescale:
-            print("Rescaling ...")
-            vmin, vmax = scoreatpercentile(data, (0.5, 99.5))
-            linear_view = exposure.rescale_intensity(
-                linear_view,
-                in_range=(vmin, vmax),
-                out_range=np.float32
-            ).astype(np.float32)
-
-        elif p_min or p_max:
-            print("Clipping ...")
-            a_min, a_max = scoreatpercentile(
-                linear_view,
-                (p_min if p_min else 0, p_max if p_max else 100)
-            )
-            linear_view = np.clip(linear_view, a_min=a_min, a_max=a_max)
-
-        return linear_view, labels, n_tiles
-
     @staticmethod
     def _show_matplotlib_notebook(
             linear_view, labels, n_tiles, figure_size, color_map


Test patch:
diff --git a/starfish/test/codebook/test_from_code_array.py b/starfish/test/codebook/test_from_code_array.py
index fd709080..0dc916f7 100644
--- a/starfish/test/codebook/test_from_code_array.py
+++ b/starfish/test/codebook/test_from_code_array.py
@@ -90,7 +90,7 @@ def test_from_code_array_expands_codebook_when_provided_n_codes_that_exceeds_arr
     larger than that, and the codebook should be expanded to those numbers as a result.
     """
     code_array: List = codebook_array_factory()
-    codebook: Codebook = Codebook.from_code_array(code_array, n_ch=10, n_round=4)
+    codebook: Codebook = Codebook.from_code_array(code_array, n_channel=10, n_round=4)
     assert codebook.sizes[Axes.CH] == 10
     assert codebook.sizes[Axes.ROUND] == 4
     assert codebook.sizes[Features.TARGET] == 2
@@ -105,18 +105,18 @@ def test_from_code_array_throws_exceptions_when_data_does_not_match_channel_or_r
 
     # should throw an exception, as 3 channels are present in the data
     with pytest.raises(ValueError):
-        Codebook.from_code_array(code_array, n_ch=2, n_round=4)
+        Codebook.from_code_array(code_array, n_channel=2, n_round=4)
 
     # should throw an exception, as 2 rounds are present in the data
     with pytest.raises(ValueError):
-        Codebook.from_code_array(code_array, n_ch=3, n_round=1)
+        Codebook.from_code_array(code_array, n_channel=3, n_round=1)
 
 
 def test_from_code_array_throws_exception_when_data_is_improperly_formatted():
     code_array: List = codebook_array_factory()
     code_array[0][Features.CODEWORD][0] = ('I should be a dict, oops!',)
     with pytest.raises(TypeError):
-        Codebook.from_code_array(code_array, n_ch=3, n_round=1)
+        Codebook.from_code_array(code_array, n_channel=3, n_round=1)
 
 
 # TODO codebook should throw an error when an empty array is passed
@@ -129,7 +129,7 @@ def test_from_code_array_throws_exception_when_data_is_improperly_formatted():
 def test_empty_codebook():
     code_array: List = codebook_array_factory()
     targets = [x[Features.TARGET] for x in code_array]
-    codebook = Codebook._empty_codebook(targets, n_ch=3, n_round=2)
+    codebook = Codebook._empty_codebook(targets, n_channel=3, n_round=2)
     assert_sizes(codebook, False)
 
 def test_create_codebook():
@@ -144,5 +144,5 @@ def test_create_codebook():
             r = int(bit[Axes.ROUND])
             data[i, ch, r] = int(bit[Features.CODE_VALUE])
 
-    codebook = Codebook._create_codebook(targets, n_ch=3, n_round=2, data=data)
+    codebook = Codebook._create_codebook(targets, n_channel=3, n_round=2, data=data)
     assert_sizes(codebook)
diff --git a/starfish/test/dataset_fixtures.py b/starfish/test/dataset_fixtures.py
index b8bab078..472c5159 100644
--- a/starfish/test/dataset_fixtures.py
+++ b/starfish/test/dataset_fixtures.py
@@ -79,7 +79,7 @@ def simple_codebook_json(simple_codebook_array) -> Generator[str, None, None]:
 
 @pytest.fixture(scope='module')
 def loaded_codebook(simple_codebook_json):
-    return Codebook.from_json(simple_codebook_json, n_ch=2, n_round=2)
+    return Codebook.from_json(simple_codebook_json, n_channel=2, n_round=2)
 
 
 @pytest.fixture(scope='function')