Пример #1
0
    def __init__(self, arg_list):
        super(MainFrame, self).__init__()
        self.args = args

        # Set up tolerance
        self.eps = np.finfo("float64").eps
        self.firstUpdate = True
        self.operationModeChoices = ['none', 'masking']
        self.operationMode = self.operationModeChoices[
            0]  # Masking mode, Peak finding mode
        # Init experiment parameters from args
        if args.expRun is not None and ':run=' in args.expRun:
            self.experimentName = args.expRun.split('exp=')[-1].split(':')[0]
            self.runNumber = int(args.expRun.split('run=')[-1])
        else:
            self.experimentName = args.exp
            self.runNumber = int(args.run)
        self.detInfo = args.det
        self.detAlias = None
        self.eventNumber = int(args.evt)

        # Directories
        self.psocakeDir = None
        self.psocakeRunDir = None
        self.elogDir = None
        self.rootDir = None
        self.writeAccess = True

        # Init variables
        self.det = None
        self.detnames = None
        self.detInfoList = None
        self.isCspad = False
        self.evt = None
        self.eventID = ""
        self.hasExperimentName = False
        self.hasRunNumber = False
        self.hasDetInfo = False
        self.pixelIndAssem = None

        # Init diffraction geometry parameters
        self.coffset = 0.0
        self.clen = 0.0
        self.clenEpics = 0.0
        self.epics = None
        self.detectorDistance = 0.0
        self.photonEnergy = None
        self.wavelength = None
        self.pixelSize = None
        self.resolutionRingsOn = False
        self.resolution = None
        self.resolutionUnits = 0

        # Init variables
        self.calib = None  # ndarray detector image
        self.data = None  # assembled detector image
        self.cx = 0  # detector centre x
        self.cy = 0  # detector centre y

        ## Switch to using white background and black foreground
        pg.setConfigOption('background', color.background)
        pg.setConfigOption('foreground', color.foreground)

        ########################################
        # Instantiate panels
        ########################################
        self.exp = ExperimentPanel.ExperimentInfo(self)
        self.geom = diffractionGeometryPanel.DiffractionGeometry(self)
        self.index = crystalIndexingPanel.CrystalIndexing(self)
        self.small = SmallDataPanel.SmallData(self)
        #self.evtLabels = LabelPanel.Labels(self)
        self.pk = PeakFindingPanel.PeakFinding(self)
        self.hf = HitFinderPanel.HitFinder(self)
        self.mk = MaskPanel.MaskMaker(self)
        self.img = ImagePanel.ImageViewer(self)
        self.roi = RoiPanel.RoiHistogram(self)
        self.control = ImageControlPanel.ImageControl(self)
        self.mouse = MousePanel.Mouse(self)
        self.stack = ImageStackPanel.ImageStack(self)

        self.initUI()
Пример #2
0
    def __init__(self, arg_list):
        super(MainFrame, self).__init__()
        self.args = args
        self.area = DockArea()

        # Get username
        self.username = self.getUsername()

        # Set up tolerance
        self.eps = np.finfo("float64").eps
        self.firstUpdate = True
        self.operationModeChoices = ['none', 'masking']
        self.operationMode = self.operationModeChoices[
            0]  # Masking mode, Peak finding mode

        # Supported facilities keywords
        self.facilityLCLS = 'LCLS'
        if 'CFEL' in os.environ['PSOCAKE_FACILITY'].upper():
            self.facility = self.facilityLCLS
            self.dir = '/gpfs/cfel/cxi/common/slac/reg/d/psdm'
            if args.outDir is None:
                args.outDir = '/gpfs/cfel/cxi/scratch/user/' + self.username + '/psocake'
        elif 'LCLS' in os.environ['PSOCAKE_FACILITY'].upper():
            self.facility = self.facilityLCLS
            self.dir = '/reg/d/psdm'

        # Init experiment parameters from args
        if args.expRun is not None and ':run=' in args.expRun:
            self.experimentName = args.expRun.split('exp=')[-1].split(':')[0]
            self.runNumber = int(args.expRun.split('run=')[-1])
        else:
            self.experimentName = args.exp
            self.runNumber = int(args.run)
        self.detInfo = args.det
        self.detAlias = None
        self.eventNumber = int(args.evt)
        self.inputImages = args.inputImages
        self.mode = args.mode
        self.batch = args.batch.lower()
        print(
            "\n################################################################"
        )
        if self.batch == "lsf":
            print("Using LSF for batch jobs. Use -b to set batch preference.")
        else:
            print(
                "Using SLURM for batch jobs. Use -b to set batch preference.")
        print(
            "################################################################")

        # Directories
        self.psocakeDir = None
        self.psocakeRunDir = None
        self.elogDir = None
        self.rootDir = None
        self.writeAccess = True
        self.access = args.access.lower()
        if 'ffb' in self.access:
            print(
                "################################################################"
            )
            print(
                "Remember only psfeh(hi)prioq/psneh(hi)prioq can access FFB nodes"
            )
            print("FFB node is here: /reg/d/ffb/")
            print(
                "################################################################"
            )

        # Init variables
        self.det = None
        self.detnames = None
        self.detInfoList = None
        self.evt = None
        self.eventID = ""
        self.hasExperimentName = False
        self.hasRunNumber = False
        self.hasDetInfo = False
        self.pixelIndAssem = None

        self.doneExpSetup = False
        self.doneRunSetup = False
        self.doneDetSetup = False
        self.doneEvtSetup = False
        self.doneInit = False

        # Init diffraction geometry parameters
        self.coffset = 0.0
        self.clen = 0.0
        self.clenEpics = 0.0
        self.epics = None
        self.detectorDistance = 0.0
        self.photonEnergy = None
        self.wavelength = None
        self.pixelSize = None
        self.resolutionRingsOn = False
        self.resolution = None
        self.resolutionUnits = 0

        # Init variables
        self.calib = None  # ndarray detector image
        self.data = None  # assembled detector image
        self.cx = 0  # detector centre x
        self.cy = 0  # detector centre y

        ## Switch to using white background and black foreground
        pg.setConfigOption('background', color.background)
        pg.setConfigOption('foreground', color.foreground)
        ########################################
        # Instantiate panels
        ########################################
        self.mouse = MousePanel.Mouse(self)
        self.img = ImagePanel.ImageViewer(self)
        self.stack = ImageStackPanel.ImageStack(self)
        self.exp = ExperimentPanel.ExperimentInfo(self)
        self.geom = DiffractionGeometryPanel.DiffractionGeometry(self)
        self.roi = RoiPanel.RoiHistogram(self)
        self.pk = PeakFindingPanel.PeakFinding(self)
        self.index = CrystalIndexingPanel.CrystalIndexing(self)
        self.mk = MaskPanel.MaskMaker(self)
        self.small = SmallDataPanel.SmallData(self)
        self.control = ImageControlPanel.ImageControl(self)
        self.hf = HitFinderPanel.HitFinder(self)
        if 'label' in args.mode:
            self.labeling = LabelingPanel.Labeling(self)

        self.scheme()