From ca9797d8a3a30f8519953cd31e6f22b8ae84e73f Mon Sep 17 00:00:00 2001 From: philiph-slac Date: Tue, 2 Apr 2024 13:45:53 -0700 Subject: [PATCH 1/2] rixsCCD updates - very basic --- calibrationSuite/argumentParser.py | 1 + calibrationSuite/basicSuiteScript.py | 2 ++ calibrationSuite/detectorInfo.py | 19 ++++++++++++++----- suite_scripts/CalcNoiseAndMean.py | 14 +++++++------- 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/calibrationSuite/argumentParser.py b/calibrationSuite/argumentParser.py index 942d145..edd300d 100644 --- a/calibrationSuite/argumentParser.py +++ b/calibrationSuite/argumentParser.py @@ -25,6 +25,7 @@ def __init__(self): self.parser.add_argument("-c", "--camera", type=int, help="camera.n") self.parser.add_argument("-p", "--path", type=str, help="the base path to the output directory") self.parser.add_argument("-n", "--nModules", type=int, help="nModules") + self.parser.add_argument("--mode", type=str, help="detector mode (1d, 2d, ...?") ## might be discoverable otherwise self.parser.add_argument( "-d", "--detType", type=str, default="", help="Epix100, Epix10ka, Epix10kaQuad, Epix10ka2M, ..." ) diff --git a/calibrationSuite/basicSuiteScript.py b/calibrationSuite/basicSuiteScript.py index 544017c..863a774 100755 --- a/calibrationSuite/basicSuiteScript.py +++ b/calibrationSuite/basicSuiteScript.py @@ -45,6 +45,8 @@ def __init__(self, analysisType="scan"): self.camera = 0 ##self.outputDir = '/sdf/data/lcls/ds/rix/rixx1003721/results/%s/' %(analysisType) self.outputDir = "../%s/" % (analysisType) + print("this messes things up") + self.outputDir = "/%s/" % (analysisType) logging.info("output dir: " + self.outputDir) ##self.outputDir = '/tmp' diff --git a/calibrationSuite/detectorInfo.py b/calibrationSuite/detectorInfo.py index a80f720..e18c261 100644 --- a/calibrationSuite/detectorInfo.py +++ b/calibrationSuite/detectorInfo.py @@ -20,7 +20,7 @@ def __init__(self, detType): self.nRowsPerBank = -1 self.dimension = -1 - knownTypes = ['epixhr', 'epixM', 'rixsCCD'] + knownTypes = ['epixhr', 'epixM', 'archon'] if detType not in knownTypes: raise Exception("type %s not in known types" % (detType, knownTypes)) @@ -31,7 +31,7 @@ def __init__(self, detType): self.setup_epixhr() elif detType == 'epixM': self.setup_epixM() - elif detType == 'rixsCCD': + elif detType == 'archon': self.setup_rixsCCD() def setNModules(self, n): @@ -57,6 +57,15 @@ def setup_epixM(self, version=0): #todo: setup detector here temp = 0 #make python happy - def setup_rixsCCD(self, version=0): - #todo: setup detector here - temp = 0 #make python happy + def setup_rixsCCD(self, mode='1d', version=0): + self.nTestPixelsPerBank = 36 + self.nBanks = 16 + self.nCols = 4800 - self.nBanks*self.nTestPixelsPerBank + self.preferredCommonMode = 'rixsCCDTestPixelSubtraction' + if mode == '1d': + self.nRows = 300 + self.clusterShape = [1,5] ## might be [1,3] + else: + self.nRows = 1200 + self.clusterShape = [3,5] ## maybe + diff --git a/suite_scripts/CalcNoiseAndMean.py b/suite_scripts/CalcNoiseAndMean.py index 35ef654..3b90415 100755 --- a/suite_scripts/CalcNoiseAndMean.py +++ b/suite_scripts/CalcNoiseAndMean.py @@ -29,10 +29,10 @@ def __init__(self): logger.info("have built a " + cn.className + "class") cn.setupPsana() - if cn.special is not None and "skip281" in cn.special: - skip281 = True + if cn.special is not None and "skip283" in cn.special: + skip283 = True else: - skip281 = False + skip283 = False stepGen = cn.getStepGen() ##for nstep, step in enumerate (cn.ds.steps()): @@ -48,7 +48,7 @@ def __init__(self): ec = cn.getEventCodes(evt) beamEvent = cn.isBeamEvent(evt) ##if ec[281] or skip281: - if beamEvent or skip281: + if beamEvent or skip283: if cn.special is not None and "CommonMode" in cn.special: commonModeCut = 2.0## keV, calib if cn.detObj and cn.detObj == 'raw': @@ -90,10 +90,10 @@ def __init__(self): continue for i, p in enumerate(cn.singlePixels): try: - statsArray[i].accumulate(np.double(frames), frames[p[1], p[2]]) + statsArray[i].accumulate(np.double(frames), frames[p[1:]]) except: statsArray[i] = Stats(frames.shape) - statsArray[i].accumulate(np.double(frames), frames[p[1], p[2]]) + statsArray[i].accumulate(np.double(frames), frames[p[1:]]) stats = statsArray[2] ## only matters for cross-correlation noise = stats.rms() means = stats.mean() @@ -121,4 +121,4 @@ def __init__(self): ## probably rms = 0. continue - cn.dumpEventCodeStatistics() \ No newline at end of file + cn.dumpEventCodeStatistics() From 93f40136c77f4b98936b028d0ac41b4a4d268be6 Mon Sep 17 00:00:00 2001 From: philiph-slac Date: Tue, 2 Apr 2024 14:00:54 -0700 Subject: [PATCH 2/2] Had wrong directory structure in rixsCCD --- calibrationSuite/basicSuiteScript.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/calibrationSuite/basicSuiteScript.py b/calibrationSuite/basicSuiteScript.py index f6d1ec3..79bc887 100755 --- a/calibrationSuite/basicSuiteScript.py +++ b/calibrationSuite/basicSuiteScript.py @@ -45,8 +45,6 @@ def __init__(self, analysisType="scan"): self.camera = 0 ##self.outputDir = '/sdf/data/lcls/ds/rix/rixx1003721/results/%s/' %(analysisType) self.outputDir = "../%s/" % (analysisType) - print("this messes things up") - self.outputDir = "/%s/" % (analysisType) logging.info("output dir: " + self.outputDir) ##self.outputDir = '/tmp'