Skip to content
Snippets Groups Projects
Commit 4962d288 authored by Steffen Hauf's avatar Steffen Hauf
Browse files

PEP8 formatting

parent ce423f5f
No related branches found
No related tags found
1 merge request!35Feat/reproducibility
This diff is collapsed.
import numpy as np
import sys import sys
import unittest import unittest
from correction_base import CorrectionTestBase, args import numpy as np
from correction_base import CorrectionTestBase, args
class TestAGIPDCorrection(CorrectionTestBase, unittest.TestCase): class TestAGIPDCorrection(CorrectionTestBase, unittest.TestCase):
detector = "AGIPD" detector = "AGIPD"
task = "CORRECT" task = "CORRECT"
parms = {"in-folder": "/gpfs/exfel/exp/SPB/201831/p900039/raw/", parms = {"in-folder": "/gpfs/exfel/exp/SPB/201831/p900039/raw/",
"run": 412, "run": 412,
"out-folder": "/gpfs/exfel/data/scratch/haufs/test/", "out-folder": "/gpfs/exfel/data/scratch/haufs/test/",
"calfile": "/gpfs/exfel/data/scratch/haufs/agipd_on_demand/agipd_store.h5", "calfile": "/gpfs/exfel/data/scratch/haufs/agipd_on_demand"
"/agipd_store.h5",
"sequences": 0} "sequences": 0}
hist_paths = {"INSTRUMENT/(.+)AGIPD(.+)/DET/[0-9]+CH0:xtdf/image/data": hist_paths = {
{ "INSTRUMENT/(.+)AGIPD(.+)/DET/[0-9]+CH0:xtdf/image/data":
"broad": {"bins": 10000, "range": (-1e4, 1e6)}, {
"detail": {"bins": 10000, "range": (-100, 9900)} "broad": {"bins": 10000, "range": (-1e4, 1e6)},
}, "detail": {"bins": 10000, "range": (-100, 9900)}
"INSTRUMENT/(.+)AGIPD(.+)/DET/[0-9]+CH0:xtdf/image/mask": },
{ "INSTRUMENT/(.+)AGIPD(.+)/DET/[0-9]+CH0:xtdf/image/mask":
"detail": {"bins": 32, "range": (0, 32), {
"scl_fun": np.log2} "detail": {"bins": 32, "range": (0, 32),
}, "scl_fun": np.log2}
"INSTRUMENT/(.+)AGIPD(.+)/DET/[0-9]+CH0:xtdf/image/gain": },
{ "INSTRUMENT/(.+)AGIPD(.+)/DET/[0-9]+CH0:xtdf/image/gain":
"detail": {"bins": 3, "range": (0, 3)} {
} "detail": {"bins": 3, "range": (0, 3)}
} }
}
karabo_data_inspects = ['trailer.checksum', 'header.trainId', 'header.reserved',
karabo_data_inspects = ['trailer.checksum', 'header.trainId',
'header.reserved',
'image.cellId', 'header.dataId', 'header.linkId', 'image.cellId', 'header.dataId', 'header.linkId',
'detector.data', 'metadata', 'image.length', 'detector.data', 'metadata', 'image.length',
'header.magicNumberBegin', 'header.majorTrainFormatVersion', 'header.magicNumberBegin',
'trailer.magicNumberEnd', 'image.status', 'image.trainId', 'header.majorTrainFormatVersion',
'trailer.magicNumberEnd', 'image.status',
'image.trainId',
'image.pulseId', 'header.minorTrainFormatVersion', 'image.pulseId', 'header.minorTrainFormatVersion',
'header.pulseCount', 'trailer.status', 'detector.trainId', 'header.pulseCount', 'trailer.status',
'detector.trainId',
'trailer.trainId'] 'trailer.trainId']
def _output_to_path(self): def _output_to_path(self):
opath = self.parms["out-folder"] opath = self.parms["out-folder"]
run = int(self.parms["run"]) run = int(self.parms["run"])
return "{}/r{:04d}".format(opath, run) return "{}/r{:04d}".format(opath, run)
if __name__ == '__main__': if __name__ == '__main__':
sys.argv[1:] = args.unittest_args sys.argv[1:] = args.unittest_args
loader = unittest.TestLoader() loader = unittest.TestLoader()
# make sure generators get run first # make sure generators get run first
ln = lambda f: "generate" not in f ln = lambda f: "generate" not in f
lncmp = lambda a, b: (ln(a) > ln(b)) - (ln(a) < ln(b)) lncmp = lambda a, b: (ln(a) > ln(b)) - (ln(a) < ln(b))
loader.sortTestMethodsUsing = lncmp loader.sortTestMethodsUsing = lncmp
unittest.main(testLoader=loader, verbosity=3) unittest.main(testLoader=loader, verbosity=3)
\ No newline at end of file
import numpy as np
import sys import sys
import unittest import unittest
from correction_base import CorrectionTestBase, args import numpy as np
from correction_base import CorrectionTestBase, args
np.warnings.filterwarnings('ignore') np.warnings.filterwarnings('ignore')
class TestLPDCorrection(CorrectionTestBase, unittest.TestCase): class TestLPDCorrection(CorrectionTestBase, unittest.TestCase):
detector = "LPD" detector = "LPD"
task = "CORRECT" task = "CORRECT"
parms = {"in-folder": "/gpfs/exfel/exp/FXE/201831/p900038/raw/", parms = {"in-folder": "/gpfs/exfel/exp/FXE/201831/p900038/raw/",
"run": 154, "run": 154,
"out-folder": "/gpfs/exfel/data/scratch/haufs/test/", "out-folder": "/gpfs/exfel/data/scratch/haufs/test/",
"calfile": "/gpfs/exfel/exp/FXE/201831/p900038/usr/calibration0818/cal_constants2.h5", "calfile": "/gpfs/exfel/exp/FXE/201831/p900038/usr"
"/calibration0818/cal_constants2.h5",
"sequences": 0} "sequences": 0}
hist_paths = {"INSTRUMENT/(.+)LPD(.+)/DET/[0-9]+CH0:xtdf/image/data": hist_paths = {
{ "INSTRUMENT/(.+)LPD(.+)/DET/[0-9]+CH0:xtdf/image/data":
"broad": {"bins": 10000, "range": (-1e4, 1e6)}, {
"detail": {"bins": 10000, "range": (-100, 9900)} "broad": {"bins": 10000, "range": (-1e4, 1e6)},
}, "detail": {"bins": 10000, "range": (-100, 9900)}
"INSTRUMENT/(.+)LPD(.+)/DET/[0-9]+CH0:xtdf/image/mask": },
{ "INSTRUMENT/(.+)LPD(.+)/DET/[0-9]+CH0:xtdf/image/mask":
"detail": {"bins": 32, "range": (0, 32), {
"scl_fun": np.log2} "detail": {"bins": 32, "range": (0, 32),
}, "scl_fun": np.log2}
"INSTRUMENT/(.+)LPD(.+)/DET/[0-9]+CH0:xtdf/image/gain": },
{ "INSTRUMENT/(.+)LPD(.+)/DET/[0-9]+CH0:xtdf/image/gain":
"detail": {"bins": 3, "range": (0, 3)} {
} "detail": {"bins": 3, "range": (0, 3)}
} }
}
karabo_data_inspects = ['trailer.checksum', 'header.trainId', 'header.reserved',
karabo_data_inspects = ['trailer.checksum', 'header.trainId',
'header.reserved',
'image.cellId', 'header.dataId', 'header.linkId', 'image.cellId', 'header.dataId', 'header.linkId',
'detector.data', 'metadata', 'image.length', 'detector.data', 'metadata', 'image.length',
'header.magicNumberBegin', 'header.majorTrainFormatVersion', 'header.magicNumberBegin',
'trailer.magicNumberEnd', 'image.status', 'image.trainId', 'header.majorTrainFormatVersion',
'trailer.magicNumberEnd', 'image.status',
'image.trainId',
'image.pulseId', 'header.minorTrainFormatVersion', 'image.pulseId', 'header.minorTrainFormatVersion',
'header.pulseCount', 'trailer.status', 'detector.trainId', 'header.pulseCount', 'trailer.status',
'detector.trainId',
'trailer.trainId'] 'trailer.trainId']
def _output_to_path(self): def _output_to_path(self):
opath = self.parms["out-folder"] opath = self.parms["out-folder"]
run = int(self.parms["run"]) run = int(self.parms["run"])
return "{}/r{:04d}".format(opath, run) return "{}/r{:04d}".format(opath, run)
if __name__ == '__main__': if __name__ == '__main__':
sys.argv[1:] = args.unittest_args sys.argv[1:] = args.unittest_args
loader = unittest.TestLoader() loader = unittest.TestLoader()
# make sure generators get run first # make sure generators get run first
ln = lambda f: "generate" not in f ln = lambda f: "generate" not in f
lncmp = lambda a, b: (ln(a) > ln(b)) - (ln(a) < ln(b)) lncmp = lambda a, b: (ln(a) > ln(b)) - (ln(a) < ln(b))
loader.sortTestMethodsUsing = lncmp loader.sortTestMethodsUsing = lncmp
unittest.main(testLoader=loader, verbosity=3) unittest.main(testLoader=loader, verbosity=3)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment