In [1]:
import numpy as np
from databroker import DataBroker, get_table
from csxtools.utils import get_fastccd_images, get_images_to_4D
from csxtools.ipynb import image_stack_to_movie, show_image_stack
%matplotlib inline
from matplotlib import pyplot as plt
Set the logger level to info to see logging output
In [2]:
import logging
logging.getLogger().setLevel(logging.INFO)
In [3]:
bgnd = DataBroker['ce5042b7-00ae-49ca-9b11-b10c5661aaaa'] #[52440]
In [4]:
data = DataBroker['b2596f8e-d220-4aea-8a55-8ccb17cbdacc'] #[52436]
In [5]:
images = get_fastccd_images(data, (bgnd, None, None), tag='fccd_image_lightfield')
The returned images object is a 4D stack of images of shape (N, M, y, x) where N is the number of events. This is - for example - the number of data points in a scan. M is the number of images collected at each point, while y and x are the size of the CCD chip.
As the data was collected as a single ct(), there is only one event. Lets select that.
In [6]:
stack = images[0]
In [7]:
stack[0]
Out[7]:
We can use this as a PIMS object, or we could convert it to a image stack using the get_images_to_4D() function
In [8]:
arr = get_images_to_4D(stack)
arr.shape
Out[8]:
In [9]:
type(arr)
Out[9]:
In [10]:
arr[0] # The first image, corrected
Out[10]:
In [11]:
show_image_stack(stack, (-100, 100))
In [12]:
image_stack_to_movie(stack[20:120], figsize=(12, 10), vmin=-20, vmax=20)
Out[12]: