def _sigma(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.std(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 sigma_dp(self): return cp.std(self.dp)
def sigma_y(self): return cp.std(self.y)
def sigma_z(self): return cp.std(self.z)
def sigma_x(self): return cp.std(self.x)