Skip to content

Commit

Permalink
Updated ProductType dictionary (#181)
Browse files Browse the repository at this point in the history
* Updated ProductType dictionary

---------

Co-authored-by: Adrian Damian <Adrian.Damian@nrc.ca>
  • Loading branch information
andamian and Adrian Damian authored May 16, 2024
1 parent 350677b commit 0df74be
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cibuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ["3.7","3.8","3.9","3.10","3.11"]
python-version: ["3.8","3.9","3.10","3.11","3.12"]
package: [caom2, caom2utils, caom2repo]
exclude:
# temporary since hdf5 is not working yet
Expand Down
76 changes: 52 additions & 24 deletions caom2/caom2/chunk.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# ****************** CANADIAN ASTRONOMY DATA CENTRE *******************
# ************* CENTRE CANADIEN DE DONNÉES ASTRONOMIQUES **************
#
# (c) 2022. (c) 2022.
# (c) 2024. (c) 2024.
# Government of Canada Gouvernement du Canada
# National Research Council Conseil national de recherches
# Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6
Expand Down Expand Up @@ -82,31 +82,59 @@

class ProductType(OrderedEnum):
"""
SCIENCE: "science"
CALIBRATION: "calibration"
PREVIEW: "preview"
INFO: "info"
NOISE: "noise"
WEIGHT: "weight"
AUXILIARY: "auxiliary"
THUMBNAIL: "thumbnail"
BIAS: "bias"
DARK: "dark"
FLAT: "flat"
WAVECAL: "wavecal"
Subset of IVOA DataLink terms at:
https://www.ivoa.net/rdf/datalink/core/2022-01-27/datalink.html
THIS = "this"
AUXILIARY = "auxiliary"
BIAS = 'bias'
CALIBRATION = 'calibration'
CODERIVED = 'coderived'
DARK = 'dark'
DOCUMENTATION = 'documentation'
ERROR = 'error'
FLAT = 'flat'
NOISE = 'noise'
PREVIEW = 'preview'
PREVIEW_IMAGE = 'preview-image'
PREVIEW_PLOT = 'preview-plot'
THUMBNAIL = 'thumbnail'
WEIGHT = 'weight'
"""
SCIENCE = "science"
CALIBRATION = "calibration"
PREVIEW = "preview"
INFO = "info"
NOISE = "noise"
WEIGHT = "weight"

THIS = "this"

AUXILIARY = "auxiliary"
THUMBNAIL = "thumbnail"
BIAS = "bias"
DARK = "dark"
FLAT = "flat"
WAVECAL = "wavecal"
BIAS = 'bias'
CALIBRATION = 'calibration'
CODERIVED = 'coderived'
DARK = 'dark'
DOCUMENTATION = 'documentation'
ERROR = 'error'
FLAT = 'flat'
NOISE = 'noise'
PREVIEW = 'preview'
PREVIEW_IMAGE = 'preview-image'
PREVIEW_PLOT = 'preview-plot'
THUMBNAIL = 'thumbnail'
WEIGHT = 'weight'

# DataLink terms explicitly not included
# counterpart
# cutout
# derivation
# detached - header
# package
# proc
# progenitor

# CAOM specific terms public
SCIENCE = 'science' # this

# deprecated
# INFO = 'info'
# CATALOG = 'catalog'


__all__ = ['ProductType', 'Chunk', 'ObservableAxis', 'SpatialWCS',
Expand Down
9 changes: 6 additions & 3 deletions caom2/caom2/tests/test_chunk.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# ****************** CANADIAN ASTRONOMY DATA CENTRE *******************
# ************* CENTRE CANADIEN DE DONNÉES ASTRONOMIQUES **************
#
# (c) 2022. (c) 2022.
# (c) 2024. (c) 2024.
# Government of Canada Gouvernement du Canada
# National Research Council Conseil national de recherches
# Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6
Expand Down Expand Up @@ -92,18 +92,21 @@ def test_all(self):
self.assertEqual(chunk.ProductType[
chunk.ProductType.SCIENCE.name].value, "science")

self.assertEqual(chunk.ProductType.THIS.value, "this")
self.assertEqual(chunk.ProductType.SCIENCE.value, "science")
self.assertEqual(chunk.ProductType.CALIBRATION.value, "calibration")
self.assertEqual(chunk.ProductType.PREVIEW.value, "preview")
self.assertEqual(chunk.ProductType.INFO.value, "info")
self.assertEqual(chunk.ProductType.NOISE.value, "noise")
self.assertEqual(chunk.ProductType.WEIGHT.value, "weight")
self.assertEqual(chunk.ProductType.AUXILIARY.value, "auxiliary")
self.assertEqual(chunk.ProductType.THUMBNAIL.value, "thumbnail")
self.assertEqual(chunk.ProductType.BIAS.value, "bias")
self.assertEqual(chunk.ProductType.DARK.value, "dark")
self.assertEqual(chunk.ProductType.FLAT.value, "flat")
self.assertEqual(chunk.ProductType.WAVECAL.value, "wavecal")
self.assertEqual(chunk.ProductType.CODERIVED.value, "coderived")
self.assertEqual(chunk.ProductType.DOCUMENTATION.value, "documentation")
self.assertEqual(chunk.ProductType.PREVIEW_IMAGE.value, "preview-image")
self.assertEqual(chunk.ProductType.PREVIEW_PLOT.value, "preview-plot")


class TestChunk(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion caom2/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ url = http://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/caom2
edit_on_github = False
github_project = opencadc/caom2tools
# version should be PEP386 compatible (http://www.python.org/dev/peps/pep-0386)
version = 2.6
version = 2.6.1

[options]
install_requires =
Expand Down
2 changes: 1 addition & 1 deletion caom2/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def run_tests(self):
use_2to3=False,
setup_requires=['pytest-runner'],
entry_points=entry_points,
python_requires='>=3.7, <4',
python_requires='>=3.8, <4',
packages=find_packages(),
package_data={PACKAGENAME: ['data/*', 'tests/data/*', '*/data/*', '*/tests/data/*']},
classifiers=[
Expand Down
2 changes: 1 addition & 1 deletion caom2/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name = caom2

[tox]
envlist =
py{27,34,35,36,37,38,39,310}
py{38,39,310,311,312}
requires =
pip >= 19.3.1

Expand Down
2 changes: 1 addition & 1 deletion caom2repo/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def run(self):
use_2to3=False,
setup_requires=['pytest-runner'],
entry_points=entry_points,
python_requires='>=3.7, <4',
python_requires='>=3.8, <4',
packages=find_packages(),
package_data={PACKAGENAME: ['data/*', 'tests/data/*', '*/data/*', '*/tests/data/*']},
classifiers=[
Expand Down
4 changes: 2 additions & 2 deletions caom2utils/caom2utils/tests/test_fits2caom2.py
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ def test_help():
<caom2:artifacts>
<caom2:artifact caom2:id="d2893703-b21e-425f-b7d0-ca1f58fdc011">
<caom2:uri>caom:CGPS/TEST/4axes_obs.fits</caom2:uri>
<caom2:productType>info</caom2:productType>
<caom2:productType>auxiliary</caom2:productType>
<caom2:parts>
<caom2:part caom2:id="d2893703-b21e-425f-b7d0-ca1f58fdc011">
<caom2:name>0</caom2:name>
Expand All @@ -692,7 +692,7 @@ def test_augment_observation():
test_obs_blueprint.set('Observation.telescope.geoLocationZ', '4741018.33097')

test_obs_blueprint.set('Plane.dataProductType', 'cube')
test_obs_blueprint.set('Artifact.productType', 'info')
test_obs_blueprint.set('Artifact.productType', 'auxiliary')
test_obs_blueprint.set('Artifact.releaseType', 'data')
test_obs_blueprint.set('Plane.calibrationLevel', '2')
test_fitsparser = FitsParser(sample_file_4axes_obs, test_obs_blueprint)
Expand Down
2 changes: 1 addition & 1 deletion caom2utils/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def run(self):
use_2to3=False,
setup_requires=['pytest-runner'],
entry_points=entry_points,
python_requires='>=3.7, <4',
python_requires='>=3.8, <4',
packages=find_packages(),
package_data={PACKAGENAME: ['data/*', 'tests/data/*', '*/data/*', '*/tests/data/*']},
classifiers=[
Expand Down

0 comments on commit 0df74be

Please sign in to comment.