Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-37440

Bug - Firefly doesn't use WCS for mask and variance planes

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: To Do
    • Resolution: Unresolved
    • Fix Version/s: None
    • Component/s: display_firefly, Firefly
    • Labels:
      None
    • Team:
      Portal
    • Urgent?:
      No

      Description

      When plotting calexp mask and variance using Firefly, the WCS is not being inherited. The calexp image has the correct coordinates when you mouse over the images in Firefly, but the mask and the variance appear to be using a default ra and dec, where the bottom left corner is displayed as around ~23h58m00s and ~0d29m00s

      And example notebook that shows the issue can be found at:

      https://github.com/lsst-dm/ap_pipe-notebooks/blob/873176ea1d87870c1678037b13e7ff48bd4c56fb/notebooks/Firefly-Bug-Notebook.ipynb

      (This is on the branch u/bsmart/Firefly-bugs of https://github.com/lsst-dm/ap_pipe-notebooks .)

        Attachments

          Issue Links

            Activity

            No builds found.
            bsmart Brianna Smart created issue -
            gpdf Gregory Dubois-Felsmann made changes -
            Field Original Value New Value
            Description When plotting calexp mask and variance using Firefly, the WCS is not being inherited. The calexp image has the correct coordinates when you mouse over the images in Firefly, but the mask and the variance appear to be using a default ra and dec, where the bottom left corner is displayed as around ~23h58m00s and ~0d29m00s

            And example notebook that shows the issue can be found at:

            https://github.com/lsst-dm/ap_pipe-notebooks/blob/873176ea1d87870c1678037b13e7ff48bd4c56fb/notebooks/Firefly-Bug-Notebook.ipynb
            When plotting calexp mask and variance using Firefly, the WCS is not being inherited. The calexp image has the correct coordinates when you mouse over the images in Firefly, but the mask and the variance appear to be using a default ra and dec, where the bottom left corner is displayed as around ~23h58m00s and ~0d29m00s

            And example notebook that shows the issue can be found at:

            https://github.com/lsst-dm/ap_pipe-notebooks/blob/873176ea1d87870c1678037b13e7ff48bd4c56fb/notebooks/Firefly-Bug-Notebook.ipynb

            (This in on the branch {{u/bsmart/Firefly-bugs}} of https://github.com/lsst-dm/ap_pipe-notebooks .)
            gpdf Gregory Dubois-Felsmann made changes -
            Description When plotting calexp mask and variance using Firefly, the WCS is not being inherited. The calexp image has the correct coordinates when you mouse over the images in Firefly, but the mask and the variance appear to be using a default ra and dec, where the bottom left corner is displayed as around ~23h58m00s and ~0d29m00s

            And example notebook that shows the issue can be found at:

            https://github.com/lsst-dm/ap_pipe-notebooks/blob/873176ea1d87870c1678037b13e7ff48bd4c56fb/notebooks/Firefly-Bug-Notebook.ipynb

            (This in on the branch {{u/bsmart/Firefly-bugs}} of https://github.com/lsst-dm/ap_pipe-notebooks .)
            When plotting calexp mask and variance using Firefly, the WCS is not being inherited. The calexp image has the correct coordinates when you mouse over the images in Firefly, but the mask and the variance appear to be using a default ra and dec, where the bottom left corner is displayed as around ~23h58m00s and ~0d29m00s

            And example notebook that shows the issue can be found at:

            https://github.com/lsst-dm/ap_pipe-notebooks/blob/873176ea1d87870c1678037b13e7ff48bd4c56fb/notebooks/Firefly-Bug-Notebook.ipynb

            (This is on the branch {{u/bsmart/Firefly-bugs}} of https://github.com/lsst-dm/ap_pipe-notebooks .)
            Hide
            gpdf Gregory Dubois-Felsmann added a comment -

            Hi, Brianna Smart, thank you for reporting this.

            The code sample has

            collection="u/elhoward/DM-35285/hsc-output-collection"
            

            I'm assuming this collection is on the USDF?

            Show
            gpdf Gregory Dubois-Felsmann added a comment - Hi, Brianna Smart , thank you for reporting this. The code sample has collection = "u/elhoward/DM-35285/hsc-output-collection" I'm assuming this collection is on the USDF?
            Hide
            gpdf Gregory Dubois-Felsmann added a comment - - edited

            I'm going to try to get this to run on the IDF / DP0.2, as not everyone on our team has their USDF account set up yet, but in the mean time, here's one other thing I noticed right away that needs a solution:

            Something about how afw.display works with different back ends has led you to have a big branch in your code on Firefly vs. matplotlib, and that was definitely not the goal for how afw.display should work:

               if matplot != None:
                    afwDisplay.setDefaultBackend('matplotlib') 
                    
                    for i, ref in enumerate(datasetRefs):
             
                        calexp = butler.getDirect(ref)
                        print('Visit: ', calexp.visitInfo.getId(), ', Detector: ',calexp.detector.getId())
                        fig, ax = plt.subplots(1, 3, figsize=(14, 7))
                        plt.sca(ax[0])  # set the first axis as current
                        plt.xlabel('Image with Mask Overlay')
                        display1 = afwDisplay.Display(frame=fig)
                        display1.scale('asinh', -1, 30)
                        display1.mtv(calexp)
                        plt.sca(ax[1])  # set the second axis as current
                        display2 = afwDisplay.Display(frame=fig)
                        display2.mtv(calexp.mask)
                        plt.tight_layout()
                        plt.sca(ax[2]) 
                        display3 = afwDisplay.Display(frame=fig)
                        display3.scale('asinh', 'zscale')
                        display3.mtv(calexp.variance)
                        plt.tight_layout()
                        plt.show()
                        remove_figure(fig)
                        
                        if i == display_num:
                            print('...')
                            break
             
                else:
                    afwDisplay.setDefaultBackend('firefly')
                    for i, ref in enumerate(datasetRefs):
             
                        calexp = butler.getDirect(ref)
                        print('Visit: ', calexp.visitInfo.getId(), ', Detector: ',calexp.detector.getId())
                        display = afwDisplay.Display(frame=3*i)
                        display.scale('asinh', -1, 30)
                        display.mtv(calexp)
                        display = afwDisplay.Display(frame=3*i+1)
                        display.setMaskTransparency(90)
                        display.mtv(calexp.mask)
                        display = afwDisplay.Display(frame=3*i+2)
                        display.scale('asinh', 'zscale')
                        display.mtv(calexp.variance)
             
                        if i == display_num:
                            print('...')
                            break
            

            The goal is for this sort of thing to be necessary only rarely, even in a case like this where you are laying out a grid. So I hope after we get the actual bugs fixed we can look at this.

            Show
            gpdf Gregory Dubois-Felsmann added a comment - - edited I'm going to try to get this to run on the IDF / DP0.2, as not everyone on our team has their USDF account set up yet, but in the mean time, here's one other thing I noticed right away that needs a solution: Something about how afw.display works with different back ends has led you to have a big branch in your code on Firefly vs. matplotlib, and that was definitely not the goal for how afw.display should work: if matplot ! = None : afwDisplay.setDefaultBackend( 'matplotlib' ) for i, ref in enumerate (datasetRefs):   calexp = butler.getDirect(ref) print ( 'Visit: ' , calexp.visitInfo.getId(), ', Detector: ' ,calexp.detector.getId()) fig, ax = plt.subplots( 1 , 3 , figsize = ( 14 , 7 )) plt.sca(ax[ 0 ]) # set the first axis as current plt.xlabel( 'Image with Mask Overlay' ) display1 = afwDisplay.Display(frame = fig) display1.scale( 'asinh' , - 1 , 30 ) display1.mtv(calexp) plt.sca(ax[ 1 ]) # set the second axis as current display2 = afwDisplay.Display(frame = fig) display2.mtv(calexp.mask) plt.tight_layout() plt.sca(ax[ 2 ]) display3 = afwDisplay.Display(frame = fig) display3.scale( 'asinh' , 'zscale' ) display3.mtv(calexp.variance) plt.tight_layout() plt.show() remove_figure(fig) if i = = display_num: print ( '...' ) break   else : afwDisplay.setDefaultBackend( 'firefly' ) for i, ref in enumerate (datasetRefs):   calexp = butler.getDirect(ref) print ( 'Visit: ' , calexp.visitInfo.getId(), ', Detector: ' ,calexp.detector.getId()) display = afwDisplay.Display(frame = 3 * i) display.scale( 'asinh' , - 1 , 30 ) display.mtv(calexp) display = afwDisplay.Display(frame = 3 * i + 1 ) display.setMaskTransparency( 90 ) display.mtv(calexp.mask) display = afwDisplay.Display(frame = 3 * i + 2 ) display.scale( 'asinh' , 'zscale' ) display.mtv(calexp.variance)   if i = = display_num: print ( '...' ) break The goal is for this sort of thing to be necessary only rarely, even in a case like this where you are laying out a grid. So I hope after we get the actual bugs fixed we can look at this.
            gpdf Gregory Dubois-Felsmann made changes -
            Team Portal [ 16312 ]
            gpdf Gregory Dubois-Felsmann made changes -
            Component/s display_firefly [ 15115 ]
            gpdf Gregory Dubois-Felsmann made changes -
            Link This issue relates to DM-37441 [ DM-37441 ]
            Hide
            gpdf Gregory Dubois-Felsmann added a comment - - edited

            I think in

            butler = lsst.daf.butler.Butler("/repo/main", collections=collection)
            

            because of the way the imports were done it needs to be just butler = Butler( ... ), without the "lsst" etc. fully-qualified name components?

            Show
            gpdf Gregory Dubois-Felsmann added a comment - - edited I think in butler = lsst.daf.butler.Butler( "/repo/main" , collections = collection) because of the way the imports were done it needs to be just butler = Butler( ... ) , without the "lsst" etc. fully-qualified name components?

              People

              Assignee:
              gpdf Gregory Dubois-Felsmann
              Reporter:
              bsmart Brianna Smart
              Watchers:
              Brianna Smart, Gregory Dubois-Felsmann, Trey Roby
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:

                  Jenkins

                  No builds found.