Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding schema for Source Catalog #374

Closed
wants to merge 10 commits into from
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

- Updated product table names. [#382]

- Added schema for Source Catalog and Segmentation Map. [#374]

0.19.0 (2024-02-09)
-------------------
Expand Down
10 changes: 10 additions & 0 deletions src/rad/resources/manifests/datamodels-1.0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,16 @@ tags:
title: Calibration reference file names.
description: |-
Calibration reference file names.
- tag_uri: asdf://stsci.edu/datamodels/roman/tags/source_catalog-1.0.0
schema_uri: asdf://stsci.edu/datamodels/roman/schemas/source_catalog-1.0.0
title: Source catalog
description: |-
Photometry and astrometry computed by the Source Catalog Step
- tag_uri: asdf://stsci.edu/datamodels/roman/tags/segmentation_map-1.0.0
schema_uri: asdf://stsci.edu/datamodels/roman/schemas/segmentation_map-1.0.0
title: Segmentation map
description: |-
Segmentation map computed by the Source Catalog Step
# Tagged Scalars
- tag_uri: asdf://stsci.edu/datamodels/roman/tags/calibration_software_version-1.0.0
schema_uri: asdf://stsci.edu/datamodels/roman/schemas/tagged_scalars/calibration_software_version-1.0.0
Expand Down
38 changes: 38 additions & 0 deletions src/rad/resources/schemas/segmentation_map-1.0.0.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
%YAML 1.1
---
$schema: asdf://stsci.edu/datamodels/roman/schemas/rad_schema-1.0.0
id: asdf://stsci.edu/datamodels/roman/schemas/segmentation_map-1.0.0

title: Segmentation map generated by the Source Catalog Step.

datamodel_name: SegmentationMapModel

archive_meta: None
type: object
properties:
meta:
allOf:
- type: object
properties:
basic:
tag: asdf://stsci.edu/datamodels/roman/tags/mosaic_basic-1.0.0
coordinates:
tag: asdf://stsci.edu/datamodels/roman/tags/coordinates-1.0.0
program:
tag: asdf://stsci.edu/datamodels/roman/tags/program-1.0.0
wcsinfo:
tag: asdf://stsci.edu/datamodels/roman/tags/mosaic_wcsinfo-1.0.0
required: [basic, coordinates, program, wcsinfo]
data:
title: Segmentation map
description: |
Segmentation map of an image model, zeros correspond to background.
tag: tag:stsci.edu:asdf/core/ndarray-1.*
ndim: 2
datatype: uint32
exact_datatype: true

required: [meta, data]
flowStyle: block
propertyOrder: [meta, data]
...
37 changes: 37 additions & 0 deletions src/rad/resources/schemas/source_catalog-1.0.0.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
%YAML 1.1
---
$schema: asdf://stsci.edu/datamodels/roman/schemas/rad_schema-1.0.0
id: asdf://stsci.edu/datamodels/roman/schemas/source_catalog-1.0.0

title: Source catalog generated by the Source Catalog Step.

datamodel_name: SourceCatalogModel

archive_meta: None
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

archive_meta is used to indicate this is the entry point for storing data in the db (e.g. wfi_image-1.0.0.yaml, guidewindow-1.0.0.yaml, etc.) Is this such a file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The honest answer is: I don't know. I'm waiting on instructions from RTB on these specs.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kdupriestsci The source catalogs and the segmentation maps are officially a data product that needs to be stored in the archive. They are new products we are developing now but "at the level of wfi_image". Does this answer your question? What would be the value of this keyword then?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nden I'm not sure what you mean by "at the level of wfi_image". If they are their own files and not part of the wfi_image file then having the archive_meta: None is correct (we are not yet assigning a value to this keyword yet, we're just checking for its existence.

Please note that we don't have filetypes for Segmentation Maps or Source Catalogs in the archive (unless they're going under a different name), so this will require coordination with the db (either Azure or Oak, depending on who's doing it).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kdupriestsci Sorry for the bad terminology. By "at the same level as wfi_image" I meant that these will be separate files. And thanks for clarifying the correct value in this case is None.

@ddavis-stsci @schlafly Could you coordinate with the rest of the team the work on the filetypes in the DB?

Copy link
Collaborator

@ddavis-stsci ddavis-stsci Feb 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should bring this up in the RAD group but I think the correct filetype will be "Science WFI Level 4", FileTypeID=64.

type: object
properties:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

General questions: Since this is a data model should it have a meta keyword? If so what metadata should be included.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know yet – I'll follow up when I get directions from RTB.

meta:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please put meta above the binary contents for both this and segmentation_map-1.0.0.yaml?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yikes, order matters?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't matter code-wise (nor in the end file, you.. you set that order below). More about readability of schemas.

allOf:
- type: object
properties:
basic:
tag: asdf://stsci.edu/datamodels/roman/tags/mosaic_basic-1.0.0
coordinates:
tag: asdf://stsci.edu/datamodels/roman/tags/coordinates-1.0.0
photometry:
tag: asdf://stsci.edu/datamodels/roman/tags/photometry-1.0.0
program:
tag: asdf://stsci.edu/datamodels/roman/tags/program-1.0.0
wcsinfo:
tag: asdf://stsci.edu/datamodels/roman/tags/mosaic_wcsinfo-1.0.0
required: [basic, coordinates, photometry, program, wcsinfo]
source_catalog:
title: Source Catalog
description: |
Photometry and astrometry computed in the Source Catalog Step.
tag: tag:astropy.org:astropy/table/table-1.*

required: [meta, source_catalog]
flowStyle: block
propertyOrder: [meta, source_catalog]
...