def add_phase_shift(self, pattern, displ): """ Add phase shift corresponding to displ to complex pattern. :param pattern: complex field pattern. :param displ: displ(acement) (position) of the particle (m). :return: modified complex field pattern. """ self.ensure_beam() pattern = xp.asarray(pattern) displ = xp.asarray(displ) return pattern * xp.exp(1j * xp.dot(self.pixel_position_reciprocal, displ))
def get_fxs_photons(self, particles, beam_focus_radius, jet_radius, device=None): raw_data = None state, coords = distribute_particles(particles, beam_focus_radius, jet_radius) for i in range(len(state)): this_data = self.get_pattern_without_corrections( particle=state[i], return_type="complex_field") this_data *= xp.exp( 1j * xp.dot(self.pixel_position_reciprocal, coords[i])) if raw_data is None: raw_data = this_data else: raw_data += this_data return self.add_correction_and_quantization(xp.square( xp.abs(raw_data)))