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
Esempio n. 2
0
    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
Esempio n. 4
0
    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
Esempio n. 5
0
 def mean_dp(self):
     return cp.mean(self.dp)
Esempio n. 6
0
 def mean_yp(self):
     return cp.mean(self.yp)
Esempio n. 7
0
 def mean_z(self):
     return cp.mean(self.z)
Esempio n. 8
0
 def mean_xp(self):
     return cp.mean(self.xp)
Esempio n. 9
0
 def mean_y(self):
     return cp.mean(self.y)
 def mean_dp(self):
     return cp.mean(self.dp)
Esempio n. 11
0
 def mean_x(self):
     return cp.mean(self.x)
 def mean_z(self):
     return cp.mean(self.z)
 def mean_yp(self):
     return cp.mean(self.yp)
 def mean_y(self):
     return cp.mean(self.y)
 def mean_xp(self):
     return cp.mean(self.xp)
 def mean_x(self):
     return cp.mean(self.x)