This file is indexed.

/usr/lib/python2.7/dist-packages/ginga/mplw/ipg.py is in python-ginga 2.6.1-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import numpy as np

from ginga.mplw.ImageViewCanvasMpl import ImageViewCanvas
from ginga.misc import log
from ginga.AstroImage import AstroImage
from ginga import cmap
# add matplotlib colormaps to ginga's own set
cmap.add_matplotlib_cmaps()

## from IPython.display import Image
## from io import BytesIO


class CustomMplViewer(ImageViewCanvas):

    def get_nb_image(self):
        return Image(data=bytes(self.get_rgb_image_as_bytes(format='png')),
                     format='png', embed=True)

    def load(self, filepath):
        image = AstroImage(logger=self.logger)
        image.load_file(filepath)

        self.set_image(image)

    def show(self):
        self.figure.show()

    def add_canvas(self, tag=None):
        # add a canvas to the view
        DrawingCanvas = self.getDrawClass('drawingcanvas')
        canvas = DrawingCanvas()
        # enable drawing on the canvas
        canvas.enable_draw(True)
        canvas.enable_edit(True)
        canvas.ui_setActive(True)
        canvas.set_surface(self)
        # add the canvas to the view.
        self.add(canvas, tag=tag)
        return canvas


def get_viewer():
    # Set to True to get diagnostic logging output
    use_logger = False
    logger = log.get_logger(null=not use_logger, log_stderr=True)

    # create a regular matplotlib figure
    fig = plt.figure()

    # create a ginga object, initialize some defaults and
    # tell it about the figure
    viewer = CustomMplViewer(logger)
    viewer.enable_autocuts('on')
    viewer.set_autocut_params('zscale')
    viewer.set_figure(fig)

    # enable all interactive ginga features
    viewer.get_bindings().enable_all(True)

    return viewer