LSST Applications  21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
LSST Data Management Base Package
Public Member Functions | List of all members
lsst.display.firefly.firefly.DisplayImpl Class Reference
Inheritance diagram for lsst.display.firefly.firefly.DisplayImpl:

Public Member Functions

def __init__ (self, display, verbose=False, url=None, name=None, *args, **kwargs)
 
def getClient (self)
 
def clearViewer (self)
 
def resetLayout (self)
 
def overlayFootprints (self, catalog, color='rgba(74, 144, 226, 0.60)', highlightColor='cyan', selectColor='orange', style='fill', layerString='detection footprints ', titleString='catalog footprints ')
 

Detailed Description

Device to talk to a firefly display

Definition at line 55 of file firefly.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.display.firefly.firefly.DisplayImpl.__init__ (   self,
  display,
  verbose = False,
  url = None,
  name = None,
args,
**  kwargs 
)

Definition at line 75 of file firefly.py.

76  name=None, *args, **kwargs):
77  virtualDevice.DisplayImpl.__init__(self, display, verbose)
78 
79  if self.verbose:
80  print("Opening firefly device %s" % (self.display.frame if self.display else "[None]"))
81 
82  global _fireflyClient
83  if not _fireflyClient:
84  import os
85  start_tab = None
86  html_file = kwargs.get('html_file',
87  os.environ.get('FIREFLY_HTML', 'slate.html'))
88  if url is None:
89  if (('fireflyLabExtension' in os.environ) and
90  ('fireflyURLLab' in os.environ)):
91  url = os.environ['fireflyURLLab']
92  start_tab = kwargs.get('start_tab', True)
93  start_browser_tab = kwargs.get('start_browser_tab', False)
94  if (name is None) and ('fireflyChannelLab' in os.environ):
95  name = os.environ['fireflyChannelLab']
96  elif 'FIREFLY_URL' in os.environ:
97  url = os.environ['FIREFLY_URL']
98  else:
99  raise RuntimeError('Cannot determine url from environment; you must pass url')
100 
101  token = kwargs.get('token',
102  os.environ.get('ACCESS_TOKEN', None))
103 
104  try:
105  if start_tab:
106  if verbose:
107  print('Starting Jupyterlab client')
108  _fireflyClient = firefly_client.FireflyClient.make_lab_client(
109  start_tab=True, start_browser_tab=start_browser_tab,
110  html_file=kwargs.get('html_file'), verbose=verbose,
111  token=token)
112 
113  else:
114  if verbose:
115  print('Starting vanilla client')
116  _fireflyClient = firefly_client.FireflyClient.make_client(
117  url=url, html_file=html_file, launch_browser=True,
118  channel_override=name, verbose=verbose,
119  token=token)
120 
121  except (HandshakeError, gaierror) as e:
122  raise RuntimeError("Unable to connect to %s: %s" % (url or '', e))
123 
124  try:
125  _fireflyClient.add_listener(self.__handleCallbacks)
126  except Exception as e:
127  raise RuntimeError("Cannot add listener. Browser must be connected" +
128  "to %s: %s" %
129  (_fireflyClient.get_firefly_url(), e))
130 
131  self._isBuffered = False
132  self._regions = []
133  self._regionLayerId = self._getRegionLayerId()
134  self._fireflyFitsID = None
135  self._fireflyMaskOnServer = None
136  self._client = _fireflyClient
137  self._channel = _fireflyClient.channel
138  self._url = _fireflyClient.get_firefly_url()
139  self._maskIds = []
140  self._maskDict = {}
141  self._maskPlaneColors = {}
142  self._maskTransparencies = {}
143  self._lastZoom = None
144  self._lastPan = None
145  self._lastStretch = None
146 

Member Function Documentation

◆ clearViewer()

def lsst.display.firefly.firefly.DisplayImpl.clearViewer (   self)
Reinitialize the viewer

Definition at line 518 of file firefly.py.

518  def clearViewer(self):
519  """Reinitialize the viewer
520  """
521  self._client.reinit_viewer()
522 

◆ getClient()

def lsst.display.firefly.firefly.DisplayImpl.getClient (   self)
Get the instance of FireflyClient for this display

Returns:
--------
`firefly_client.FireflyClient`
    Instance of FireflyClient used by this display

Definition at line 508 of file firefly.py.

508  def getClient(self):
509  """Get the instance of FireflyClient for this display
510 
511  Returns:
512  --------
513  `firefly_client.FireflyClient`
514  Instance of FireflyClient used by this display
515  """
516  return self._client
517 

◆ overlayFootprints()

def lsst.display.firefly.firefly.DisplayImpl.overlayFootprints (   self,
  catalog,
  color = 'rgba(74,144,226,0.60)',
  highlightColor = 'cyan',
  selectColor = 'orange',
  style = 'fill',
  layerString = 'detection footprints ',
  titleString = 'catalog footprints ' 
)
Overlay outlines of footprints from a catalog

Overlay outlines of LSST footprints from the input catalog. The colors
and style can be specified as parameters, and the base color and style
can be changed in the Firefly browser user interface.

Parameters:
-----------
catalog : `lsst.afw.table.SourceCatalog`
    Source catalog from which to display footprints.
color : `str`
    Color for footprints overlay. Colors can be specified as a name
    like 'cyan' or afwDisplay.RED; as an rgb value such as
    'rgb(80,100,220)'; or as rgb plus alpha (transparency) such
    as 'rgba('74,144,226,0.60)'.
highlightColor : `str`
    Color for highlighted footprints
selectColor : `str`
    Color for selected footprints
style : {'fill', 'outline'}
    Style of footprints display, filled or outline
insertColumn : `int`
    Column at which to insert the "family_id" and "category" columns
layerString: `str`
    Name of footprints layer string, to concatenate with the frame
    Re-using the layer_string will overwrite the previous table and
    footprints
titleString: `str`
    Title of catalog, to concatenate with the frame

Definition at line 550 of file firefly.py.

553  titleString='catalog footprints '):
554  """Overlay outlines of footprints from a catalog
555 
556  Overlay outlines of LSST footprints from the input catalog. The colors
557  and style can be specified as parameters, and the base color and style
558  can be changed in the Firefly browser user interface.
559 
560  Parameters:
561  -----------
562  catalog : `lsst.afw.table.SourceCatalog`
563  Source catalog from which to display footprints.
564  color : `str`
565  Color for footprints overlay. Colors can be specified as a name
566  like 'cyan' or afwDisplay.RED; as an rgb value such as
567  'rgb(80,100,220)'; or as rgb plus alpha (transparency) such
568  as 'rgba('74,144,226,0.60)'.
569  highlightColor : `str`
570  Color for highlighted footprints
571  selectColor : `str`
572  Color for selected footprints
573  style : {'fill', 'outline'}
574  Style of footprints display, filled or outline
575  insertColumn : `int`
576  Column at which to insert the "family_id" and "category" columns
577  layerString: `str`
578  Name of footprints layer string, to concatenate with the frame
579  Re-using the layer_string will overwrite the previous table and
580  footprints
581  titleString: `str`
582  Title of catalog, to concatenate with the frame
583  """
584  footprintTable = createFootprintsTable(catalog)
585  with BytesIO() as fd:
586  footprintTable.to_xml(fd)
587  tableval = self._client.upload_data(fd, 'UNKNOWN')
588  self._client.overlay_footprints(footprint_file=tableval,
589  title=titleString + str(self.display.frame),
590  footprint_layer_id=layerString + str(self.display.frame),
591  plot_id=str(self.display.frame),
592  color=color,
593  highlightColor=highlightColor,
594  selectColor=selectColor,
595  style=style)
def createFootprintsTable(catalog, xy0=None, insertColumn=4)
Definition: footprints.py:62

◆ resetLayout()

def lsst.display.firefly.firefly.DisplayImpl.resetLayout (   self)
Reset the layout of the Firefly Slate browser

Clears the display and adds Slate cells to display image in upper left,
plot area in upper right, and plots stretch across the bottom

Definition at line 523 of file firefly.py.

523  def resetLayout(self):
524  """Reset the layout of the Firefly Slate browser
525 
526  Clears the display and adds Slate cells to display image in upper left,
527  plot area in upper right, and plots stretch across the bottom
528  """
529  self.clearViewer()
530  try:
531  tables_cell_id = 'tables-' + str(_fireflyClient.render_tree_id)
532  except AttributeError:
533  tables_cell_id = 'tables'
534  self._client.add_cell(row=2, col=0, width=4, height=2, element_type='tables',
535  cell_id=tables_cell_id)
536  try:
537  image_cell_id = ('image-' + str(_fireflyClient.render_tree_id) + '-' +
538  str(self.frame))
539  except AttributeError:
540  image_cell_id = 'image-' + str(self.frame)
541  self._client.add_cell(row=0, col=0, width=2, height=3, element_type='images',
542  cell_id=image_cell_id)
543  try:
544  plots_cell_id = 'plots-' + str(_fireflyClient.render_tree_id)
545  except AttributeError:
546  plots_cell_id = 'plots'
547  self._client.add_cell(row=0, col=2, width=2, height=3, element_type='xyPlots',
548  cell_id=plots_cell_id)
549 

The documentation for this class was generated from the following file: