def _mean(self, u): index = self.first_particle_index_in_slice stats = np.zeros(self.n_slices) for i in xrange(self.n_slices): k = u[index[i]:index[i + 1]] stats[i] = cp.mean(k) return stats
def _set_longitudinal_cuts(self, bunch): if self.nsigmaz == None: z_cut_tail = bunch.z[0] z_cut_head = bunch.z[-1 - bunch.n_macroparticles_lost] else: mean_z = cp.mean(bunch.z[:bunch.n_macroparticles - bunch.n_macroparticles_lost]) sigma_z = cp.std(bunch.z[:bunch.n_macroparticles - bunch.n_macroparticles_lost]) z_cut_tail = mean_z - self.nsigmaz * sigma_z z_cut_head = mean_z + self.nsigmaz * sigma_z return z_cut_tail, z_cut_head
def mean_dp(self): return cp.mean(self.dp)
def mean_yp(self): return cp.mean(self.yp)
def mean_z(self): return cp.mean(self.z)
def mean_xp(self): return cp.mean(self.xp)
def mean_y(self): return cp.mean(self.y)
def mean_x(self): return cp.mean(self.x)