API
utils.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 from hcipy import *
3 import numpy as np
4 
5 def measure_center_position(image, threshold=1, mask_diameter=20):
6  center_mask = make_circular_aperture(mask_diameter)(image.grid)
7  mask = center_mask * ((image / np.nanstd(image)) < threshold)
8 
9  if np.sum(mask) > 0:
10  xc = np.sum(mask * image.grid.x) / np.sum(mask)
11  yc = np.sum(mask * image.grid.y) / np.sum(mask)
12  return np.array([xc, yc])
13  else:
14  return np.array([0.0, 0.0])
def measure_center_position(image, threshold=1, mask_diameter=20)
Definition: utils.py:6