Skip to content

Commit

Permalink
Merge pull request #126 from slaclab/epix100_psana1_fix_tests
Browse files Browse the repository at this point in the history
Epix100 psana1 fix tests
  • Loading branch information
nstelter-slac authored Aug 27, 2024
2 parents 73627cf + 293f496 commit 3ff082a
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 7 deletions.
3 changes: 2 additions & 1 deletion calibrationSuite/detectorInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def __init__(self, detType, detSubtype="1d", detVersion=0):
# declare all detector-specific info vars here in case any setup_X functions don't,
# and use -1 so caller knows things are not setup (non-0 to avoid error on divide.
self.nModules = -1
self.detSubtype = detSubtype

self.nRows = -1
self.nCols = -1
Expand Down Expand Up @@ -45,7 +46,7 @@ def __init__(self, detType, detSubtype="1d", detVersion=0):
if detType not in knownTypes:
raise Exception("type %s not in known types %s" % (detType, str(knownTypes)))

self.epix10kCameraTypes = {1: "Epix10ka", 4: "Epix10kaQuad", 16: "Epix10ka2M"}
self.ePix10kCameraTypes = {1: "Epix10ka", 4: "Epix10kaQuad", 16: "Epix10ka2M"}
self.jungfrauCameraTypes = {1: "Jungfrau0.5", 2: "Jungfrau1M", 8: "Jungfrau4M"}

def setupDetector(self): ## needs nModules to be set
Expand Down
2 changes: 1 addition & 1 deletion calibrationSuite/psanaCommon.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ def setupFromCmdlineArgs(self):
if self.args.nModules is not None:
raise RuntimeError("should not specify exact detector type and n modules")
if epix10k:
nModules = [k for k in self.detectorInfo.epix10kCameraTypes.keys() if self.detectorInfo.epix10kCameraTypes[k]==self.detType]
nModules = [k for k in self.detectorInfo.ePix10kCameraTypes.keys() if self.detectorInfo.ePix10kCameraTypes[k]==self.detType]
if jungfrau:
nModules = [k for k in self.detectorInfo.jungfrauCameraTypes.keys() if self.detectorInfo.jungfrauCameraTypes[k]==self.detType]
if nModules == []:
Expand Down
2 changes: 1 addition & 1 deletion suite_scripts/AnalyzeH5.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def __init__(self):
self.label = args.label
self.camera = 0
self.seedCut = args.seedCut
self.isTestRun = 'testRun' in args.special
self.isTestRun = args.special is not None and 'testRun' in args.special

def getFiles(self):
fileNames = self.files.split(",")
Expand Down
2 changes: 1 addition & 1 deletion suite_scripts/EventScanParallelSlice.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ def analyze_h5(self, dataFile, label):
pulseId = 0
else:
timestamp = evt.datetime().timestamp()
pulsId = esp.getPulseId(evt)
pulseId = esp.getPulseId(evt)
smdDict = {
"timestamps": timestamp,
"pulseIds": pulseId,
Expand Down
4 changes: 4 additions & 0 deletions tests/test_DetectorInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

def test_epixhr_setup():
detector = DetectorInfo("epixhr")
detector.setupDetector()

assert detector.detectorType == "epixhr"
assert detector.g0cut == 1 << 14
Expand All @@ -20,6 +21,7 @@ def test_epixhr_setup():

def test_epixm_setup():
detector = DetectorInfo("epixm")
detector.setupDetector()

assert detector.detectorType == "epixm"
assert detector.g0cut == 1 << 15
Expand All @@ -41,6 +43,7 @@ def test_epixm_setup():

def test_archon_setup_1d():
detector = DetectorInfo("archon")
detector.setupDetector()

assert detector.detectorType == "archon"
assert detector.dimension == 2
Expand All @@ -54,6 +57,7 @@ def test_archon_setup_1d():

def test_archon_setup_2d():
detector = DetectorInfo("archon", "2d")
detector.setupDetector()

assert detector.detectorType == "archon"
assert detector.dimension == 3
Expand Down
4 changes: 1 addition & 3 deletions tests/test_SuiteScripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,6 @@ def test_HistogramFlux(suite_tester, command, output_dir_name):
pytest.skip("Can only test with psana library on S3DF!")
suite_tester.test_command(command, output_dir_name)


# this test uses input data from sdf filepath (available on s3df),
# and we remove r102_custers.npy from the correctness comparison b/c this file is around 10gb!
@pytest.mark.parametrize(
Expand All @@ -468,7 +467,7 @@ def test_HistogramFlux(suite_tester, command, output_dir_name):
[
"bash",
"-c",
"time python AnalyzeH5.py -r 102 -f /sdf/data/lcls/ds/rix/rixx1005922/results/lowFlux/SimpleClusters__c0_r102_n100.h5 -p ./test_analyze_h5 --special testRun && rm ./test_analyze_h5/r102_clusters.npy",
"time python AnalyzeH5.py -r 102 -f /sdf/data/lcls/ds/rix/rixx1005922/results/lowFlux/SimpleClusters_testData_c0_r47_n666.h5 -p ./test_analyze_h5 --special testRun && rm ./test_analyze_h5/r102_clusters.npy",
],
"test_analyze_h5",
),
Expand All @@ -479,7 +478,6 @@ def test_Analyze_h5(suite_tester, command, output_dir_name):
pytest.skip("Can only test with psana library on S3DF!")
suite_tester.test_command(command, output_dir_name)


# non-working commands...
'''
@pytest.mark.parametrize("command, output_dir_name", [
Expand Down

0 comments on commit 3ff082a

Please sign in to comment.