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

Adapt display_firefly to new Firefly API, and to py3

    XMLWordPrintable

    Details

    • Type: Story
    • Status: Done
    • Resolution: Done
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Story Points:
      10
    • Sprint:
      SUIT Sprint 2016-9, SUIT Sprint 2016-10, SUIT Sprint 2016-11
    • Team:
      Science User Interface

      Description

      The Python API for Firefly has changed, due to the Firefly rewrite, and to renaming of methods to be more compatible with PEP8. This ticket updates the existing display_firefly plugin for these changes and also to ensure compatibility with Python 3.

      The targeted functionality follows the testDisplay.py test in the afw package:

      • Display an Exposure or MaskedImage with image and mask overlaid
      • Set a specific mask plane color.
      • Turn off a specific mask plane.
      • Erase a display.
      • Zoom to a user-specified zoom level.
      • Pan to a particular pixel position.
      • Display a symbol at a specific pixel position.
      • Change the stretch / scale.
      • Display a line with specified vertices.
      • Interact with the display to return a pixel coordinate that a user has clicked on. Deferred to DM-8173.

        Attachments

          Issue Links

            Activity

            No builds found.
            shupe David Shupe created issue -
            shupe David Shupe made changes -
            Field Original Value New Value
            Epic Link DM-7284 [ 26369 ]
            xiuqin Xiuqin Wu [X] (Inactive) made changes -
            Sprint SUIT Sprint 2016-9 [ 223 ]
            Hide
            shupe David Shupe added a comment -

            For display_firefly to have Python 3 compatibility, it is necessary that FireflyClient be py3-compatible.

            Show
            shupe David Shupe added a comment - For display_firefly to have Python 3 compatibility, it is necessary that FireflyClient be py3-compatible.
            shupe David Shupe made changes -
            Link This issue FF-depends on DM-7326 [ DM-7326 ]
            shupe David Shupe made changes -
            Link This issue relates to DM-6179 [ DM-6179 ]
            shupe David Shupe made changes -
            Status To Do [ 10001 ] In Progress [ 3 ]
            xiuqin Xiuqin Wu [X] (Inactive) made changes -
            Story Points 3 10
            Hide
            xiuqin Xiuqin Wu [X] (Inactive) added a comment -

            Scope of this work has increased. That is why I changed the SP to 10.

            Show
            xiuqin Xiuqin Wu [X] (Inactive) added a comment - Scope of this work has increased. That is why I changed the SP to 10.
            shupe David Shupe made changes -
            Description The Python API for Firefly has changed, due to the Firefly rewrite, and to renaming of methods to be more compatible with PEP8. This ticket updates the existing display_firefly plugin for these changes and also to ensure compatibility with Python 3. The Python API for Firefly has changed, due to the Firefly rewrite, and to renaming of methods to be more compatible with PEP8. This ticket updates the existing display_firefly plugin for these changes and also to ensure compatibility with Python 3.

            The targeted functionality follows the {{testDisplay.py}} test in the {{afw}} package:
            * Display an Exposure or MaskedImage with image and mask overlaid
            * Set a specific mask plane color.
            * Turn off a specific mask plane.
            * Erase a display.
            * Zoom to a user-specified zoom level.
            * Pan to a particular pixel position.
            * Display a symbol at a specific pixel position.
            * Change the stretch / scale.
            * Display a line with specified vertices.
            * Interact with the display to return a pixel coordinate that a user has clicked on.
            xiuqin Xiuqin Wu [X] (Inactive) made changes -
            Sprint SUIT Sprint 2016-9 [ 223 ] SUIT Sprint 2016-9, SUIT Sprint 2016-10 [ 223, 250 ]
            xiuqin Xiuqin Wu [X] (Inactive) made changes -
            Rank Ranked higher
            shupe David Shupe made changes -
            Link This issue relates to DM-8007 [ DM-8007 ]
            shupe David Shupe made changes -
            Link This issue relates to RFC-248 [ RFC-248 ]
            xiuqin Xiuqin Wu [X] (Inactive) made changes -
            Sprint SUIT Sprint 2016-9, SUIT Sprint 2016-10 [ 223, 250 ] SUIT Sprint 2016-9, SUIT Sprint 2016-10, SUIT Sprint 2016-11 [ 223, 250, 251 ]
            xiuqin Xiuqin Wu [X] (Inactive) made changes -
            Rank Ranked higher
            Hide
            shupe David Shupe added a comment -

            A few outstanding items will be fixed in separate tickets.

            Show
            shupe David Shupe added a comment - A few outstanding items will be fixed in separate tickets.
            shupe David Shupe made changes -
            Status In Progress [ 3 ] In Review [ 10004 ]
            shupe David Shupe made changes -
            Link This issue relates to DM-8171 [ DM-8171 ]
            xiuqin Xiuqin Wu [X] (Inactive) made changes -
            Reviewers Nate Lust [ nlust ] Robert Lupton [ rhl ]
            Hide
            rhl Robert Lupton added a comment -

            See comments on github (https://github.com/lsst/display_firefly/pull/1/files)

            I found a number of things while trying these changes out. Some are bugs, some feature requests or merely comments:

            1. If you haven't explicitly started an image window with http://$host:$port/firefly/firefly.html;wsch=afw the resulting error isn't very helpful; the exception

              try:
                  _fireflyClient = firefly_client.FireflyClient("%s:%d" % (host, port), name)
                  _fireflyClient.launch_browser()
                  _fireflyClient.add_listener(self.__handleCallbacks)
              except Exception as e:
                  raise RuntimeError("Unable to connect to client %s:%d: %s" % (host, port, e))
              

              propagates out to the prompt.

            2. Putting up an image often generates a small image (zoom=1); a small resize of the window causes a resize.
            3. It'd be nice to have an option for a horizontal layout (cf. ds9) – displays tend to be wider than high, but the firefly (and default ds9) display is higher than wide so you lose image area.
            4. Setting the mask colours in the layers display seems to set their alpha back to 1.0. Also the colour doesn't get set back to the python layer, so if you redisplay the image the colours are reset
            5. In the layers display, one layer seems to be the image. Why does it have a colour and a tickbox?
            6. a two-finger gesture (on os/x) seems to go to previous/next URLs (I was trying to pan) and I lost my image
            7. Pixel coords are off by (0.5, 0.5) – the middle of the bottom left pixel should be (0, 0) (i.e. offset by (1, 1) from the fits standard, which assumes fortran-style 1-indexed arrays)
            8. There doesn't seem to be a way to show coordinates allowing for XY0
            9. disp.pan(0, 0) is ignored (I think anything below (0.5, 0.5) fails). I'd expect to be able to pan any point to the centre of the display, but I'd certainly expect that it'd clip to a valid coord not silently ignore my request)
            10. Killing the firefly display window seems to leave the notebook that's talking to it perfectly happy, but it doesn't respawn the window even if I call the constructor again.
            11. The nice inset detail of the image doesn't show the mask planes
            12. The inset detail isn't always centred on the cursor. E.g. at the lower left corner, if you put the cursor on the LL pixel, that pixel is shown at the LL of the inset, not the centre
            13. Colours for masks appear to be case sensitive (unlike at least most web standards), and illegal colours such as RED are silently ignored
            14. display.erase() clears the image, not just the lines/glyphs drawn on it
            Show
            rhl Robert Lupton added a comment - See comments on github ( https://github.com/lsst/display_firefly/pull/1/files ) I found a number of things while trying these changes out. Some are bugs, some feature requests or merely comments: If you haven't explicitly started an image window with http://$host:$port/firefly/firefly.html;wsch=afw the resulting error isn't very helpful; the exception try: _fireflyClient = firefly_client.FireflyClient("%s:%d" % (host, port), name) _fireflyClient.launch_browser() _fireflyClient.add_listener(self.__handleCallbacks) except Exception as e: raise RuntimeError("Unable to connect to client %s:%d: %s" % (host, port, e)) propagates out to the prompt. Putting up an image often generates a small image (zoom=1); a small resize of the window causes a resize. It'd be nice to have an option for a horizontal layout (cf. ds9) – displays tend to be wider than high, but the firefly (and default ds9) display is higher than wide so you lose image area. Setting the mask colours in the layers display seems to set their alpha back to 1.0. Also the colour doesn't get set back to the python layer, so if you redisplay the image the colours are reset In the layers display, one layer seems to be the image. Why does it have a colour and a tickbox? a two-finger gesture (on os/x) seems to go to previous/next URLs (I was trying to pan) and I lost my image Pixel coords are off by (0.5, 0.5) – the middle of the bottom left pixel should be (0, 0) (i.e. offset by (1, 1) from the fits standard, which assumes fortran-style 1-indexed arrays) There doesn't seem to be a way to show coordinates allowing for XY0 disp.pan(0, 0) is ignored (I think anything below (0.5, 0.5) fails). I'd expect to be able to pan any point to the centre of the display, but I'd certainly expect that it'd clip to a valid coord not silently ignore my request) Killing the firefly display window seems to leave the notebook that's talking to it perfectly happy, but it doesn't respawn the window even if I call the constructor again. The nice inset detail of the image doesn't show the mask planes The inset detail isn't always centred on the cursor. E.g. at the lower left corner, if you put the cursor on the LL pixel, that pixel is shown at the LL of the inset, not the centre Colours for masks appear to be case sensitive (unlike at least most web standards), and illegal colours such as RED are silently ignored display.erase() clears the image, not just the lines/glyphs drawn on it
            rhl Robert Lupton made changes -
            Status In Review [ 10004 ] Reviewed [ 10101 ]
            Hide
            shupe David Shupe added a comment - - edited

            Thank you Robert Lupton for the comprehensive review and detailed list of issues. Some of these can be addressed in the afwDisplay backend; others will have to be done in Firefly.

            Some notes on the ones that could be addressed in the backend:

            1. This should be handled better – in the remote case one would not want to launch a remote browser anyway.

            14. I thought display.erase() was supposed to clear the image – my mistake. I'll fix it in this ticket.

            Show
            shupe David Shupe added a comment - - edited Thank you Robert Lupton for the comprehensive review and detailed list of issues. Some of these can be addressed in the afwDisplay backend; others will have to be done in Firefly. Some notes on the ones that could be addressed in the backend: 1. This should be handled better – in the remote case one would not want to launch a remote browser anyway. 14. I thought display.erase() was supposed to clear the image – my mistake. I'll fix it in this ticket.
            shupe David Shupe made changes -
            Description The Python API for Firefly has changed, due to the Firefly rewrite, and to renaming of methods to be more compatible with PEP8. This ticket updates the existing display_firefly plugin for these changes and also to ensure compatibility with Python 3.

            The targeted functionality follows the {{testDisplay.py}} test in the {{afw}} package:
            * Display an Exposure or MaskedImage with image and mask overlaid
            * Set a specific mask plane color.
            * Turn off a specific mask plane.
            * Erase a display.
            * Zoom to a user-specified zoom level.
            * Pan to a particular pixel position.
            * Display a symbol at a specific pixel position.
            * Change the stretch / scale.
            * Display a line with specified vertices.
            * Interact with the display to return a pixel coordinate that a user has clicked on.
            The Python API for Firefly has changed, due to the Firefly rewrite, and to renaming of methods to be more compatible with PEP8. This ticket updates the existing display_firefly plugin for these changes and also to ensure compatibility with Python 3.

            The targeted functionality follows the {{testDisplay.py}} test in the {{afw}} package:
            * Display an Exposure or MaskedImage with image and mask overlaid
            * Set a specific mask plane color.
            * Turn off a specific mask plane.
            * Erase a display.
            * Zoom to a user-specified zoom level.
            * Pan to a particular pixel position.
            * Display a symbol at a specific pixel position.
            * Change the stretch / scale.
            * Display a line with specified vertices.
            * -Interact with the display to return a pixel coordinate that a user has clicked on.- Deferred to DM-8173.
            Hide
            shupe David Shupe added a comment -

            Suggestions from code review incorporated. A more informative exception message is raised when a browser tab has not be reopened to the correct URL. erase() method now erases only the overlays.

            Other issues found in the review will be addressed in new tickets.

            Show
            shupe David Shupe added a comment - Suggestions from code review incorporated. A more informative exception message is raised when a browser tab has not be reopened to the correct URL. erase() method now erases only the overlays. Other issues found in the review will be addressed in new tickets.
            shupe David Shupe made changes -
            Resolution Done [ 10000 ]
            Status Reviewed [ 10101 ] Done [ 10002 ]
            roby Trey Roby made changes -
            Watchers David Shupe, Gregory Dubois-Felsmann, Nate Lust, Robert Lupton, Xiuqin Wu [ David Shupe, Gregory Dubois-Felsmann, Nate Lust, Robert Lupton, Xiuqin Wu ] David Shupe, Gregory Dubois-Felsmann, Nate Lust, Robert Lupton, Trey Roby, Xiuqin Wu [ David Shupe, Gregory Dubois-Felsmann, Nate Lust, Robert Lupton, Trey Roby, Xiuqin Wu ]
            Hide
            roby Trey Roby added a comment -

            Robert Lupton concerning #6: the scrolling works like google maps, which is a click and drag. I have three finger draging set on my Mac (now hidden under: System Preferences... => Accessibility => Mouse & Trackpad => Trackpad Optons... => Enable dragging).

            Neither Google maps or Firefly use a "scrolled window" so the OS built in scrolling does not work.

            I will make one or two tickets out of the others issues.

            Show
            roby Trey Roby added a comment - Robert Lupton concerning #6: the scrolling works like google maps, which is a click and drag. I have three finger draging set on my Mac (now hidden under: System Preferences... => Accessibility => Mouse & Trackpad => Trackpad Optons... => Enable dragging). Neither Google maps or Firefly use a "scrolled window" so the OS built in scrolling does not work. I will make one or two tickets out of the others issues.
            Hide
            shupe David Shupe added a comment -

            Note, #1 and #14 were addressed in the post-review fixes for this ticket, along with the coding comments on the pull request.

            The other items were not addressed.

            Show
            shupe David Shupe added a comment - Note, #1 and #14 were addressed in the post-review fixes for this ticket, along with the coding comments on the pull request. The other items were not addressed.
            Hide
            roby Trey Roby added a comment -

            see issue: DM-8409

            Show
            roby Trey Roby added a comment - see issue: DM-8409
            Hide
            gpdf Gregory Dubois-Felsmann added a comment - - edited

            a two-finger gesture (on os/x) seems to go to previous/next URLs (I was trying to pan) and I lost my image

            I think the issue here may be less about "there should be a nice mouse gesture for panning" and more about "it's too easy to lose your place by accidentally invoking 'Back' in the browser".

            Show
            gpdf Gregory Dubois-Felsmann added a comment - - edited a two-finger gesture (on os/x) seems to go to previous/next URLs (I was trying to pan) and I lost my image I think the issue here may be less about "there should be a nice mouse gesture for panning" and more about "it's too easy to lose your place by accidentally invoking 'Back' in the browser".

              People

              Assignee:
              shupe David Shupe
              Reporter:
              shupe David Shupe
              Reviewers:
              Robert Lupton
              Watchers:
              David Shupe, Gregory Dubois-Felsmann, Nate Lust, Robert Lupton, Trey Roby, Xiuqin Wu [X] (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Jenkins

                  No builds found.