Ejemplo n.º 1
0
 def get_mask_blemish(sp) :
     if sp.mask_blemish != None : return sp.mask_blemish
     if cp.ccdcorr_blemish.value() :
         sp.mask_blemish = gu.get_array_from_file(fnm.path_blem())
         logger.info('Blemish mask is taken from file ' + fnm.path_blem(), __name__)
     else :
         logger.info('Blemish mask is turned off', __name__)
         sp.mask_blemish = np.ones((sp.rows,sp.cols), dtype=np.uint8)
         #np.savetxt(fnm.path_blem()+'-all-ones', sp.mask_blemish, fmt='%1d', delimiter=' ') 
     return sp.mask_blemish
Ejemplo n.º 2
0
 def get_mask_blemish(sp) :
     if sp.mask_blemish != None : return sp.mask_blemish
     if cp.ccdcorr_blemish.value() :
         sp.mask_blemish = gu.get_array_from_file(fnm.path_blem())
         logger.info('Blemish mask is taken from file ' + fnm.path_blem(), __name__)
     else :
         logger.info('Blemish mask is turned off', __name__)
         sp.mask_blemish = np.ones((sp.rows,sp.cols), dtype=np.uint8)
         #np.savetxt(fnm.path_blem()+'-all-ones', sp.mask_blemish, fmt='%1d', delimiter=' ') 
     return sp.mask_blemish
Ejemplo n.º 3
0
    def setTableInfoItems(self):

        self.item_data_file.setText(os.path.basename(fnm.path_data_xtc_cond()))

        if cp.bat_dark_is_used.value():
            self.item_dark_file.setText(
                os.path.basename(fnm.path_pedestals_ave()))
        else:
            self.item_dark_file.setText('is not used')

        if cp.ccdcorr_flatfield.value():
            self.item_flat_file.setText(os.path.basename(fnm.path_flat()))
        else:
            self.item_flat_file.setText('is not used')

        if cp.ccdcorr_blemish.value():
            self.item_blem_file.setText(os.path.basename(fnm.path_blem()))
        else:
            self.item_blem_file.setText('is not used')

        self.item_data_start.setText(str(cp.bat_data_start.value()))
        self.item_data_end.setText(str(cp.bat_data_end.value()))
        self.item_data_total.setText(str(cp.bat_data_total.value()))
        self.item_data_time.setText(
            str(cp.bat_data_dt_ave.value()) + u'\u00B1' +
            str(cp.bat_data_dt_rms.value()))
Ejemplo n.º 4
0
    def __init__ ( self, parent=None ) :
        QtGui.QWidget.__init__(self, parent)
        self.setGeometry(200, 400, 530, 30)
        self.setWindowTitle('Blemish file')
        self.setFrame()

        self.cbx_use = QtGui.QCheckBox('Use blemish correction', self)
        self.cbx_use.setChecked( cp.ccdcorr_blemish.value() )

        self.edi_path = QtGui.QLineEdit( fnm.path_blem() )        
        self.edi_path.setReadOnly( True )   
        self.but_path = QtGui.QPushButton('File:')
        self.but_plot = QtGui.QPushButton('Plot')
        self.but_brow = QtGui.QPushButton('Browse')

        self.grid = QtGui.QGridLayout()
        self.grid_row = 1
        #self.grid.addWidget(self.tit_path, self.grid_row,   0)
        self.grid.addWidget(self.cbx_use,  self.grid_row,   0, 1, 6)
        self.grid.addWidget(self.but_path, self.grid_row+1, 0)
        self.grid.addWidget(self.edi_path, self.grid_row+1, 1, 1, 6)
        self.grid.addWidget(self.but_plot, self.grid_row+2, 0)
        self.grid.addWidget(self.but_brow, self.grid_row+2, 1)

        self.connect(self.cbx_use,  QtCore.SIGNAL('stateChanged(int)'), self.onCBox ) 
        self.connect(self.but_path, QtCore.SIGNAL('clicked()'), self.on_but_path )
        self.connect(self.but_plot, QtCore.SIGNAL('clicked()'), self.on_but_plot )
        self.connect(self.but_brow, QtCore.SIGNAL('clicked()'), self.on_but_browser )

        self.setLayout(self.grid)

        self.showToolTips()
        self.setStyle()
Ejemplo n.º 5
0
 def on_but_browser (self):       
     logger.debug('on_but_browser', __name__)
     try    :
         cp.guifilebrowser.close()
     except :
         cp.guifilebrowser = GUIFileBrowser(None, [fnm.path_blem()])
         cp.guifilebrowser.move(cp.guimain.pos().__add__(QtCore.QPoint(720,120)))
         cp.guifilebrowser.show()
Ejemplo n.º 6
0
 def on_but_browser (self):       
     logger.debug('on_but_browser', __name__)
     try    :
         cp.guifilebrowser.close()
     except :
         cp.guifilebrowser = GUIFileBrowser(None, [fnm.path_blem()])
         cp.guifilebrowser.move(cp.guimain.pos().__add__(QtCore.QPoint(720,120)))
         cp.guifilebrowser.show()
Ejemplo n.º 7
0
    def on_but_path(self):
        logger.debug('Blemish file browser', __name__ )
        path = str(self.edi_path.text())        
        path = str( QtGui.QFileDialog.getOpenFileName(self,'Select file',path) )
        dname, fname = os.path.split(path)

        if dname == '' or fname == '' :
            logger.info('Input directiry name or file name is empty... keep file path unchanged...')
            return

        self.edi_path.setText(path)
        cp.dname_blem.setValue(dname)
        cp.fname_blem.setValue(fname)
        logger.info('selected file: ' + str(fnm.path_blem()), __name__ )
Ejemplo n.º 8
0
    def on_but_path(self):
        logger.debug('Blemish file browser', __name__ )
        path = str(self.edi_path.text())        
        path = str( QtGui.QFileDialog.getOpenFileName(self,'Select file',path) )
        dname, fname = os.path.split(path)

        if dname == '' or fname == '' :
            logger.info('Input directiry name or file name is empty... keep file path unchanged...')
            return

        self.edi_path.setText(path)
        cp.dname_blem.setValue(dname)
        cp.fname_blem.setValue(fname)
        logger.info('selected file: ' + str(fnm.path_blem()), __name__ )
Ejemplo n.º 9
0
 def on_but_plot(self):
     logger.debug('on_but_plot', __name__)
     try :
         logger.debug('try to close', __name__)
         cp.plotimgspe.close()
         try    : del cp.plotimgspe
         except : pass
         #but.setStyleSheet(cp.styleButtonBad)
     except :
         logger.debug('except and open', __name__)
         arr = gu.get_array_from_file(fnm.path_blem())
         if arr == None : return
         logger.debug('Array shape: ' + str(arr.shape), __name__)
         cp.plotimgspe = PlotImgSpe(None, arr, ofname=fnm.path_blem_plot())
         cp.plotimgspe.move(cp.guimain.pos().__add__(QtCore.QPoint(740,140))) # self.parentWidget().pos()
         cp.plotimgspe.show()
Ejemplo n.º 10
0
 def on_but_plot(self):
     logger.debug('on_but_plot', __name__)
     try :
         logger.debug('try to close', __name__)
         cp.plotimgspe.close()
         try    : del cp.plotimgspe
         except : pass
         #but.setStyleSheet(cp.styleButtonBad)
     except :
         logger.debug('except and open', __name__)
         arr = gu.get_array_from_file(fnm.path_blem())
         if arr == None : return
         logger.debug('Array shape: ' + str(arr.shape), __name__)
         cp.plotimgspe = PlotImgSpe(None, arr, ofname=fnm.path_blem_plot())
         cp.plotimgspe.move(cp.guimain.pos().__add__(QtCore.QPoint(740,140))) # self.parentWidget().pos()
         cp.plotimgspe.show()
Ejemplo n.º 11
0
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.setGeometry(200, 400, 530, 30)
        self.setWindowTitle('Blemish file')
        self.setFrame()

        self.cbx_use = QtGui.QCheckBox('Use blemish correction', self)
        self.cbx_use.setChecked(cp.ccdcorr_blemish.value())

        self.edi_path = QtGui.QLineEdit(fnm.path_blem())
        self.edi_path.setReadOnly(True)
        self.but_path = QtGui.QPushButton('File:')
        self.but_plot = QtGui.QPushButton('Plot')
        self.but_brow = QtGui.QPushButton('View')
        self.but_med = QtGui.QPushButton('Mask Editor')

        self.grid = QtGui.QGridLayout()
        self.grid_row = 1
        #self.grid.addWidget(self.tit_path, self.grid_row,   0)
        self.grid.addWidget(self.cbx_use, self.grid_row, 0, 1, 6)
        self.grid.addWidget(self.but_path, self.grid_row + 1, 0)
        self.grid.addWidget(self.edi_path, self.grid_row + 1, 1, 1, 6)
        self.grid.addWidget(self.but_plot, self.grid_row + 2, 0)
        self.grid.addWidget(self.but_brow, self.grid_row + 2, 1)
        self.grid.addWidget(self.but_med, self.grid_row + 2, 2)

        self.connect(self.cbx_use, QtCore.SIGNAL('stateChanged(int)'),
                     self.onCBox)
        self.connect(self.but_path, QtCore.SIGNAL('clicked()'),
                     self.on_but_path)
        self.connect(self.but_plot, QtCore.SIGNAL('clicked()'),
                     self.on_but_plot)
        self.connect(self.but_brow, QtCore.SIGNAL('clicked()'),
                     self.on_but_browser)
        self.connect(self.but_med, QtCore.SIGNAL('clicked()'), self.on_but_med)

        self.setLayout(self.grid)

        self.showToolTips()
        self.setStyle()
Ejemplo n.º 12
0
    def setTableInfoItems(self) :

        self.item_data_file.setText( os.path.basename(fnm.path_data_xtc_cond()) )        

        if cp.bat_dark_is_used.value()  : self.item_dark_file.setText( os.path.basename(fnm.path_pedestals_ave()) )
        else                            : self.item_dark_file.setText( 'is not used' )

        if cp.ccdcorr_flatfield.value() : self.item_flat_file.setText( os.path.basename(fnm.path_flat()) )
        else                            : self.item_flat_file.setText( 'is not used' )

        if cp.ccdcorr_blemish.value()   : self.item_blem_file.setText( os.path.basename(fnm.path_blem()) )
        else                            : self.item_blem_file.setText( 'is not used' )

        self.item_data_start.setText ( str( cp.bat_data_start.value() ) )        
        self.item_data_end  .setText ( str( cp.bat_data_end  .value() ) )        
        self.item_data_total.setText ( str( cp.bat_data_total.value() ) )        
        self.item_data_time .setText ( str( cp.bat_data_dt_ave.value() ) + u'\u00B1'
                                     + str( cp.bat_data_dt_rms.value() ) )