예제 #1
0
    def get_test_artifact(uri, ptype):
        # chunk.ProductType.SCIENCE is a common type
        if ptype is None:
            ptype = chunk.ProductType.SCIENCE
        test_artifact = artifact.Artifact(uri, ptype,
                                          artifact.ReleaseType.DATA)
        chunks = TypedList(chunk.Chunk)
        chunks.append(ArtifactTestUtil.get_good_test_chunk(ptype))

        pname = "test_part"
        test_part = PartTestUtil.get_test_part(pname, ptype)
        test_artifact.parts = TypedOrderedDict(part.Part)
        test_artifact.parts[pname] = test_part
        return test_artifact
예제 #2
0
    def get_test_artifact(ptype):
        # chunk.ProductType.SCIENCE is a common type
        if ptype is None:
            ptype = chunk.ProductType.SCIENCE
        test_artifact = artifact.Artifact('uri:foo/bar', ptype,
                                          artifact.ReleaseType.DATA)
        chunks = TypedList(chunk.Chunk)
        chunks.append(ArtifactTestUtil.get_good_test_chunk(ptype))

        test_part = part.Part("test_part", ptype, chunks)
        test_artifact.parts = TypedOrderedDict(part.Part)
        test_artifact.parts['test_part'] = test_part

        return test_artifact
예제 #3
0
 def test_compute(self):
     # _choose_product returns Artifact.product (SCIENCE),
     # user_chunk = False
     test_chunk = Chunk()
     test_chunk.product_type = chunk.ProductType.CALIBRATION
     test_chunk.custom = CustomTestUtil.good_wcs()
     test_chunks = TypedList(Chunk, test_chunk)
     part_name = "test_part"
     part_product_type = chunk.ProductType.CALIBRATION
     part = Part(part_name, part_product_type, test_chunks)
     uri = 'mast:HST/product/test_file.jpg'
     artifact_product_type = chunk.ProductType.SCIENCE
     release_type = ReleaseType.DATA
     artifact = Artifact(uri, artifact_product_type, release_type)
     artifact.parts = TypedOrderedDict((Part), (part_name, part))
     artifacts = TypedList(Artifact, artifact)
     actual_axis = wcs_util.CustomAxisUtil.compute(artifacts)
     expected_axis = None
     self.assertEqual(expected_axis, actual_axis)
     # _choose_product returns Artifact.product (CALIBRATION),
     # user_chunk = False
     test_chunk = Chunk()
     test_chunk.product_type = chunk.ProductType.SCIENCE
     test_chunk.custom = CustomTestUtil.good_wcs()
     test_chunks = TypedList(Chunk, test_chunk)
     part_name = "test_part"
     part_product_type = chunk.ProductType.SCIENCE
     part = Part(part_name, part_product_type, test_chunks)
     uri = 'mast:HST/product/test_file.jpg'
     artifact_product_type = chunk.ProductType.CALIBRATION
     release_type = ReleaseType.DATA
     artifact = Artifact(uri, artifact_product_type, release_type)
     artifact.parts = TypedOrderedDict((Part), (part_name, part))
     artifacts = TypedList(Artifact, artifact)
     actual_axis = wcs_util.CustomAxisUtil.compute(artifacts)
     expected_axis = None
     self.assertEqual(expected_axis, actual_axis)
     # _choose_product returns Part.product (SCIENCE),
     # user_chunk = False
     test_chunk = Chunk()
     test_chunk.product_type = chunk.ProductType.SCIENCE
     test_chunk.custom = CustomTestUtil.good_wcs()
     test_chunks = TypedList(Chunk, test_chunk)
     part_name = "test_part"
     part_product_type = chunk.ProductType.SCIENCE
     part = Part(part_name, part_product_type, test_chunks)
     uri = 'mast:HST/product/test_file.jpg'
     artifact_product_type = chunk.ProductType.PREVIEW
     release_type = ReleaseType.DATA
     artifact = Artifact(uri, artifact_product_type, release_type)
     artifact.parts = TypedOrderedDict((Part), (part_name, part))
     artifacts = TypedList(Artifact, artifact)
     actual_axis = wcs_util.CustomAxisUtil.compute(artifacts)
     expected_axis = None
     self.assertEqual(expected_axis, actual_axis)
     # _choose_product returns Part.product (CALIBRATION),
     # user_chunk = False
     test_chunk = Chunk()
     test_chunk.product_type = chunk.ProductType.SCIENCE
     test_chunk.custom = CustomTestUtil.good_wcs()
     test_chunks = TypedList(Chunk, test_chunk)
     part_name = "test_part"
     part_product_type = chunk.ProductType.CALIBRATION
     part = Part(part_name, part_product_type, test_chunks)
     uri = 'mast:HST/product/test_file.jpg'
     artifact_product_type = chunk.ProductType.PREVIEW
     release_type = ReleaseType.DATA
     artifact = Artifact(uri, artifact_product_type, release_type)
     artifact.parts = TypedOrderedDict((Part), (part_name, part))
     artifacts = TypedList(Artifact, artifact)
     actual_axis = wcs_util.CustomAxisUtil.compute(artifacts)
     expected_axis = None
     self.assertEqual(expected_axis, actual_axis)
     # _choose_product returns Chunk.product (SCIENCE), user_chunk = False
     test_chunk = Chunk()
     test_chunk.product_type = chunk.ProductType.SCIENCE
     test_chunk.custom = CustomTestUtil.good_wcs()
     test_chunks = TypedList(Chunk, test_chunk)
     part_name = "test_part"
     part_product_type = chunk.ProductType.PREVIEW
     part = Part(part_name, part_product_type, test_chunks)
     uri = 'mast:HST/product/test_file.jpg'
     artifact_product_type = chunk.ProductType.PREVIEW
     release_type = ReleaseType.DATA
     artifact = Artifact(uri, artifact_product_type, release_type)
     artifact.parts = TypedOrderedDict((Part), (part_name, part))
     artifacts = TypedList(Artifact, artifact)
     actual_axis = wcs_util.CustomAxisUtil.compute(artifacts)
     expected_axis = None
     self.assertEqual(expected_axis, actual_axis)
     # _choose_product returns Chunk.product (CALIBRATION),
     # user_chunk = False
     test_chunk = Chunk()
     test_chunk.product_type = chunk.ProductType.CALIBRATION
     test_chunk.custom = CustomTestUtil.good_wcs()
     test_chunks = TypedList(Chunk, test_chunk)
     part_name = "test_part"
     part_product_type = chunk.ProductType.PREVIEW
     part = Part(part_name, part_product_type, test_chunks)
     uri = 'mast:HST/product/test_file.jpg'
     artifact_product_type = chunk.ProductType.PREVIEW
     release_type = ReleaseType.DATA
     artifact = Artifact(uri, artifact_product_type, release_type)
     artifact.parts = TypedOrderedDict((Part), (part_name, part))
     artifacts = TypedList(Artifact, artifact)
     actual_axis = wcs_util.CustomAxisUtil.compute(artifacts)
     expected_axis = None
     self.assertEqual(expected_axis, actual_axis)
     # _choose_product returns None, user_chunk = False
     test_chunk = Chunk()
     test_chunk.product_type = chunk.ProductType.PREVIEW
     test_chunk.custom = CustomTestUtil.good_wcs()
     test_chunks = TypedList(Chunk, test_chunk)
     part_name = "test_part"
     part_product_type = chunk.ProductType.PREVIEW
     part = Part(part_name, part_product_type, test_chunks)
     uri = 'mast:HST/product/test_file.jpg'
     artifact_product_type = chunk.ProductType.PREVIEW
     release_type = ReleaseType.DATA
     artifact = Artifact(uri, artifact_product_type, release_type)
     artifact.parts = TypedOrderedDict((Part), (part_name, part))
     artifacts = TypedList(Artifact, artifact)
     actual_axis = wcs_util.CustomAxisUtil.compute(artifacts)
     expected_axis = None
     self.assertEqual(expected_axis, actual_axis)
     # _choose_product returns Artifact.product (SCIENCE),
     # user_chunk = True, Chunk.custom is None
     test_chunk = Chunk()
     test_chunk.product_type = chunk.ProductType.SCIENCE
     test_chunk.custom = None
     test_chunks = TypedList(Chunk, test_chunk)
     part_name = "test_part"
     part_product_type = chunk.ProductType.SCIENCE
     part = Part(part_name, part_product_type, test_chunks)
     uri = 'mast:HST/product/test_file.jpg'
     artifact_product_type = chunk.ProductType.SCIENCE
     release_type = ReleaseType.DATA
     artifact = Artifact(uri, artifact_product_type, release_type)
     artifact.parts = TypedOrderedDict((Part), (part_name, part))
     artifacts = TypedList(Artifact, artifact)
     expected_axis = None
     actual_axis = wcs_util.CustomAxisUtil.compute(artifacts)
     self.assertEqual(expected_axis, actual_axis)
     # _choose_product returns Artifact.product (SCIENCE),
     # user_chunk = True, Chunk.custom is not None
     # bad Chunk.custom.axis.axis.ctype
     test_chunk = Chunk()
     test_chunk.product_type = chunk.ProductType.SCIENCE
     test_chunk.custom = CustomTestUtil.bad_ctype_wcs()
     test_chunks = TypedList(Chunk, test_chunk)
     part_name = "test_part"
     part_product_type = chunk.ProductType.SCIENCE
     part = Part(part_name, part_product_type, test_chunks)
     uri = 'mast:HST/product/test_file.jpg'
     artifact_product_type = chunk.ProductType.SCIENCE
     release_type = ReleaseType.DATA
     artifact = Artifact(uri, artifact_product_type, release_type)
     artifact.parts = TypedOrderedDict((Part), (part_name, part))
     artifacts = TypedList(Artifact, artifact)
     with pytest.raises(ValueError) as ex:
         actual_axis = wcs_util.CustomAxisUtil.compute(artifacts)
     assert ('Unsupported CTYPE:' in str(ex.value))
     # _choose_product returns Artifact.product (SCIENCE),
     # user_chunk = True, Chunk.custom is not None
     # first_ctype == Chunk.custom.axis.axis.ctype
     test_chunk = Chunk()
     test_chunk.product_type = chunk.ProductType.SCIENCE
     test_chunk.custom = CustomTestUtil.good_wcs_with_function()
     test_chunks = TypedList(Chunk, test_chunk)
     part_name = "test_part"
     part_product_type = chunk.ProductType.SCIENCE
     part = Part(part_name, part_product_type, test_chunks)
     uri = 'mast:HST/product/test_file.jpg'
     artifact_product_type = chunk.ProductType.SCIENCE
     release_type = ReleaseType.DATA
     artifact = Artifact(uri, artifact_product_type, release_type)
     artifact.parts = TypedOrderedDict((Part), (part_name, part))
     artifacts = TypedList(Artifact, artifact)
     expected_ctype = "RM"
     expected_sample = Interval(-49.5, 19950.5)
     expected_samples = [expected_sample]
     expected_bounds = Interval(-49.5, 19950.5, expected_samples)
     expected_dimension = 200
     expected_axis = plane.CustomAxis(expected_ctype, expected_bounds,
                                      expected_dimension)
     actual_axis = wcs_util.CustomAxisUtil.compute(artifacts)
     self.assertEqual(expected_axis.ctype, actual_axis.ctype)
     self.assertEqual(expected_axis.bounds.lower, actual_axis.bounds.lower)
     self.assertEqual(expected_axis.bounds.upper, actual_axis.bounds.upper)
     self.assertEqual(expected_axis.bounds.samples[0].lower,
                      actual_axis.bounds.samples[0].lower)
     self.assertEqual(expected_axis.bounds.samples[0].upper,
                      actual_axis.bounds.samples[0].upper)
     self.assertEqual(expected_axis.dimension, actual_axis.dimension)
     # _choose_product returns Artifact.product (SCIENCE),
     # user_chunk = True, Chunk.custom is not None
     # first_ctype == Chunk.custom.axis.axis.ctype
     test_chunk_1 = Chunk()
     test_chunk_1.product_type = chunk.ProductType.SCIENCE
     test_chunk_1.custom = CustomTestUtil.good_wcs_with_function()
     test_chunk_2 = Chunk()
     test_chunk_2.product_type = chunk.ProductType.SCIENCE
     test_chunk_2.custom = CustomTestUtil.good_wcs_with_function()
     test_chunk_2.custom.axis.axis.ctype = "FARADAY"
     test_chunks = TypedList(Chunk, test_chunk_1, test_chunk_2)
     part_name = "test_part"
     part_product_type = chunk.ProductType.SCIENCE
     part = Part(part_name, part_product_type, test_chunks)
     uri = 'mast:HST/product/test_file.jpg'
     artifact_product_type = chunk.ProductType.SCIENCE
     release_type = ReleaseType.DATA
     artifact = Artifact(uri, artifact_product_type, release_type)
     artifact.parts = TypedOrderedDict((Part), (part_name, part))
     artifacts = TypedList(Artifact, artifact)
     expected_ctype = "RM"
     expected_sample = Interval(-49.5, 19950.5)
     expected_samples = [expected_sample]
     expected_bounds = Interval(-49.5, 19950.5, expected_samples)
     expected_dimension = 200
     expected_axis = plane.CustomAxis(expected_ctype, expected_bounds,
                                      expected_dimension)
     with pytest.raises(ValueError) as ex:
         actual_axis = wcs_util.CustomAxisUtil.compute(artifacts)
     assert ('CTYPE must be the same across all Artifacts' in str(ex.value))
예제 #4
0
 def test_compute_bounds(self):
     # user_chunk = False
     test_chunk = Chunk()
     test_chunk.product_type = chunk.ProductType.SCIENCE
     test_chunk.custom = CustomTestUtil.good_wcs()
     test_chunks = TypedList(Chunk, test_chunk)
     part_name = "test_part"
     part_product_type = chunk.ProductType.SCIENCE
     part = Part(part_name, part_product_type, test_chunks)
     uri = 'mast:HST/product/test_file.jpg'
     artifact_product_type = chunk.ProductType.SCIENCE
     release_type = ReleaseType.DATA
     artifact = Artifact(uri, artifact_product_type, release_type)
     artifact.parts = TypedOrderedDict((Part), (part_name, part))
     artifacts = TypedList(Artifact, artifact)
     product_type = None
     expected_ctype = "RM"
     actual_bounds = wcs_util.CustomAxisUtil.compute_bounds(
         artifacts, product_type, expected_ctype)
     expected_bounds = None
     self.assertEqual(expected_bounds, actual_bounds)
     # user_chunk = True, current_type != expected_ctype
     test_chunk = Chunk()
     test_chunk.product_type = chunk.ProductType.CALIBRATION
     test_chunk.custom = CustomTestUtil.good_wcs_with_function()
     test_chunks = TypedList(Chunk, test_chunk)
     part_name = "test_part"
     part_product_type = chunk.ProductType.CALIBRATION
     part = Part(part_name, part_product_type, test_chunks)
     uri = 'mast:HST/product/test_file.jpg'
     artifact_product_type = chunk.ProductType.CALIBRATION
     release_type = ReleaseType.DATA
     artifact = Artifact(uri, artifact_product_type, release_type)
     artifact.parts = TypedOrderedDict((Part), (part_name, part))
     artifacts = TypedList(Artifact, artifact)
     product_type = chunk.ProductType.CALIBRATION
     expected_ctype = "FARADAY"
     with pytest.raises(ValueError) as ex:
         wcs_util.CustomAxisUtil.compute_bounds(artifacts, product_type,
                                                expected_ctype)
     assert ('CTYPE must be the same across all Artifacts' in str(ex.value))
     # user_chunk = True, range is not None
     test_chunk = Chunk()
     test_chunk.product_type = chunk.ProductType.CALIBRATION
     test_chunk.custom = CustomTestUtil.good_wcs_with_range()
     test_chunks = TypedList(Chunk, test_chunk)
     part_name = "test_part"
     part_product_type = chunk.ProductType.CALIBRATION
     part = Part(part_name, part_product_type, test_chunks)
     uri = 'mast:HST/product/test_file.jpg'
     artifact_product_type = chunk.ProductType.CALIBRATION
     release_type = ReleaseType.DATA
     artifact = Artifact(uri, artifact_product_type, release_type)
     artifact.parts = TypedOrderedDict((Part), (part_name, part))
     artifacts = TypedList(Artifact, artifact)
     product_type = chunk.ProductType.CALIBRATION
     expected_ctype = "RM"
     actual_interval = wcs_util.CustomAxisUtil.compute_bounds(
         artifacts, product_type, expected_ctype)
     expected_interval = Interval(1.1, 11.1)
     self.assertEqual(expected_interval.lower, actual_interval.lower)
     self.assertEqual(expected_interval.upper, actual_interval.upper)
     # user_chunk = True, get_num_pixels: bounds with 3 samples that
     # traverses _merge_into_list completely
     test_chunk = Chunk()
     test_chunk.product_type = chunk.ProductType.CALIBRATION
     test_chunk.custom = CustomTestUtil.good_wcs_with_bounds_3_samples()
     test_chunks = TypedList(Chunk, test_chunk)
     part_name = "test_part"
     part_product_type = chunk.ProductType.CALIBRATION
     part = Part(part_name, part_product_type, test_chunks)
     uri = 'mast:HST/product/test_file.jpg'
     artifact_product_type = chunk.ProductType.CALIBRATION
     release_type = ReleaseType.DATA
     artifact = Artifact(uri, artifact_product_type, release_type)
     artifact.parts = TypedOrderedDict((Part), (part_name, part))
     artifacts = TypedList(Artifact, artifact)
     product_type = chunk.ProductType.CALIBRATION
     expected_ctype = "RM"
     actual_interval = wcs_util.CustomAxisUtil.compute_bounds(
         artifacts, product_type, expected_ctype)
     expected_interval = Interval(-1.2, 11.2)
     self.assertEqual(expected_interval.lower, actual_interval.lower)
     self.assertEqual(expected_interval.upper, actual_interval.upper)
     # user_chunk = True, function is not None
     test_chunk = Chunk()
     test_chunk.product_type = chunk.ProductType.CALIBRATION
     test_chunk.custom = CustomTestUtil.good_wcs_with_function()
     test_chunks = TypedList(Chunk, test_chunk)
     part_name = "test_part"
     part_product_type = chunk.ProductType.CALIBRATION
     part = Part(part_name, part_product_type, test_chunks)
     uri = 'mast:HST/product/test_file.jpg'
     artifact_product_type = chunk.ProductType.CALIBRATION
     release_type = ReleaseType.DATA
     artifact = Artifact(uri, artifact_product_type, release_type)
     artifact.parts = TypedOrderedDict((Part), (part_name, part))
     artifacts = TypedList(Artifact, artifact)
     product_type = chunk.ProductType.CALIBRATION
     expected_ctype = "RM"
     actual_interval = wcs_util.CustomAxisUtil.compute_bounds(
         artifacts, product_type, expected_ctype)
     expected_interval = Interval(-49.5, 19950.5)
     self.assertEqual(expected_interval.lower, actual_interval.lower)
     self.assertEqual(expected_interval.upper, actual_interval.upper)
예제 #5
0
 def test_compute_dimension_from_wcs(self):
     # bounds is None
     bounds = None
     artifacts = None
     product_type = None
     expected_ctype = None
     actual_dimension = wcs_util.CustomAxisUtil.compute_dimension_from_wcs(
         bounds, artifacts, product_type, expected_ctype)
     expected_dimension = None
     self.assertEqual(expected_dimension, actual_dimension)
     # bounds is not None, user_chunk = True, current_type != expected_ctype
     bounds = Interval(1.1, 11.1)
     test_chunk = Chunk()
     test_chunk.product_type = chunk.ProductType.CALIBRATION
     test_chunk.custom = CustomTestUtil.good_wcs_with_function()
     test_chunks = TypedList(Chunk, test_chunk)
     part_name = "test_part"
     part_product_type = chunk.ProductType.CALIBRATION
     part = Part(part_name, part_product_type, test_chunks)
     uri = 'mast:HST/product/test_file.jpg'
     artifact_product_type = chunk.ProductType.CALIBRATION
     release_type = ReleaseType.DATA
     artifact = Artifact(uri, artifact_product_type, release_type)
     artifact.parts = TypedOrderedDict((Part), (part_name, part))
     artifacts = TypedList(Artifact, artifact)
     product_type = chunk.ProductType.CALIBRATION
     expected_ctype = "FARADAY"
     with pytest.raises(ValueError) as ex:
         wcs_util.CustomAxisUtil.compute_dimension_from_wcs(
             bounds, artifacts, product_type, expected_ctype)
     assert ('CTYPE must be the same across all Artifacts' in str(ex.value))
     # bounds is not None, user_chunk = True, current_type is not None and
     # current_type == expected_ctype, ss >= scale, num = 1
     bounds = Interval(1.1, 11.1)
     test_chunk = Chunk()
     test_chunk.product_type = chunk.ProductType.CALIBRATION
     test_chunk.custom = CustomTestUtil.good_wcs_with_negative_delta()
     test_chunks = TypedList(Chunk, test_chunk)
     part_name = "test_part"
     part_product_type = chunk.ProductType.CALIBRATION
     part = Part(part_name, part_product_type, test_chunks)
     uri = 'mast:HST/product/test_file.jpg'
     artifact_product_type = chunk.ProductType.CALIBRATION
     release_type = ReleaseType.DATA
     artifact = Artifact(uri, artifact_product_type, release_type)
     artifact.parts = TypedOrderedDict((Part), (part_name, part))
     artifacts = TypedList(Artifact, artifact)
     product_type = chunk.ProductType.CALIBRATION
     expected_ctype = "RM"
     actual_dimension = wcs_util.CustomAxisUtil.compute_dimension_from_wcs(
         bounds, artifacts, product_type, expected_ctype)
     expected_dimension = 200
     self.assertEqual(expected_dimension, actual_dimension)
     # bounds is not None, user_chunk = False, sw = None
     test_chunk = Chunk()
     test_chunk.product_type = chunk.ProductType.SCIENCE
     test_chunk.custom = CustomTestUtil.good_wcs()
     test_chunks = TypedList(Chunk, test_chunk)
     part_name = "test_part"
     part_product_type = chunk.ProductType.SCIENCE
     part = Part(part_name, part_product_type, test_chunks)
     uri = 'mast:HST/product/test_file.jpg'
     artifact_product_type = chunk.ProductType.SCIENCE
     release_type = ReleaseType.DATA
     artifact = Artifact(uri, artifact_product_type, release_type)
     artifact.parts = TypedOrderedDict((Part), (part_name, part))
     artifacts = TypedList(Artifact, artifact)
     product_type = None
     expected_ctype = "RM"
     actual_dimension = wcs_util.CustomAxisUtil.compute_dimension_from_wcs(
         bounds, artifacts, product_type, expected_ctype)
     expected_dimension = None
     self.assertEqual(expected_dimension, actual_dimension)
     # bounds is not None, user_chunk = True, current_type is not None and
     # current_type == expected_ctype, ss >= scale, num = 2
     bounds = Interval(1.1, 11.1)
     test_chunk1 = Chunk()
     test_chunk1.product_type = chunk.ProductType.CALIBRATION
     test_chunk1.custom = CustomTestUtil.good_wcs_with_negative_delta()
     test_chunk2 = Chunk()
     test_chunk2.product_type = chunk.ProductType.CALIBRATION
     test_chunk2.custom = CustomTestUtil.good_wcs()
     test_chunks = TypedList(Chunk, test_chunk1, test_chunk2)
     part_name = "test_part"
     part_product_type = chunk.ProductType.CALIBRATION
     part = Part(part_name, part_product_type, test_chunks)
     uri = 'mast:HST/product/test_file.jpg'
     artifact_product_type = chunk.ProductType.CALIBRATION
     release_type = ReleaseType.DATA
     artifact = Artifact(uri, artifact_product_type, release_type)
     artifact.parts = TypedOrderedDict((Part), (part_name, part))
     artifacts = TypedList(Artifact, artifact)
     product_type = chunk.ProductType.CALIBRATION
     expected_ctype = "RM"
     actual_dimension = wcs_util.CustomAxisUtil.compute_dimension_from_wcs(
         bounds, artifacts, product_type, expected_ctype)
     expected_dimension = 500
     self.assertEqual(expected_dimension, actual_dimension)
예제 #6
0
 def test_compute_dimension_from_range_bounds(self):
     # user_chunk = False, matches is None
     test_chunk = Chunk()
     test_chunk.product_type = chunk.ProductType.SCIENCE
     test_chunk.custom = CustomTestUtil.good_wcs()
     test_chunks = TypedList(Chunk, test_chunk)
     part_name = "test_part"
     part_product_type = chunk.ProductType.SCIENCE
     part = Part(part_name, part_product_type, test_chunks)
     uri = 'mast:HST/product/test_file.jpg'
     artifact_product_type = chunk.ProductType.SCIENCE
     release_type = ReleaseType.DATA
     artifact = Artifact(uri, artifact_product_type, release_type)
     artifact.parts = TypedOrderedDict((Part), (part_name, part))
     artifacts = TypedList(Artifact, artifact)
     product_type = None
     expected_ctype = "RM"
     actual_num_pixels = \
         wcs_util.CustomAxisUtil.compute_dimension_from_range_bounds(
             artifacts, product_type, expected_ctype)
     expected_num_pixels = None
     self.assertEqual(expected_num_pixels, actual_num_pixels)
     # user_chunk = False, ctype not match
     test_chunk = Chunk()
     test_chunk.product_type = chunk.ProductType.SCIENCE
     test_chunk.custom = CustomTestUtil.good_wcs()
     test_chunks = TypedList(Chunk, test_chunk)
     part_name = "test_part"
     part_product_type = chunk.ProductType.SCIENCE
     part = Part(part_name, part_product_type, test_chunks)
     uri = 'mast:HST/product/test_file.jpg'
     artifact_product_type = chunk.ProductType.SCIENCE
     release_type = ReleaseType.DATA
     artifact = Artifact(uri, artifact_product_type, release_type)
     artifact.parts = TypedOrderedDict((Part), (part_name, part))
     artifacts = TypedList(Artifact, artifact)
     product_type = chunk.ProductType.CALIBRATION
     expected_ctype = "RM"
     actual_num_pixels = \
         wcs_util.CustomAxisUtil.compute_dimension_from_range_bounds(
             artifacts, product_type, expected_ctype)
     expected_num_pixels = None
     self.assertEqual(expected_num_pixels, actual_num_pixels)
     # user_chunk = False, ptype not match
     test_chunk = Chunk()
     test_chunk.product_type = chunk.ProductType.CALIBRATION
     test_chunk.custom = CustomTestUtil.good_wcs()
     test_chunks = TypedList(Chunk, test_chunk)
     part_name = "test_part"
     part_product_type = chunk.ProductType.SCIENCE
     part = Part(part_name, part_product_type, test_chunks)
     uri = 'mast:HST/product/test_file.jpg'
     artifact_product_type = chunk.ProductType.SCIENCE
     release_type = ReleaseType.DATA
     artifact = Artifact(uri, artifact_product_type, release_type)
     artifact.parts = TypedOrderedDict((Part), (part_name, part))
     artifacts = TypedList(Artifact, artifact)
     product_type = chunk.ProductType.CALIBRATION
     expected_ctype = "RM"
     actual_num_pixels = \
         wcs_util.CustomAxisUtil.compute_dimension_from_range_bounds(
             artifacts, product_type, expected_ctype)
     expected_num_pixels = None
     self.assertEqual(expected_num_pixels, actual_num_pixels)
     # user_chunk = False, atype not match
     test_chunk = Chunk()
     test_chunk.product_type = chunk.ProductType.CALIBRATION
     test_chunk.custom = CustomTestUtil.good_wcs()
     test_chunks = TypedList(Chunk, test_chunk)
     part_name = "test_part"
     part_product_type = chunk.ProductType.CALIBRATION
     part = Part(part_name, part_product_type, test_chunks)
     uri = 'mast:HST/product/test_file.jpg'
     artifact_product_type = chunk.ProductType.SCIENCE
     release_type = ReleaseType.DATA
     artifact = Artifact(uri, artifact_product_type, release_type)
     artifact.parts = TypedOrderedDict((Part), (part_name, part))
     artifacts = TypedList(Artifact, artifact)
     product_type = chunk.ProductType.CALIBRATION
     expected_ctype = "RM"
     actual_num_pixels = \
         wcs_util.CustomAxisUtil.compute_dimension_from_range_bounds(
             artifacts, product_type, expected_ctype)
     expected_num_pixels = None
     self.assertEqual(expected_num_pixels, actual_num_pixels)
     # user_chunk = True, current_type != expected_ctype
     test_chunk = Chunk()
     test_chunk.product_type = chunk.ProductType.CALIBRATION
     test_chunk.custom = CustomTestUtil.good_wcs_with_function()
     test_chunks = TypedList(Chunk, test_chunk)
     part_name = "test_part"
     part_product_type = chunk.ProductType.CALIBRATION
     part = Part(part_name, part_product_type, test_chunks)
     uri = 'mast:HST/product/test_file.jpg'
     artifact_product_type = chunk.ProductType.CALIBRATION
     release_type = ReleaseType.DATA
     artifact = Artifact(uri, artifact_product_type, release_type)
     artifact.parts = TypedOrderedDict((Part), (part_name, part))
     artifacts = TypedList(Artifact, artifact)
     product_type = chunk.ProductType.CALIBRATION
     expected_ctype = "FARADAY"
     with pytest.raises(ValueError) as ex:
         wcs_util.CustomAxisUtil.compute_dimension_from_range_bounds(
             artifacts, product_type, expected_ctype)
     assert ('CTYPE must be the same across all Artifacts' in str(ex.value))
     # user_chunk = True, get_num_pixels: range is not None
     test_chunk = Chunk()
     test_chunk.product_type = chunk.ProductType.CALIBRATION
     test_chunk.custom = CustomTestUtil.good_wcs_with_range()
     test_chunks = TypedList(Chunk, test_chunk)
     part_name = "test_part"
     part_product_type = chunk.ProductType.CALIBRATION
     part = Part(part_name, part_product_type, test_chunks)
     uri = 'mast:HST/product/test_file.jpg'
     artifact_product_type = chunk.ProductType.CALIBRATION
     release_type = ReleaseType.DATA
     artifact = Artifact(uri, artifact_product_type, release_type)
     artifact.parts = TypedOrderedDict((Part), (part_name, part))
     artifacts = TypedList(Artifact, artifact)
     product_type = chunk.ProductType.CALIBRATION
     expected_ctype = "RM"
     actual_num_pixels = \
         wcs_util.CustomAxisUtil.compute_dimension_from_range_bounds(
             artifacts, product_type, expected_ctype)
     expected_num_pixels = 10
     self.assertEqual(expected_num_pixels, actual_num_pixels)
     # user_chunk = True, get_num_pixels: bounds with 3 samples that
     # traverses _merge_into_list completely
     test_chunk = Chunk()
     test_chunk.product_type = chunk.ProductType.CALIBRATION
     test_chunk.custom = CustomTestUtil.good_wcs_with_bounds_3_samples()
     test_chunks = TypedList(Chunk, test_chunk)
     part_name = "test_part"
     part_product_type = chunk.ProductType.CALIBRATION
     part = Part(part_name, part_product_type, test_chunks)
     uri = 'mast:HST/product/test_file.jpg'
     artifact_product_type = chunk.ProductType.CALIBRATION
     release_type = ReleaseType.DATA
     artifact = Artifact(uri, artifact_product_type, release_type)
     artifact.parts = TypedOrderedDict((Part), (part_name, part))
     artifacts = TypedList(Artifact, artifact)
     product_type = chunk.ProductType.CALIBRATION
     expected_ctype = "RM"
     actual_num_pixels = \
         wcs_util.CustomAxisUtil.compute_dimension_from_range_bounds(
             artifacts, product_type, expected_ctype)
     expected_num_pixels = 11
     self.assertEqual(expected_num_pixels, actual_num_pixels)
     # user_chunk = True, range = None, bounds = None, use_func and
     # function = None
     test_chunk = Chunk()
     test_chunk.product_type = chunk.ProductType.CALIBRATION
     test_chunk.custom = CustomTestUtil.good_wcs()
     test_chunks = TypedList(Chunk, test_chunk)
     part_name = "test_part"
     part_product_type = chunk.ProductType.CALIBRATION
     part = Part(part_name, part_product_type, test_chunks)
     uri = 'mast:HST/product/test_file.jpg'
     artifact_product_type = chunk.ProductType.CALIBRATION
     release_type = ReleaseType.DATA
     artifact = Artifact(uri, artifact_product_type, release_type)
     artifact.parts = TypedOrderedDict((Part), (part_name, part))
     artifacts = TypedList(Artifact, artifact)
     product_type = chunk.ProductType.CALIBRATION
     expected_ctype = "RM"
     actual_num_pixels = \
         wcs_util.CustomAxisUtil.compute_dimension_from_range_bounds(
             artifacts, product_type, expected_ctype)
     expected_num_pixels = None
     self.assertEqual(expected_num_pixels, actual_num_pixels)