Esempio n. 1
0
class Multipole(Object):
    objid = u64(value=obj_ids.Multipole)
    order   = u64(const=True)
    length  = f64()
    hxl     = f64()
    hyl     = f64()
    bal     = f64(size='2*(order+1)')
    @property
    def knl(self):
        return self.bal[0::2]/factorial[self.order]
    @property
    def ksl(self):
        return self.bal[1::2]/factorial[self.order]
    @property.setter
    def knl(self,knl):
        lknl=len(knl)
        if lknl>self.order:
            raise ValueError("knl size bigger than order")
        self.bal[0:2*lknl:2]=np.array(knl)/factorial
    @property.setter
    def ksl(self,ksl):
        lksl=len(ksl)
        if lksl>self.order:
            raise ValueError("ksl size bigger than order")
        self.bal[0:2*lksl:2]=np.array(ksl)/factorial
    def __setter__(self, knl=[], ksl=[], **nvargs):
        nvargs['order'] = max(len(knl),len(ksl))
        CObject.__init__(self, **nvargs)
Esempio n. 2
0
class BeamBeam4D(Object):
    objid = u64(value=obj_ids.BeamBeam4D)
    q_part = f64()
    N_part = f64()
    sigma_x = Field(BeamBeam6D,size='nslice')
    sigma_y = f64()
    beta_s  = f64()
    min_sigma_diff = f64()
    Delta_x = f64()
    Delta_y = f64()
Esempio n. 3
0
class Align(Object):
    objid = u64(value=obj_ids.Align)
    cz = f64()
    sz = f64()
    dx = f64()
    dy = f64()
    @property
    def tilt(self):
        return atan2(self.cz/self.cx)*radtodeg
    @property.setter
    def tilt(self,tilt):
        tilt_deg=tilt*degtorad
        self.cz=cos(tilt)
        self.sz=sin(tilt)
Esempio n. 4
0
class Cavity(Object):
    objid = u64(value=obj_ids.Cavity)
    voltage = f64()
    kfreq  = f64()
    lag_rad = f64()
    @property
    def frequency(self):
        return self.kfreq*c/(twopi)
    @property.setter(self):
    def frequency(self,frequency):
        return self.kfreq=twopi/c*frequency
    @property
    def lag(self):
        return self.lag_rad*radtodeg
    @property.setter(self):
    def lag(self,lag):
        return self.lag_rad=lag*degtorad
Esempio n. 5
0
class DriftExact(Object):
    objid = u64(value=obj_ids.DriftExact)
    length = f64()
Esempio n. 6
0
class A(Object):
    fa = f64()
    fb = u64()
Esempio n. 7
0
class C(Object):
    nn = u64(const=True)
    fb = u64(size='nn')
    vv = u64(value=2)
Esempio n. 8
0
class B(Object):
    fa = f64(size=10)
    fb = u64(size=5)