def __init__(self, img, bg_array=None, radius=None, lambda_0=None, delta_n=None, peak_index=None, **kwargs): # Call parent's initializer super(Interferogram, self).__init__(img, **kwargs) # Attributes self.radius = roma.check_type(radius, int, nullable=True) self.lambda_0 = roma.check_type(lambda_0, float, nullable=True) self.delta_n = roma.check_type(delta_n, float, nullable=True) self._backgrounds: Optional[List[Interferogram]] = None # Set peak index if provided self._peak_index: Optional[Tuple[int, int]] = None if peak_index is not None: self.peak_index = peak_index # Set background if provided if bg_array is not None: self.set_background(bg_array) # Other field (should be cloned) self.booster = None self.sample_token = None self.setup_token = None self.tag = ''
def set_background(self, bg: Union[np.ndarray, List[np.ndarray]]): if self.radius is None: raise ValueError( '!! radius must be specified before setting background') if isinstance(bg, np.ndarray): bg = [bg] roma.check_type(bg, list, inner_type=np.ndarray) bgig_list = [Interferogram(b, radius=self.radius) for b in bg] for bg_ig in bgig_list: assert bg_ig.size == self.size bg_ig.peak_index = self.peak_index self._backgrounds = bgig_list
def __init__(self, max_len=20): self.buffer: list = [] self.background: Optional[np.ndarray] = None self.max_len = check_type(max_len, int) self.master_thread: Optional[Thread] = None self.thread: Optional[Thread] = None self.terminate_flag = False
def sample_height(self): lambda_0 = roma.check_type(self.lambda_0, float) delta_n = roma.check_type(self.delta_n, float) return self.flattened_phase * lambda_0 / (2 * np.pi * delta_n)
def peak_index(self, val): assert isinstance(val, tuple) and len(val) == 2 self._peak_index = roma.check_type(val, inner_type=int)