Skip to content
Snippets Groups Projects

WS-1769 VLA manifest creation

Merged Daniel Nemergut requested to merge ws-1769_fix_image_manifest_creation into 2.8.2-DEVELOPMENT
1 unresolved thread

This sets any *pbcor.tt0.fits images to be the science products and assigns similarly named images as ancillaries to them. If no science product with a similar name exists for an image, it'll be assigned as an ancillary to the first one to not leave any images behind.

Merge request reports

Merge request pipeline #10033 passed

Merge request pipeline passed for d6fabd4e

Merged by Daniel NemergutDaniel Nemergut 1 year ago (Jun 1, 2023 3:01pm UTC)

Loading

Pipeline #10034 failed

Pipeline failed for 8da83d3f on 2.8.2-DEVELOPMENT

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Here's an output example (added some junk data to check edge cases):

    {
        "parameters": {
            "telescope": "EVLA",
            "reingest": "false",
            "ngas_ingest": "true",
            "ingestion_path": "/lustre/aoc/cluster/pipeline/docker/workspaces/staging/tmp4dbkvftp",
            "calibrate": "false",
            "additional_metadata": "./aux_image_metadata.json"
        },
        "input_group": {
            "science_products": [
                {
                    "locator": ""
                }
            ]
        },
        "output_group": {
            "science_products": [
                {
                    "type": "fits_image",
                    "filename": "16B-069.MJD57713.51329133102.J1522+3934_sci.K_band.cont.I.pbcor.tt0.fits",
                    "ancillary_products": [
                        {
                            "type": "spectral_index",
                            "filename": "16B-069.MJD57713.51329133102.J1522+3934_sci.K_band.cont.I.alpha.error.fits"
                        },
                        {
                            "type": "spectral_index",
                            "filename": "16B-069.MJD57713.51329133102.J1522+3934_sci.K_band.cont.I.alpha.fits"
                        },
                        {
                            "type": "clean_mask",
                            "filename": "16B-069.MJD57713.51329133102.J1522+3934_sci.K_band.cont.I.mask.fits"
                        },
                        {
                            "type": "primary_beam",
                            "filename": "16B-069.MJD57713.51329133102.J1522+3934_sci.K_band.cont.I.pb.tt0.fits"
                        },
                        {
                            "type": "fits_image",
                            "filename": "16B-069.MJD57713.51329133102.J1522+3934_sci.K_band.cont.I.tt0.fits"
                        },
                        {
                            "type": "fits_image",
                            "filename": "16B-069.MJD57713.51329133102.J1522+3934_sci.K_band.cont.I.tt1.fits"
                        },
                        {
                            "type": "spectral_index",
                            "filename": "16B-069.MJD57713.51329133102.J1522+3934_sci.Q_band.cont.I.alpha.error.fits"
                        }
                    ]
                },
                {
                    "type": "fits_image",
                    "filename": "16B-069.MJD57713.51329133102.J1522+3934_sci.P_band.cont.I.pbcor.tt0.fits"
                },
                {
                    "type": "fits_image",
                    "filename": "16B-069.MJD57713.51329133102.J1522+3934_sci.X_band.cont.I.pbcor.tt0.fits",
                    "ancillary_products": [
                        {
                            "type": "spectral_index",
                            "filename": "16B-069.MJD57713.51329133102.J1522+3934_sci.X_band.cont.I.alpha.error.fits"
                        },
                        {
                            "type": "spectral_index",
                            "filename": "16B-069.MJD57713.51329133102.J1522+3934_sci.X_band.cont.I.alpha.fits"
                        },
                        {
                            "type": "clean_mask",
                            "filename": "16B-069.MJD57713.51329133102.J1522+3934_sci.X_band.cont.I.mask.fits"
                        },
                        {
                            "type": "primary_beam",
                            "filename": "16B-069.MJD57713.51329133102.J1522+3934_sci.X_band.cont.I.pb.tt0.fits"
                        },
                        {
                            "type": "fits_image",
                            "filename": "16B-069.MJD57713.51329133102.J1522+3934_sci.X_band.cont.I.tt0.fits"
                        },
                        {
                            "type": "fits_image",
                            "filename": "16B-069.MJD57713.51329133102.J1522+3934_sci.X_band.cont.I.tt1.fits"
                        }
                    ]
                }
            ],
            "ancillary_products": [
                {
                    "type": "pipeline_weblog",
                    "filename": "weblog.tgz"
                },
                {
                    "type": "pipeline_artifacts",
                    "filename": "pipeline_artifacts_2023_05_26T14_40_01.tar"
                },
                {
                    "type": "ingestion_artifacts",
                    "filename": "ingestion_artifacts_2023_06_01T04_11_14.694.tar"
                }
            ]
        }
    }
  • Charlotte Hausman approved this merge request

    approved this merge request

  • Nathan Bockisch approved this merge request

    approved this merge request

  • Brittany Faciane approved this merge request

    approved this merge request

  • Daniel Nemergut mentioned in commit 8da83d3f

    mentioned in commit 8da83d3f

  • Daniel Lyons
86 86 ]
87 87 self.logger.info(f"Science Product ancillaries are: {image_files}")
88 88
89 sp_aps = []
89 # Build a mapping of science products -> ancillaries
90 sp_aps = {k: [] for k in sp_image_files}
90 91 for image_file in image_files:
91 92 sp_ap = self._build_ancillary_image_science_product(image_file)
92 sp_aps.append(sp_ap)
93 for sp in sp_aps.keys():
94 if image_file.name.startswith(sp.name.split(PBCOR)[0]):
95 # Add this as an ancillary to a similarly named science product
96 sp_aps.get(sp).append(sp_ap)
97 break
98 elif sp == next(reversed(sp_aps.keys())):
  • I was nervous about this line because in some languages the keys of a dictionary are not returned in any particular order, but it turns out in Python, they are returned in insertion order. So this would deterministically get you the last key, which is what I think you want.

  • Thanks for double checking that, I did want a way to know we're done iterating through the keys by checking the last element. I think in older Python versions this wasn't the case?

  • Per the documentation, this was changed in Python 3.7, I think before that it was not in a defined order.

  • Please register or sign in to reply
Please register or sign in to reply
Loading