Skip to content

Commit

Permalink
Add support for online raw JungFrau data
Browse files Browse the repository at this point in the history
  • Loading branch information
zhujun98 committed Mar 16, 2020
1 parent 2457365 commit 523cbff
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions extra_foam/pipeline/processors/image_assembler.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,11 +546,6 @@ class DsscImageAssembler(BaseAssembler):
def _get_modules_bridge(self, data, src):
"""Override.
In the file, the data is separated into arrays of different
modules. The layout of data for each module is:
- calibrated, (memory cells, x, y)
- raw, (memory cells, 1, x, y)
- calibrated, "image.data", (modules, x, y, memory cells)
- raw, "image.data", (modules, x, y, memory cells)
-> (memory cells, modules, y, x)
Expand All @@ -560,6 +555,11 @@ def _get_modules_bridge(self, data, src):
def _get_modules_file(self, data, src):
"""Override.
In the file, the data is separated into arrays of different
modules. The layout of data for each module is:
- calibrated, (memory cells, x, y)
- raw, (memory cells, 1, x, y)
- calibrated, "image.data", (memory cells, modules, y, x)
- raw, "image.data", (memory cell, 1, modules, y, x)
-> (memory cells, modules, y, x)
Expand Down Expand Up @@ -633,16 +633,24 @@ def _get_modules_bridge(self, data, src):
Calibrated data only.
- calibrated, "data.adc", TODO
- raw, "data.adc", TODO
- calibrated, "data.adc", (y, x, memory cells)
- raw, "data.adc", (memory cells, y, x)
-> (memory cells, modules, y, x)
"""
modules_data = data[src]
shape = modules_data.shape
dtype = modules_data.dtype

ndim = len(shape)
if ndim == 3:
# (y, x, memory cells) -> (memory cells, 1 module, y, x)
return np.moveaxis(modules_data, -1, 0)[:, np.newaxis, ...]
if dtype == _IMAGE_DTYPE:
# (y, x, memory cells) -> (memory cells, 1 module, y, x)
return np.moveaxis(modules_data, -1, 0)[:, np.newaxis, ...]

if dtype == _RAW_IMAGE_DTYPE:
# (memory cells, y, x) -> (memory cells, 1 module, y, x)
return modules_data[:, np.newaxis, ...]

# (modules, y, x, memory cells) -> (memory cells, modules, y, x)
return np.moveaxis(modules_data, -1, 0)

Expand Down

0 comments on commit 523cbff

Please sign in to comment.