xmcdpy.process_xmcd¶
- xmcdpy.process_xmcd.align_stack(images_stack, rect_coord, show_progress=False, background_mask=None, alignment_threshold=0.25, drop_threshold=0.15)¶
Aligns the stack of images using rect_coord cropping.
- Parameters
images_stack (array) – [description]
rect_coord ((4,) array) – Coordinates of the rectangle for cropping. See select_rect_coord.
show_progress (bool, optional) – Shows steps. Defaults to False.
background_mask (bool array, optional) – Background mask for equalising the background. Defaults to None.
alignment_threshold (float, optional) – How much to oversample. I.e. 0.25 means that the alignment is going to be done within 0.25 pixels. Defaults to 0.25.
drop_threshold (float, optional) – Threshold for normalise_stack_brightness. Defaults to 0.15.
- Returns
Aligned stack.
- Return type
array
- xmcdpy.process_xmcd.align_xmcd_polarisations(cl_image, cr_image, rect_coord, background_mask=None)¶
A convenience function. Creates the xmcd stack and aligns it
- xmcdpy.process_xmcd.equalise_stack_brightness(images_stack, background_mask, drop_threshold=0.15)¶
Runs stack_mps and normalise_stack_brightness.
- Parameters
images_stack (array) –
background_mask (bool array) – Mask selecting the background for stack_mps.
drop_threshold (float, optional) – Threshold for normalise_stack_brightness. Defaults to 0.15.
- Returns
Stack with equalised brightness.
- Return type
array
- xmcdpy.process_xmcd.get_xmcd_from_stack(xmcd_stack, mask=None)¶
Gets the xmcd signal from the cr and cl polarizations by taking a difference of logs and killing the signal outside the mask. If mask is None, use slightly shrinked CIRCLE_MASK defined in globals.
- Parameters
xmcd_stack ((n,m, 2) array) – Stack of CR and CL polarizations.
mask ((n,m) bool array, optional) – Mask outside which to kill the signal. Defaults to None.
- Returns
xmcd image
- Return type
(n,m) array
- xmcdpy.process_xmcd.get_xmcd_image(cl_image, cr_image, rect_coord, background_mask=None)¶
Convenience function for getting the xmcd image from the images of left and right polarisation by using align_xmcd_polarisations and get_xmcd_from_stack.
- xmcdpy.process_xmcd.process_xmcd_folder(folder, norm_image_path, rect_coord, show_progress=False, background_mask=None, name_filter='', alignment_threshold=0.25, drop_threshold=0.15)¶
Processed xmcd folder by normalising it and aligning all the images. Returns averaged aligned stack.
- Parameters
folder (str) – [description]
norm_image_path (str) – [description]
rect_coord ((4,) array, list) – Rectangular coordinates defining corners of the alignment rectangle.
show_progress (bool, optional) – Shows the result of each step. Defaults to False.
background_mask (array, optional) – See align_stack. Defaults to None.
name_filter (str, optional) – Name filter for the images in the folder. See import_stack. Defaults to ‘’.
alignment_threshold (float, optional) – See align_stack. Defaults to 0.25.
drop_threshold (float, optional) – See normalise_stack_brightness. Defaults to 0.15.
- Returns
[description]
- Return type
[type]