Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pycalibration
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
calibration
pycalibration
Commits
4962d288
Commit
4962d288
authored
6 years ago
by
Steffen Hauf
Browse files
Options
Downloads
Patches
Plain Diff
PEP8 formatting
parent
ce423f5f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!35
Feat/reproducibility
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
tests/correction_base.py
+273
-81
273 additions, 81 deletions
tests/correction_base.py
tests/test_agipd.py
+32
-28
32 additions, 28 deletions
tests/test_agipd.py
tests/test_lpd.py
+32
-28
32 additions, 28 deletions
tests/test_lpd.py
with
337 additions
and
137 deletions
tests/correction_base.py
+
273
−
81
View file @
4962d288
This diff is collapsed.
Click to expand it.
tests/test_agipd.py
+
32
−
28
View file @
4962d288
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
This diff is collapsed.
Click to expand it.
tests/test_lpd.py
+
32
−
28
View file @
4962d288
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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment