Skip to content

Commit

Permalink
Merge pull request #117 from slaclab/beamtime_june_14_2024
Browse files Browse the repository at this point in the history
Merge in changes from beamtime june 14 2024
  • Loading branch information
nstelter-slac authored Jun 17, 2024
2 parents 79edd92 + 0e4bd70 commit 8bb92fd
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 9 deletions.
3 changes: 2 additions & 1 deletion calibrationSuite/argumentParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ def __init__(self):
self.parser.add_argument("-cf", "--configFile", type=str, help="config file path, can be relative or full path")
self.parser.add_argument("-L", "--label", type=str, help="analysis label")
self.parser.add_argument("-t", "--threshold", help="threshold (ADU or keV or wave8) depending on --detObj")
self.parser.add_argument("--fluxCut", type=float, help="minimum flux to be included in analysis")
self.parser.add_argument("--fluxCutMin", type=float, help="minimum flux to be included in analysis")
self.parser.add_argument("--fluxCutMax", type=float, help="maximum flux to be included in analysis")
self.parser.add_argument("--seedCut", help="seed cut for clustering")
self.parser.add_argument(
"--special",
Expand Down
6 changes: 4 additions & 2 deletions calibrationSuite/basicSuiteScript.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,10 @@ def __init__(self, analysisType="scan"):
self.seedCut = eval(self.args.seedCut)
else:
self.seedCut = None
if self.args.fluxCut is not None:
self.fluxCut = self.args.fluxCut
if self.args.fluxCutMin is not None:
self.fluxCutMin = self.args.fluxCutMin
if self.args.fluxCutMax is not None:
self.fluxCutMax = self.args.fluxCutMax
try:
self.runRange = eval(self.args.runRange) ## in case needed
except Exception:
Expand Down
7 changes: 6 additions & 1 deletion calibrationSuite/psana1Base.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,12 @@ def getFlux(self, evt):
return None
f = fluxes[self.fluxChannels].mean() * self.fluxSign
try:
if f < self.fluxCut:
if f < self.fluxCutMin:
return None
except Exception:
pass
try:
if f > self.fluxCutMax:
return None
except Exception:
pass
Expand Down
7 changes: 6 additions & 1 deletion calibrationSuite/psana2Base.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,12 @@ def _getFlux(self, evt):
# print(e)
return None
try:
if f < self.fluxCut:
if f < self.fluxCutMin:
return None
except Exception:
pass
try:
if f > self.fluxCutMax:
return None
except Exception:
pass
Expand Down
14 changes: 10 additions & 4 deletions suite_scripts/LinearityPlotsParallelSlice.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def plotDataROIs(self, means, flux, label, raw=True):
def analyze_h5(self, dataFile, label):
data = h5py.File(dataFile)
fluxes = data["fluxes"][()]
print(fluxes)
print(np.array(fluxes))
rois = data["rois"][()]
pixels = data["pixels"][()]
g0s = []
Expand Down Expand Up @@ -215,8 +215,11 @@ def analyze_h5_slice(self, dataFile, label):
break

iDet, jDet = self.sliceToDetector(i, j)
if False:
try:
self.fitInfo[module, i, j, 8] = self.g0Ped[module, iDet, jDet]
except:
pass
if False:
self.fitInfo[module, i, j, 9] = self.g1Ped[module, iDet, jDet]
self.fitInfo[module, i, j, 10] = self.g0Gain[module, iDet, jDet]
self.fitInfo[module, i, j, 11] = self.g1Gain[module, iDet, jDet]
Expand Down Expand Up @@ -267,7 +270,7 @@ def analyze_h5_slice(self, dataFile, label):
y_g1_min = y.min()
x = fluxes[g1]
if self.profiles:
x, y, err = ancillaryMethods.makeProfile(x, y, 50)
x, y, err = ancillaryMethods.makeProfile(x, y, 50, myStatistic="median")
if x is None: ##empty plot if single points/bin apparently
print("empty profile for %d, %d" % (i, j))
logger.info("empty profile for %d, %d" % (i, j))
Expand Down Expand Up @@ -370,7 +373,10 @@ def analyze_h5_slice(self, dataFile, label):

lpp.setupPsana()

size = 666
try:
size = comm.Get_size()
except:
size = 1
smd = lpp.ds.smalldata(
filename="%s/%s_%s_c%d_r%d_n%d.h5" % (lpp.outputDir, lpp.className, lpp.label, lpp.camera, lpp.run, size)
)
Expand Down

0 comments on commit 8bb92fd

Please sign in to comment.