Пример #1
0
    def __init__(self, data_np=None, metadata=None, logger=None, name=None):

        Callback.Callbacks.__init__(self)

        if logger is not None:
            self.logger = logger
        else:
            self.logger = logging.Logger('BaseImage')
        if data_np is None:
            data_np = numpy.zeros((1, 1))
        self._data = data_np
        self.metadata = {}
        if metadata:
            self.update_metadata(metadata)
        self.order = ''
        self.name = name
        # make sure an image has these attributes
        # TODO: this maybe should have a unique random string or something
        # but we'd have to fix a lot of code that is currently checking for
        # None
        self.metadata.setdefault('name', None)

        self._set_minmax()

        self.autocuts = AutoCuts.Histogram(self.logger)

        # For callbacks
        for name in ('modified', ):
            self.enable_callback(name)
Пример #2
0
    def __init__(self,
                 data_np=None,
                 metadata=None,
                 logger=None,
                 order=None,
                 name=None):

        ViewerObjectBase.__init__(self,
                                  logger=logger,
                                  metadata=metadata,
                                  name=name)

        if data_np is None:
            data_np = np.zeros((1, 1))
        self._data = data_np
        self.order = ''
        self.name = name

        # For navigating multidimensional data
        self.naxispath = []
        self.revnaxis = []

        self._set_minmax()
        self._calc_order(order)

        self.autocuts = AutoCuts.Histogram(self.logger)
Пример #3
0
    def __init__(self, data_np=None, metadata=None, logger=None, name=None):

        ViewerObjectBase.__init__(self, logger=logger, metadata=metadata,
                                  name=name)

        if data_np is None:
            data_np = numpy.zeros((1, 1))
        self._data = data_np
        self.order = ''
        self.name = name

        self._set_minmax()

        self.autocuts = AutoCuts.Histogram(self.logger)
Пример #4
0
    def __init__(self, fv, fitsimage):
        # superclass defines some variables for us, like logger
        super(Histogram, self).__init__(fv, fitsimage)

        self.layertag = 'histogram-canvas'
        self.histtag = None
        # If True, limits X axis to lo/hi cut levels
        self.xlimbycuts = True
        self._split_sizes = [400, 500]

        # get Histogram preferences
        prefs = self.fv.get_preferences()
        self.settings = prefs.create_category('plugin_Histogram')
        self.settings.add_defaults(draw_then_move=True, num_bins=2048,
                                   hist_color='aquamarine', show_stats=True,
                                   maxdigits=7)
        self.settings.load(onError='silent')

        # Set up histogram control parameters
        self.histcolor = self.settings.get('hist_color', 'aquamarine')
        self.numbins = self.settings.get('num_bins', 2048)
        self.autocuts = AutoCuts.Histogram(self.logger)

        # for formatting statistics line
        self.show_stats = self.settings.get('show_stats', True)
        maxdigits = self.settings.get('maxdigits', 7)
        self.fmt_cell = '{:< %d.%dg}' % (maxdigits - 1, maxdigits // 2)

        self.dc = self.fv.get_draw_classes()

        canvas = self.dc.DrawingCanvas()
        canvas.enable_draw(True)
        canvas.enable_edit(True)
        canvas.set_drawtype('rectangle', color='cyan', linestyle='dash',
                            drawdims=True)
        canvas.set_callback('draw-event', self.draw_cb)
        canvas.set_callback('edit-event', self.edit_cb)
        canvas.add_draw_mode('move', down=self.drag,
                             move=self.drag, up=self.update)
        canvas.register_for_cursor_drawing(self.fitsimage)
        canvas.set_surface(self.fitsimage)
        canvas.set_draw_mode('draw')
        self.canvas = canvas

        fitssettings = fitsimage.get_settings()
        for name in ['cuts']:
            fitssettings.get_setting(name).add_callback(
                'set', self.cutset_ext_cb, fitsimage)
        self.gui_up = False
Пример #5
0
    def pre_init(self, fitsfile=os.path.join(script_dir, "test.fits")):
        #App design
        self.format_string = formats
        self.interface_file = os.path.join(script_dir,
                                           "WebbFITSViewer_interface.yaml")

        #Tunable settings
        self.pan_scale = 0.05
        self.initial_zoom = 1.0
        self.zoom_speed = 0.02

        #initialize the Ginga backend
        self.logger = log.get_logger("ginga",
                                     level=20,
                                     log_file="/tmp/ginga.log")
        self.autocuts = AutoCuts.Histogram(self.logger)
        self.selected_data = None
        self.box_corners = []

        self.pre_fitsfile = fitsfile
Пример #6
0
    def __init__(self, data_np=None, metadata=None, logger=None):

        Callback.Callbacks.__init__(self)

        if logger != None:
            self.logger = logger
        else:
            self.logger = logging.Logger('BaseImage')
        if data_np == None:
            data_np = numpy.zeros((1, 1))
        self._data = data_np
        self.metadata = {}
        if metadata:
            self.update_metadata(metadata)
        self.order = ''

        self._set_minmax()

        self.autocuts = AutoCuts.Histogram(self.logger)

        # For callbacks
        for name in ('modified', ):
            self.enable_callback(name)