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
110c5f61
Commit
110c5f61
authored
6 years ago
by
Steffen Hauf
Browse files
Options
Downloads
Patches
Plain Diff
Remove unneeded files
parent
86edc57f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!32
Add FastCCD notebooks
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
notebooks/FastCCD/FastCCD Characterization Tests.ipynb
+0
-10669
0 additions, 10669 deletions
notebooks/FastCCD/FastCCD Characterization Tests.ipynb
notebooks/FastCCD/fastccdreaderh5.py
+0
-103
0 additions, 103 deletions
notebooks/FastCCD/fastccdreaderh5.py
with
0 additions
and
10772 deletions
notebooks/FastCCD/FastCCD Characterization Tests.ipynb
deleted
100644 → 0
+
0
−
10669
View file @
86edc57f
This diff is collapsed.
Click to expand it.
notebooks/FastCCD/fastccdreaderh5.py
deleted
100644 → 0
+
0
−
103
View file @
86edc57f
"""
XFEL FCCD Tools
Author: Steffen Hauf <steffen.hauf@xfel.eu>
(c) European X-Ray Free Electron Laser Facility GmbH 2014
This module provides an interface for accessing preliminary LPD data.
Reordering of pixels and inversion is performed through hard-coded look-up tables.
"""
from
__future__
import
print_function
,
division
,
absolute_import
import
h5py
import
numpy
as
np
def
readData
(
filename
,
path
=
'
/stream
'
,
**
kwargs
):
"""
Reads data from a given file (family) and output reordered images
in stacks
Args:
filename (str): the file path and name. If the file is actually a
family of files only the first file, i.e. the one with index
00000.h5 should be given.
path (str =
'
/stream
'
, optional): the path in the hdf5 file at which
the data is located.
kwargs: the following additional parameters may be given:
* image_range ([low, high]): a range of images to be read
* x_range ([low, high]): a range of pixels to be read
* y_range ([low, high]): a range of pixels to be read
* pixels_x (int): number of pixels along x-axis, **compatibility only**.
* pixels_y (int): number of pixels along y-axis, **compatibility only**.
Returns:
numpy.array: a reordered and inverted image with rank 2
Note:
This function is compatible with xfelpycaltools.ChunkedReader
"""
imageRange
=
kwargs
.
get
(
"
image_range
"
,
None
)
pixelXRange
=
kwargs
.
get
(
"
x_range
"
,
None
)
pixelYRange
=
kwargs
.
get
(
"
y_range
"
,
None
)
pixelsX
=
kwargs
.
get
(
"
pixels_x
"
,
None
)
pixelsY
=
kwargs
.
get
(
"
pixels_y
"
,
None
)
f
=
None
if
filename
.
find
(
"
00000
"
)
!=
-
1
:
filenameFam
=
filename
.
replace
(
"
00000
"
,
"
%05d
"
)
f
=
h5py
.
File
(
filenameFam
,
"
r
"
,
driver
=
'
family
'
,
memb_size
=
20
*
1024
**
3
)
# 20GB chunks
else
:
f
=
h5py
.
File
(
filename
,
"
r
"
)
din
=
None
if
imageRange
==
None
:
din
=
f
[
path
]
else
:
din
=
f
[
path
][
imageRange
[
0
]:
imageRange
[
1
]]
d
=
None
if
pixelXRange
==
None
and
pixelYRange
==
None
:
d
=
np
.
array
(
din
[:,
:,:])
d
=
np
.
rollaxis
(
d
,
0
,
start
=
3
)
else
:
d
=
np
.
array
(
din
[
pixelXRange
[
0
]:
pixelXRange
[
1
],
pixelYRange
[
0
]:
pixelYRange
[
1
],:])
d
=
np
.
rollaxis
(
d
,
0
,
start
=
3
)
f
.
close
()
return
d
.
astype
(
np
.
float
)
def
getDataSize
(
filename
,
path
=
'
/stream
'
):
"""
Returns the number of image in a given file (family)
Args:
filename (str): the file path and name. If the file is actually a
family of files only the first file, i.e. the one with index
00000.h5 should be given.
path (str =
'
/stream
'
, optional): the path in the hdf5 file at which
the data is located.
"""
f
=
None
if
filename
.
find
(
"
00000
"
)
!=
-
1
:
filenameFam
=
filename
.
replace
(
"
00000
"
,
"
%05d
"
)
# print filenameFam
f
=
h5py
.
File
(
filenameFam
,
"
r
"
,
driver
=
'
family
'
,
memb_size
=
20
*
1024
**
3
)
# 20GB chunks
else
:
f
=
h5py
.
File
(
filename
,
"
r
"
)
return
f
[
path
].
shape
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