Esempio n. 1
0
def edge_chromaticity_old(lattice, tws_0):
    #tested !
    ksi_x_edge = 0.
    ksi_y_edge = 0.
    L = 0.
    for element in lattice.sequence:
        L += element.l
        if element.type == "rbend":
            r = element.l/element.angle
            tw_start = trace_z(lattice,tws_0,[(L - element.l)])
            tw_end = trace_z(lattice, tws_0,[L])
            #print "*************    ", tw_start, tw_end
            ksi_x_edge += (tw_start.beta_x + tw_end.beta_x)*tan(element.angle/2)/r
            ksi_y_edge += (tw_start.beta_y + tw_end.beta_y)*tan(-element.angle/2)/r
    return (ksi_x_edge, ksi_y_edge)
Esempio n. 2
0
 def integrals_id(self):
     L = 0.
     self.I2_IDs = 0.
     self.I3_IDs = 0.
     self.I4_IDs = 0.
     self.I5_IDs = 0.
     for elem in self.lat.sequence:
         if elem.__class__ == Undulator:
             B = K2field(elem.Kx, lu = elem.lperiod)
             h0 = B*speed_of_light/self.E*1e-9
             tws = trace_z(self.lat, self.tws0, [L, L + elem.l/2.])
             i2 = I2_ID(elem.l, h0)
             i3 = I3_ID(elem.l, h0)
             i4 = I4_ID(elem.l, h0, elem.lperiod)
             i5 = I5_ID(elem.l, h0, elem.lperiod, tws[1].beta_x, tws[0].Dx, tws[0].Dxp)
             self.I2_IDs += i2
             self.I3_IDs += i3
             self.I4_IDs += i4
             self.I5_IDs += i5
         L += elem.l
     self.emit_ID = self.emittance * (1.+self.I5_IDs/self.I5)/(1+(self.I2_IDs - self.I4_IDs)/(self.I2 - self.I4))
     self.sigma_e_ID = self.sigma_e * np.sqrt((1.+ self.I3_IDs / self.I3)/(1 + (2*self.I2_IDs + self.I4_IDs)/(2.*self.I2 + self.I4) ) )
     self.U0_ID = Cgamma*(self.E*1000)**4.*self.I2_IDs/(2.*np.pi)
     print("emittance with IDs = ", self.emit_ID*1e9, " nm*rad")
     print("sigma_e with IDs =   ", self.sigma_e_ID)
     print("U0 from IDs =        ", self.U0_ID,  "  MeV")
Esempio n. 3
0
def edge_chromaticity_old(lattice, tws_0):
    #tested !
    ksi_x_edge = 0.
    ksi_y_edge = 0.
    L = 0.
    for element in lattice.sequence:
        L += element.l
        if element.type == "rbend":
            r = element.l / element.angle
            tw_start = trace_z(lattice, tws_0, [(L - element.l)])
            tw_end = trace_z(lattice, tws_0, [L])
            #print "*************    ", tw_start, tw_end
            ksi_x_edge += (tw_start.beta_x + tw_end.beta_x) * tan(
                element.angle / 2) / r
            ksi_y_edge += (tw_start.beta_y + tw_end.beta_y) * tan(
                -element.angle / 2) / r
    return (ksi_x_edge, ksi_y_edge)
Esempio n. 4
0
 def integrals_id(self):
     L = 0.
     self.I2_IDs = 0.
     self.I3_IDs = 0.
     self.I4_IDs = 0.
     self.I5_IDs = 0.
     for elem in self.lat.sequence:
         if elem.__class__ == Undulator:
             B = K2field(elem.Kx, lu=elem.lperiod)
             h0 = B * speed_of_light / self.E * 1e-9
             #print h0, B
             tws = trace_z(self.lat, self.tws0, [L, L + elem.l / 2.])
             i2 = I2_ID(elem.l, h0)
             i3 = I3_ID(elem.l, h0)
             i4 = I4_ID(elem.l, h0, elem.lperiod)
             i5 = I5_ID(elem.l, h0, elem.lperiod, tws[1].beta_x, tws[0].Dx,
                        tws[0].Dxp)
             self.I2_IDs += i2
             self.I3_IDs += i3
             self.I4_IDs += i4
             self.I5_IDs += i5
             #print elem.type, elem.id, "B0 =  ", B, " T"
             #print elem.type, elem.id, "rho = ", 1./h0, " m"
             #print elem.type, elem.id, "L =   ", elem.l, " m"
             #print elem.type, elem.id, "beta_x cntr: ", tws[1].beta_x
             #print elem.type, elem.id, "Dx0 / Dxp0:  ", tws[0].Dx, "/", tws[0].Dxp
             #print elem.type, elem.id, "I2_ID = ", i2
             #print elem.type, elem.id, "I3_ID = ", i3
             #print elem.type, elem.id, "I4_ID = ", i4
             #print elem.type, elem.id, "I5_ID = ", i5
         L += elem.l
     self.emit_ID = self.emittance * (1. + self.I5_IDs / self.I5) / (
         1 + (self.I2_IDs - self.I4_IDs) / (self.I2 - self.I4))
     self.sigma_e_ID = self.sigma_e * sqrt(
         (1. + self.I3_IDs / self.I3) /
         (1 + (2 * self.I2_IDs + self.I4_IDs) / (2. * self.I2 + self.I4)))
     self.U0_ID = Cgamma * (self.E * 1000)**4. * self.I2_IDs / (2. * pi)
     print("emittance with IDs = ", self.emit_ID * 1e9, " nm*rad")
     print("sigma_e with IDs =   ", self.sigma_e_ID)
     print("U0 from IDs =        ", self.U0_ID, "  MeV")
Esempio n. 5
0
 def integrals_id(self):
     L = 0.
     self.I2_IDs = 0.
     self.I3_IDs = 0.
     self.I4_IDs = 0.
     self.I5_IDs = 0.
     for elem in self.lat.sequence:
         if elem.__class__ == Undulator:
             B = K2field(elem.Kx, lu = elem.lperiod)
             h0 = B*speed_of_light/self.E*1e-9
             #print h0, B
             tws = trace_z(self.lat, self.tws0, [L, L + elem.l/2.])
             i2 = I2_ID(elem.l,h0)
             i3 = I3_ID(elem.l,h0)
             i4 = I4_ID(elem.l,h0,elem.lperiod)
             i5 = I5_ID(elem.l,h0,elem.lperiod,tws[1].beta_x,tws[0].Dx, tws[0].Dxp)
             self.I2_IDs += i2
             self.I3_IDs += i3
             self.I4_IDs += i4
             self.I5_IDs += i5
             #print elem.type, elem.id, "B0 =  ", B, " T"
             #print elem.type, elem.id, "rho = ", 1./h0, " m"
             #print elem.type, elem.id, "L =   ", elem.l, " m"
             #print elem.type, elem.id, "beta_x cntr: ", tws[1].beta_x
             #print elem.type, elem.id, "Dx0 / Dxp0:  ", tws[0].Dx, "/", tws[0].Dxp
             #print elem.type, elem.id, "I2_ID = ", i2
             #print elem.type, elem.id, "I3_ID = ", i3
             #print elem.type, elem.id, "I4_ID = ", i4
             #print elem.type, elem.id, "I5_ID = ", i5
         L += elem.l
     self.emit_ID = self.emittance * (1.+self.I5_IDs/self.I5)/(1+(self.I2_IDs  - self.I4_IDs)/(self.I2 - self.I4))
     self.sigma_e_ID = self.sigma_e * sqrt((1.+ self.I3_IDs / self.I3)/(1 + (2*self.I2_IDs + self.I4_IDs)/(2.*self.I2 + self.I4) ) )
     self.U0_ID = Cgamma*(self.E*1000)**4.*self.I2_IDs/(2.*pi)
     print("emittance with IDs = ", self.emit_ID*1e9, " nm*rad")
     print("sigma_e with IDs =   ", self.sigma_e_ID)
     print("U0 from IDs =        ", self.U0_ID,  "  MeV")