LSST Applications g0265f82a02+0e5473021a,g02d81e74bb+bd2ed33bd6,g1470d8bcf6+c6d6eb38e2,g14a832a312+9d12ad093c,g2079a07aa2+86d27d4dc4,g2305ad1205+91a32aca49,g295015adf3+88246b6574,g2bbee38e9b+0e5473021a,g337abbeb29+0e5473021a,g3ddfee87b4+c34e8be1fa,g487adcacf7+85dcfbcc36,g50ff169b8f+96c6868917,g52b1c1532d+585e252eca,g591dd9f2cf+ea1711114f,g5a732f18d5+53520f316c,g64a986408d+bd2ed33bd6,g858d7b2824+bd2ed33bd6,g8a8a8dda67+585e252eca,g99cad8db69+016a06b37a,g9ddcbc5298+9a081db1e4,ga1e77700b3+15fc3df1f7,ga8c6da7877+ef4e3a5875,gb0e22166c9+60f28cb32d,gb6a65358fc+0e5473021a,gba4ed39666+c2a2e4ac27,gbb8dafda3b+b6d7b42999,gc120e1dc64+f745648b3a,gc28159a63d+0e5473021a,gcf0d15dbbd+c34e8be1fa,gdaeeff99f8+f9a426f77a,ge6526c86ff+508d0e0a30,ge79ae78c31+0e5473021a,gee10cc3b42+585e252eca,gf18bd8381d+8d59551888,gf1cff7945b+bd2ed33bd6,w.2024.16
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
lsst.display.firefly.firefly.DisplayImpl Class Reference
Inheritance diagram for lsst.display.firefly.firefly.DisplayImpl:

Public Member Functions

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

Public Attributes

 frame
 

Protected Member Functions

 _getRegionLayerId (self)
 
 _clearImage (self)
 
 _mtv (self, image, mask=None, wcs=None, title="")
 
 _remove_masks (self)
 
 _buffer (self, enable=True)
 Enable or disable buffering of writes to the display param enable True or False, as appropriate.
 
 _flush (self)
 Flush any I/O buffers.
 
 _uploadTextData (self, regions)
 
 _close (self)
 
 _dot (self, symb, c, r, size, ctype, fontFamily="helvetica", textAngle=None)
 
 _drawLines (self, points, ctype)
 
 _erase (self)
 
 _setCallback (self, what, func)
 
 _getEvent (self)
 
 _scale (self, algorithm, min, max, unit=None, *args, **kwargs)
 
 _setMaskTransparency (self, transparency, maskName)
 
 _getMaskTransparency (self, maskName)
 
 _setMaskPlaneColor (self, maskName, color)
 
 _show (self)
 
 _zoom (self, zoomfac)
 
 _pan (self, colc, rowc)
 

Protected Attributes

 _isBuffered
 
 _regions
 
 _regionLayerId
 
 _fireflyFitsID
 
 _fireflyMaskOnServer
 
 _client
 
 _channel
 
 _url
 
 _maskIds
 
 _maskDict
 
 _maskPlaneColors
 
 _maskTransparencies
 
 _lastZoom
 
 _lastPan
 
 _lastStretch
 
 _stretchAlgorithm
 
 _stretchMin
 
 _stretchMax
 
 _stretchUnit
 

Detailed Description

Device to talk to a firefly display

Definition at line 55 of file firefly.py.

Constructor & Destructor Documentation

◆ __init__()

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

◆ _buffer()

lsst.display.firefly.firefly.DisplayImpl._buffer ( self,
enable = True )
protected

Enable or disable buffering of writes to the display param enable True or False, as appropriate.

Definition at line 235 of file firefly.py.

235 def _buffer(self, enable=True):
236 """!Enable or disable buffering of writes to the display
237 param enable True or False, as appropriate
238 """
239 self._isBuffered = enable
240

◆ _clearImage()

lsst.display.firefly.firefly.DisplayImpl._clearImage ( self)
protected
Delete the current image in the Firefly viewer

Definition at line 150 of file firefly.py.

150 def _clearImage(self):
151 """Delete the current image in the Firefly viewer
152 """
153 self._client.dispatch(action_type='ImagePlotCntlr.deletePlotView',
154 payload=dict(plotId=str(self.display.frame)))
155

◆ _close()

lsst.display.firefly.firefly.DisplayImpl._close ( self)
protected
Called when the device is closed

Definition at line 262 of file firefly.py.

262 def _close(self):
263 """Called when the device is closed"""
264 if self.verbose:
265 print("Closing firefly device %s" % (self.display.frame if self.display else "[None]"))
266 if _fireflyClient is not None:
267 _fireflyClient.disconnect()
268 _fireflyClient.session.close()
269

◆ _dot()

lsst.display.firefly.firefly.DisplayImpl._dot ( self,
symb,
c,
r,
size,
ctype,
fontFamily = "helvetica",
textAngle = None )
protected
Draw a symbol onto the specified DS9 frame at (col,row) = (c,r) [0-based coordinates]
Possible values are:
    +                Draw a +
    x                Draw an x
    *                Draw a *
    o                Draw a circle
    @:Mxx,Mxy,Myy    Draw an ellipse with moments (Mxx, Mxy, Myy) (argument size is ignored)
    An object derived from afwGeom.ellipses.BaseCore Draw the ellipse (argument size is ignored)
Any other value is interpreted as a string to be drawn. Strings obey the fontFamily (which may be extended
with other characteristics, e.g. "times bold italic".  Text will be drawn rotated by textAngle (textAngle
is ignored otherwise).

N.b. objects derived from BaseCore include Axes and Quadrupole.

Definition at line 270 of file firefly.py.

270 def _dot(self, symb, c, r, size, ctype, fontFamily="helvetica", textAngle=None):
271 """Draw a symbol onto the specified DS9 frame at (col,row) = (c,r) [0-based coordinates]
272 Possible values are:
273 + Draw a +
274 x Draw an x
275 * Draw a *
276 o Draw a circle
277 @:Mxx,Mxy,Myy Draw an ellipse with moments (Mxx, Mxy, Myy) (argument size is ignored)
278 An object derived from afwGeom.ellipses.BaseCore Draw the ellipse (argument size is ignored)
279 Any other value is interpreted as a string to be drawn. Strings obey the fontFamily (which may be extended
280 with other characteristics, e.g. "times bold italic". Text will be drawn rotated by textAngle (textAngle
281 is ignored otherwise).
282
283 N.b. objects derived from BaseCore include Axes and Quadrupole.
284 """
285 self._uploadTextData(ds9Regions.dot(symb, c, r, size, ctype, fontFamily, textAngle))
286

◆ _drawLines()

lsst.display.firefly.firefly.DisplayImpl._drawLines ( self,
points,
ctype )
protected
Connect the points, a list of (col,row)
Ctype is the name of a colour (e.g. 'red')

Definition at line 287 of file firefly.py.

287 def _drawLines(self, points, ctype):
288 """Connect the points, a list of (col,row)
289 Ctype is the name of a colour (e.g. 'red')"""
290
291 self._uploadTextData(ds9Regions.drawLines(points, ctype))
292

◆ _erase()

lsst.display.firefly.firefly.DisplayImpl._erase ( self)
protected
Erase all overlays on the image

Definition at line 293 of file firefly.py.

293 def _erase(self):
294 """Erase all overlays on the image"""
295 if self.verbose:
296 print('region layer id is {}'.format(self._regionLayerId))
297 if self._regionLayerId:
298 _fireflyClient.delete_region_layer(self._regionLayerId, plot_id=str(self.display.frame))
299

◆ _flush()

lsst.display.firefly.firefly.DisplayImpl._flush ( self)
protected

Flush any I/O buffers.

Definition at line 241 of file firefly.py.

241 def _flush(self):
242 """!Flush any I/O buffers
243 """
244 if not self._regions:
245 return
246
247 if self.verbose:
248 print("Flushing %d regions" % len(self._regions))
249 print(self._regions)
250
251 self._regionLayerId = self._getRegionLayerId()
252 _fireflyClient.add_region_data(region_data=self._regions, plot_id=str(self.display.frame),
253 region_layer_id=self._regionLayerId)
254 self._regions = []
255

◆ _getEvent()

lsst.display.firefly.firefly.DisplayImpl._getEvent ( self)
protected
Return an event generated by a keypress or mouse click

Definition at line 314 of file firefly.py.

314 def _getEvent(self):
315 """Return an event generated by a keypress or mouse click
316 """
317 ev = interface.Event("q")
318
319 if self.verbose:
320 print("virtual[%s]._getEvent() -> %s" % (self.display.frame, ev))
321
322 return ev

◆ _getMaskTransparency()

lsst.display.firefly.firefly.DisplayImpl._getMaskTransparency ( self,
maskName )
protected
Return the current mask's transparency

Definition at line 447 of file firefly.py.

447 def _getMaskTransparency(self, maskName):
448 """Return the current mask's transparency"""
449 transparency = None
450 if maskName in self._maskTransparencies:
451 transparency = self._maskTransparencies[maskName]
452 return transparency
453

◆ _getRegionLayerId()

lsst.display.firefly.firefly.DisplayImpl._getRegionLayerId ( self)
protected

Definition at line 147 of file firefly.py.

147 def _getRegionLayerId(self):
148 return "lsstRegions%s" % self.display.frame if self.display else "None"
149

◆ _mtv()

lsst.display.firefly.firefly.DisplayImpl._mtv ( self,
image,
mask = None,
wcs = None,
title = "" )
protected
Display an Image and/or Mask on a Firefly display

Definition at line 156 of file firefly.py.

156 def _mtv(self, image, mask=None, wcs=None, title=""):
157 """Display an Image and/or Mask on a Firefly display
158 """
159 if title == "":
160 title = str(self.display.frame)
161 if image:
162 if self.verbose:
163 print('displaying image')
164 self._erase()
165
166 with tempfile.NamedTemporaryFile() as fd:
167 afwDisplay.writeFitsImage(fd.name, image, wcs, title)
168 fd.flush()
169 fd.seek(0, 0)
170 self._fireflyFitsID = _fireflyClient.upload_data(fd, 'FITS')
171
172 try:
173 viewer_id = ('image-' + str(_fireflyClient.render_tree_id) + '-' +
174 str(self.frame))
175 except AttributeError:
176 viewer_id = 'image-' + str(self.frame)
177 extraParams = dict(Title=title,
178 MultiImageIdx=0,
179 PredefinedOverlayIds=' ',
180 viewer_id=viewer_id)
181 # Firefly's Javascript API requires a space for parameters;
182 # otherwise the parameter will be ignored
183
184 if self._lastZoom:
185 extraParams['InitZoomLevel'] = self._lastZoom
186 extraParams['ZoomType'] = 'LEVEL'
187 if self._lastPan:
188 extraParams['InitialCenterPosition'] = '{0:.3f};{1:.3f};PIXEL'.format(
189 self._lastPan[0], self._lastPan[1])
190 if self._lastStretch:
191 extraParams['RangeValues'] = self._lastStretch
192
193 ret = _fireflyClient.show_fits(self._fireflyFitsID, plot_id=str(self.display.frame),
194 **extraParams)
195
196 if not ret["success"]:
197 raise RuntimeError("Display of image failed")
198
199 if mask:
200 if self.verbose:
201 print('displaying mask')
202 with tempfile.NamedTemporaryFile() as fdm:
203 afwDisplay.writeFitsImage(fdm.name, mask, wcs, title)
204 fdm.flush()
205 fdm.seek(0, 0)
206 self._fireflyMaskOnServer = _fireflyClient.upload_data(fdm, 'FITS')
207
208 maskPlaneDict = mask.getMaskPlaneDict()
209 for k, v in maskPlaneDict.items():
210 self._maskDict[k] = v
211 self._maskPlaneColors[k] = self.display.getMaskPlaneColor(k)
212 usedPlanes = int(afwMath.makeStatistics(mask, afwMath.SUM).getValue())
213 for k in self._maskDict:
214 if (((1 << self._maskDict[k]) & usedPlanes) and
215 (k in self._maskPlaneColors) and
216 (self._maskPlaneColors[k] is not None) and
217 (self._maskPlaneColors[k].lower() != 'ignore')):
218 _fireflyClient.add_mask(bit_number=self._maskDict[k],
219 image_number=0,
220 plot_id=str(self.display.frame),
221 mask_id=k,
222 title=k + ' - bit %d'%self._maskDict[k],
223 color=self._maskPlaneColors[k],
224 file_on_server=self._fireflyMaskOnServer)
225 if k in self._maskTransparencies:
226 self._setMaskTransparency(self._maskTransparencies[k], k)
227 self._maskIds.append(k)
228
Statistics makeStatistics(lsst::afw::image::Image< Pixel > const &img, lsst::afw::image::Mask< image::MaskPixel > const &msk, int const flags, StatisticsControl const &sctrl=StatisticsControl())
Handle a watered-down front-end to the constructor (no variance)
Definition Statistics.h:361

◆ _pan()

lsst.display.firefly.firefly.DisplayImpl._pan ( self,
colc,
rowc )
protected
Pan to specified pixel coordinates

Parameters:
-----------
colc, rowc : `float`
    column and row in units of pixels (zero-based convention,
      with the xy0 already subtracted off)

Definition at line 493 of file firefly.py.

493 def _pan(self, colc, rowc):
494 """Pan to specified pixel coordinates
495
496 Parameters:
497 -----------
498 colc, rowc : `float`
499 column and row in units of pixels (zero-based convention,
500 with the xy0 already subtracted off)
501 """
502 self._lastPan = [colc+0.5, rowc+0.5] # saved for future use in _mtv
503 # Firefly's internal convention is first pixel is (0.5, 0.5)
504 _fireflyClient.set_pan(plot_id=str(self.display.frame), x=colc, y=rowc)
505

◆ _remove_masks()

lsst.display.firefly.firefly.DisplayImpl._remove_masks ( self)
protected
Remove mask layers

Definition at line 229 of file firefly.py.

229 def _remove_masks(self):
230 """Remove mask layers"""
231 for k in self._maskIds:
232 _fireflyClient.remove_mask(plot_id=str(self.display.frame), mask_id=k)
233 self._maskIds = []
234

◆ _scale()

lsst.display.firefly.firefly.DisplayImpl._scale ( self,
algorithm,
min,
max,
unit = None,
* args,
** kwargs )
protected
Scale the image stretch and limits

Parameters:
-----------
algorithm : `str`
    stretch algorithm, e.g. 'linear', 'log', 'loglog', 'equal', 'squared',
    'sqrt', 'asinh', powerlaw_gamma'
min : `float` or `str`
    lower limit, or 'minmax' for full range, or 'zscale'
max : `float` or `str`
    upper limit; overrriden if min is 'minmax' or 'zscale'
unit : `str`
    unit for min and max. 'percent', 'absolute', 'sigma'.
    if not specified, min and max are presumed to be in 'absolute' units.

*args, **kwargs : additional position and keyword arguments.
    The options are shown below:

    **Q** : `float`, optional
        The asinh softening parameter for asinh stretch.
        Use Q=0 for linear stretch, increase Q to make brighter features visible.
        When not specified or None, Q is calculated by Firefly to use full color range.
    **gamma**
        The gamma value for power law gamma stretch (default 2.0)
    **zscale_contrast** : `int`, optional
        Contrast parameter in percent for zscale algorithm (default 25)
    **zscale_samples** : `int`, optional
        Number of samples for zscale algorithm (default 600)
    **zscale_samples_perline** : `int`, optional
        Number of samples per line for zscale algorithm (default 120)

Definition at line 327 of file firefly.py.

327 def _scale(self, algorithm, min, max, unit=None, *args, **kwargs):
328 """Scale the image stretch and limits
329
330 Parameters:
331 -----------
332 algorithm : `str`
333 stretch algorithm, e.g. 'linear', 'log', 'loglog', 'equal', 'squared',
334 'sqrt', 'asinh', powerlaw_gamma'
335 min : `float` or `str`
336 lower limit, or 'minmax' for full range, or 'zscale'
337 max : `float` or `str`
338 upper limit; overrriden if min is 'minmax' or 'zscale'
339 unit : `str`
340 unit for min and max. 'percent', 'absolute', 'sigma'.
341 if not specified, min and max are presumed to be in 'absolute' units.
342
343 *args, **kwargs : additional position and keyword arguments.
344 The options are shown below:
345
346 **Q** : `float`, optional
347 The asinh softening parameter for asinh stretch.
348 Use Q=0 for linear stretch, increase Q to make brighter features visible.
349 When not specified or None, Q is calculated by Firefly to use full color range.
350 **gamma**
351 The gamma value for power law gamma stretch (default 2.0)
352 **zscale_contrast** : `int`, optional
353 Contrast parameter in percent for zscale algorithm (default 25)
354 **zscale_samples** : `int`, optional
355 Number of samples for zscale algorithm (default 600)
356 **zscale_samples_perline** : `int`, optional
357 Number of samples per line for zscale algorithm (default 120)
358 """
359 stretch_algorithms = ('linear', 'log', 'loglog', 'equal', 'squared', 'sqrt',
360 'asinh', 'powerlaw_gamma')
361 interval_methods = ('percent', 'maxmin', 'absolute', 'zscale', 'sigma')
362 #
363 #
364 # Normalise algorithm's case
365 #
366 if algorithm:
367 algorithm = dict((a.lower(), a) for a in stretch_algorithms).get(algorithm.lower(), algorithm)
368
369 if algorithm not in stretch_algorithms:
370 raise FireflyError('Algorithm %s is invalid; please choose one of "%s"' %
371 (algorithm, '", "'.join(stretch_algorithms)))
372 self._stretchAlgorithm = algorithm
373 else:
374 algorithm = 'linear'
375
376 # Translate parameters for asinh and powerlaw_gamma stretches
377 if 'Q' in kwargs:
378 kwargs['asinh_q_value'] = kwargs['Q']
379 del kwargs['Q']
380
381 if 'gamma' in kwargs:
382 kwargs['gamma_value'] = kwargs['gamma']
383 del kwargs['gamma']
384
385 if min == 'minmax':
386 interval_type = 'percent'
387 unit = 'percent'
388 min, max = 0, 100
389 elif min == 'zscale':
390 interval_type = 'zscale'
391 else:
392 interval_type = None
393
394 if not unit:
395 unit = 'absolute'
396
397 units = ('percent', 'absolute', 'sigma')
398 if unit not in units:
399 raise FireflyError('Unit %s is invalid; please choose one of "%s"' % (unit, '", "'.join(units)))
400
401 if unit == 'sigma':
402 interval_type = 'sigma'
403 elif unit == 'absolute' and interval_type is None:
404 interval_type = 'absolute'
405 elif unit == 'percent':
406 interval_type = 'percent'
407
408 self._stretchMin = min
409 self._stretchMax = max
410 self._stretchUnit = unit
411
412 if interval_type not in interval_methods:
413 raise FireflyError('Interval method %s is invalid' % interval_type)
414
415 rval = {}
416 if interval_type != 'zscale':
417 rval = _fireflyClient.set_stretch(str(self.display.frame), stype=interval_type,
418 algorithm=algorithm, lower_value=min,
419 upper_value=max, **kwargs)
420 else:
421 if 'zscale_contrast' not in kwargs:
422 kwargs['zscale_contrast'] = 25
423 if 'zscale_samples' not in kwargs:
424 kwargs['zscale_samples'] = 600
425 if 'zscale_samples_perline' not in kwargs:
426 kwargs['zscale_samples_perline'] = 120
427 rval = _fireflyClient.set_stretch(str(self.display.frame), stype='zscale',
428 algorithm=algorithm, **kwargs)
429
430 if 'rv_string' in rval:
431 self._lastStretch = rval['rv_string']
432

◆ _setCallback()

lsst.display.firefly.firefly.DisplayImpl._setCallback ( self,
what,
func )
protected

Definition at line 300 of file firefly.py.

300 def _setCallback(self, what, func):
301 if func != interface.noop_callback:
302 try:
303 status = _fireflyClient.add_extension('POINT' if False else 'AREA_SELECT', title=what,
304 plot_id=str(self.display.frame),
305 extension_id=what)
306 if not status['success']:
307 pass
308 except Exception as e:
309 raise RuntimeError("Cannot set callback. Browser must be (re)opened " +
310 "to %s%s : %s" %
311 (_fireflyClient.url_bw,
312 _fireflyClient.channel, e))
313

◆ _setMaskPlaneColor()

lsst.display.firefly.firefly.DisplayImpl._setMaskPlaneColor ( self,
maskName,
color )
protected
Specify mask color 

Definition at line 454 of file firefly.py.

454 def _setMaskPlaneColor(self, maskName, color):
455 """Specify mask color """
456 _fireflyClient.remove_mask(plot_id=str(self.display.frame),
457 mask_id=maskName)
458 self._maskPlaneColors[maskName] = color
459 if (color.lower() != 'ignore'):
460 _fireflyClient.add_mask(bit_number=self._maskDict[maskName],
461 image_number=1,
462 plot_id=str(self.display.frame),
463 mask_id=maskName,
464 color=self.display.getMaskPlaneColor(maskName),
465 file_on_server=self._fireflyFitsID)
466

◆ _setMaskTransparency()

lsst.display.firefly.firefly.DisplayImpl._setMaskTransparency ( self,
transparency,
maskName )
protected
Specify mask transparency (percent); or None to not set it when loading masks

Definition at line 433 of file firefly.py.

433 def _setMaskTransparency(self, transparency, maskName):
434 """Specify mask transparency (percent); or None to not set it when loading masks"""
435 if maskName is not None:
436 masklist = [maskName]
437 else:
438 masklist = set(self._maskIds + list(self.display._defaultMaskPlaneColor.keys()))
439 for k in masklist:
440 self._maskTransparencies[k] = transparency
441 _fireflyClient.dispatch(action_type='ImagePlotCntlr.overlayPlotChangeAttributes',
442 payload={'plotId': str(self.display.frame),
443 'imageOverlayId': k,
444 'attributes': {'opacity': 1.0 - transparency/100.},
445 'doReplot': False})
446
daf::base::PropertySet * set
Definition fits.cc:931

◆ _show()

lsst.display.firefly.firefly.DisplayImpl._show ( self)
protected
Show the requested window

Definition at line 467 of file firefly.py.

467 def _show(self):
468 """Show the requested window"""
469 if self._client.render_tree_id is not None:
470 # we are using Jupyterlab
471 self._client.dispatch(self._client.ACTION_DICT['StartLabWindow'],
472 {})
473 else:
474 localbrowser, url = _fireflyClient.launch_browser(verbose=self.verbose)
475 if not localbrowser and not self.verbose:
476 _fireflyClient.display_url()
477

◆ _uploadTextData()

lsst.display.firefly.firefly.DisplayImpl._uploadTextData ( self,
regions )
protected

Definition at line 256 of file firefly.py.

256 def _uploadTextData(self, regions):
257 self._regions += regions
258
259 if not self._isBuffered:
260 self._flush()
261

◆ _zoom()

lsst.display.firefly.firefly.DisplayImpl._zoom ( self,
zoomfac )
protected
Zoom display by specified amount

Parameters:
-----------
zoomfac: `float`
    zoom level in screen pixels per image pixel

Definition at line 482 of file firefly.py.

482 def _zoom(self, zoomfac):
483 """Zoom display by specified amount
484
485 Parameters:
486 -----------
487 zoomfac: `float`
488 zoom level in screen pixels per image pixel
489 """
490 self._lastZoom = zoomfac
491 _fireflyClient.set_zoom(plot_id=str(self.display.frame), factor=zoomfac)
492

◆ clearViewer()

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()

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()

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)

◆ resetLayout()

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

Member Data Documentation

◆ _channel

lsst.display.firefly.firefly.DisplayImpl._channel
protected

Definition at line 137 of file firefly.py.

◆ _client

lsst.display.firefly.firefly.DisplayImpl._client
protected

Definition at line 136 of file firefly.py.

◆ _fireflyFitsID

lsst.display.firefly.firefly.DisplayImpl._fireflyFitsID
protected

Definition at line 134 of file firefly.py.

◆ _fireflyMaskOnServer

lsst.display.firefly.firefly.DisplayImpl._fireflyMaskOnServer
protected

Definition at line 135 of file firefly.py.

◆ _isBuffered

lsst.display.firefly.firefly.DisplayImpl._isBuffered
protected

Definition at line 131 of file firefly.py.

◆ _lastPan

lsst.display.firefly.firefly.DisplayImpl._lastPan
protected

Definition at line 144 of file firefly.py.

◆ _lastStretch

lsst.display.firefly.firefly.DisplayImpl._lastStretch
protected

Definition at line 145 of file firefly.py.

◆ _lastZoom

lsst.display.firefly.firefly.DisplayImpl._lastZoom
protected

Definition at line 143 of file firefly.py.

◆ _maskDict

lsst.display.firefly.firefly.DisplayImpl._maskDict
protected

Definition at line 140 of file firefly.py.

◆ _maskIds

lsst.display.firefly.firefly.DisplayImpl._maskIds
protected

Definition at line 139 of file firefly.py.

◆ _maskPlaneColors

lsst.display.firefly.firefly.DisplayImpl._maskPlaneColors
protected

Definition at line 141 of file firefly.py.

◆ _maskTransparencies

lsst.display.firefly.firefly.DisplayImpl._maskTransparencies
protected

Definition at line 142 of file firefly.py.

◆ _regionLayerId

lsst.display.firefly.firefly.DisplayImpl._regionLayerId
protected

Definition at line 133 of file firefly.py.

◆ _regions

lsst.display.firefly.firefly.DisplayImpl._regions
protected

Definition at line 132 of file firefly.py.

◆ _stretchAlgorithm

lsst.display.firefly.firefly.DisplayImpl._stretchAlgorithm
protected

Definition at line 372 of file firefly.py.

◆ _stretchMax

lsst.display.firefly.firefly.DisplayImpl._stretchMax
protected

Definition at line 409 of file firefly.py.

◆ _stretchMin

lsst.display.firefly.firefly.DisplayImpl._stretchMin
protected

Definition at line 408 of file firefly.py.

◆ _stretchUnit

lsst.display.firefly.firefly.DisplayImpl._stretchUnit
protected

Definition at line 410 of file firefly.py.

◆ _url

lsst.display.firefly.firefly.DisplayImpl._url
protected

Definition at line 138 of file firefly.py.

◆ frame

lsst.display.firefly.firefly.DisplayImpl.frame

Definition at line 174 of file firefly.py.


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