Example #1
0
 def generate_B_List(self,xmin, xmax, xstep, zmin, zmax, zstep, mingap, offset):
     '''
     offset is the amount that the air gap in different than a normal block
     or that the HE magnet is bigger
     '''
     
     # full size magnets here
     if (BeamAssembly.barray == None):
         print "Creating BeamAssembly.barray"
         #(BeamAssembly.barray, BeamAssembly.fint, BeamAssembly.sint) = self.create_int_array(xmin, xmax, xstep, zmin, zmax, zstep, self.magdims, mingap)
         BeamAssembly.barray=mt.generate_B_array_with_offsets(xmin, xmax, xstep, 0.0, zmin, zmax, zstep, 0.0, -2*self.get_beam_length(), 2*self.get_beam_length(), self.magdims[2]/self.steps_per_magnet, 0.0, self.magdims, mingap)
     
     for i in range(self.id_length):
         self.b_arrays.append(BeamAssembly.barray)
         self.fint_arrays.append(BeamAssembly.fint)
         self.sint_arrays.append(BeamAssembly.sint)
     
     if self.id_type == BeamAssembly.antisymetric :
         #print "self.magdims is ", self.magdims
         magdims = np.array(self.magdims)
         #print "magdims is ", magdims
         magdims[2] = magdims[2]/2.0
         #print "magdims for VE", magdims 
         if(BeamAssembly.start_VE_barray == None):
             print "Creating BeamAssembly.start_VE_barray"
             #(BeamAssembly.start_VE_barray, BeamAssembly.start_VE_fint, BeamAssembly.start_VE_sint) = self.create_int_array(xmin, xmax, xstep, zmin, zmax, zstep, magdims, mingap)
             BeamAssembly.start_VE_barray = mt.generate_B_array_with_offsets(xmin, xmax, xstep, 0.0, zmin, zmax, zstep, 0.0, -2*self.get_beam_length(), 2*self.get_beam_length(), self.magdims[2]/self.steps_per_magnet, 0.0, magdims, mingap)
         if(BeamAssembly.end_VE_barray == None):
             print "Creating BeamAssembly.end_VE_barray"
             #(BeamAssembly.end_VE_barray, BeamAssembly.end_VE_fint, BeamAssembly.end_VE_sint) = self.create_int_array(xmin, xmax, xstep, zmin, zmax, zstep, magdims, mingap)
             BeamAssembly.end_VE_barray = mt.generate_B_array_with_offsets(xmin, xmax, xstep, 0.0, zmin, zmax, zstep, 0.0, -2*self.get_beam_length(), 2*self.get_beam_length(), self.magdims[2]/self.steps_per_magnet, 0.0, magdims, mingap)
         magdims[2] = magdims[2]+offset
         #print "magdims for HE", magdims 
         if(BeamAssembly.start_HE_barray == None):
             print "Creating BeamAssembly.start_HE_barray"
             #(BeamAssembly.start_HE_barray, BeamAssembly.start_HE_fint, BeamAssembly.start_HE_sint) = self.create_int_array_with_offset(xmin, xmax, xstep, zmin, zmax, zstep, -(offset/2.0), magdims, mingap)
             BeamAssembly.start_HE_barray = mt.generate_B_array_with_offsets(xmin, xmax, xstep, 0.0, zmin, zmax, zstep, 0.0, -2*self.get_beam_length(), 2*self.get_beam_length(), self.magdims[2]/self.steps_per_magnet, -offset/2.0, magdims, mingap)
         if(BeamAssembly.end_HE_barray == None):
             print "Creating BeamAssembly.end_HE_barray"
             #(BeamAssembly.end_HE_barray, BeamAssembly.end_HE_fint, BeamAssembly.end_HE_sint) = self.create_int_array_with_offset(xmin, xmax, xstep, zmin, zmax, zstep, (offset/2.0), magdims, mingap)
             BeamAssembly.end_HE_barray = mt.generate_B_array_with_offsets(xmin, xmax, xstep, 0.0, zmin, zmax, zstep, 0.0, -2*self.get_beam_length(), 2*self.get_beam_length(), self.magdims[2]/self.steps_per_magnet, offset/2.0, magdims, mingap)
         for i in range(self.id_length):
             if self.types[i] == MagnetStore.horizontal_end:
                 if i < (self.id_length/2):
                     self.b_arrays[i] = BeamAssembly.start_HE_barray
                     self.fint_arrays[i] = BeamAssembly.start_HE_fint
                     self.sint_arrays[i] = BeamAssembly.start_HE_sint
                 else :
                     self.b_arrays[i] = BeamAssembly.end_HE_barray
                     self.fint_arrays[i] = BeamAssembly.end_HE_fint
                     self.sint_arrays[i] = BeamAssembly.end_HE_sint
             if self.types[i] == MagnetStore.vertical_end:
                 if i < (self.id_length/2):
                     self.b_arrays[i] = BeamAssembly.start_VE_barray
                     self.fint_arrays[i] = BeamAssembly.start_VE_fint
                     self.sint_arrays[i] = BeamAssembly.start_VE_sint
                 else :
                     self.b_arrays[i] = BeamAssembly.end_VE_barray
                     self.fint_arrays[i] = BeamAssembly.end_VE_fint
                     self.sint_arrays[i] = BeamAssembly.end_VE_sint
Example #2
0
 def create_b_array_with_offset(self, xmin, xmax, xstep, zmin, zmax, zstep, soff, magdims, mingap):
     """
     use self.magdims for array sizes but use magdims for magnet size as the magnet could be halfsize or different
     """
     length = self.get_beam_length()
     return mt.generate_B_array_with_offsets(
         xmin,
         xmax,
         xstep,
         0.0,
         zmin,
         zmax,
         zstep,
         0.0,
         -2 * length,
         2 * length,
         self.magdims[2] / self.steps_per_magnet,
         soff,
         magdims,
         mingap,
     )
Example #3
0
 def create_int_array(self, xmin, xmax, xstep, zmin, zmax, zstep, magdims, mingap):
     length = self.get_beam_length()
     # (b, fx, fz, fs, sx, sz, ss) = mt.generate_integral_array(xmin, xmax, xstep, 0.0, zmin, zmax, zstep, 0.0, -2*length, 2*length, self.magdims[2]/self.steps_per_magnet, 0.0, magdims, mingap)
     b = mt.generate_B_array_with_offsets(
         xmin,
         xmax,
         xstep,
         0.0,
         zmin,
         zmax,
         zstep,
         0.0,
         -2 * length,
         2 * length,
         self.magdims[2] / self.steps_per_magnet,
         0.0,
         magdims,
         mingap,
     )
     # return (b, (fx, fz, fs), (sx, sz, ss))
     return b
Example #4
0
    def __init__(
        self,
        magdims=[41.0, 16.0, 5.25],
        xmin=0.0,
        xmax=1.0,
        xstep=1.0,
        xoff=0.0,
        zmin=0.0,
        zmax=1.0,
        zstep=1.0,
        zoff=0.0,
        smin=0.0,
        smax=1.0,
        sstep=1.0,
        soff=0.0,
        mingap=5.0,
    ):

        self.barray = mt.generate_B_array_with_offsets(
            xmin, xmax, xstep, xoff, zmin, zmax, zstep, zoff, smin, smax, sstep, soff, magdims, mingap
        )
Example #5
0
    def generate_B_List(self, xmin, xmax, xstep, zmin, zmax, zstep, mingap, offset):
        """
        offset is the amount that the air gap in different than a normal block
        or that the HE magnet is bigger
        """
        self.b_arrays = []
        self.fint_arrays = []
        self.sint_arrays = []

        # full size magnets here
        print "Creating BeamAssembly.barray"
        # (BeamAssembly.barray, BeamAssembly.fint, BeamAssembly.sint) = self.create_int_array(xmin, xmax, xstep, zmin, zmax, zstep, self.magdims, mingap)
        self.barray = mt.generate_B_array_with_offsets(
            xmin,
            xmax,
            xstep,
            0.0,
            zmin,
            zmax,
            zstep,
            0.0,
            -2 * self.get_beam_length(),
            2 * self.get_beam_length(),
            self.mag_dims[2] / self.mag_steps,
            0.0,
            self.mag_dims,
            mingap,
        )

        for i in range(self.id_length):
            self.b_arrays.append(self.barray)
            # self.fint_arrays.append(self.fint)
            # self.sint_arrays.append(self.sint)

        if self.id_type == Beam.ANTISYMETRIC:
            # print "self.magdims is ", self.magdims
            magdims = np.array(self.mag_dims)
            # print "magdims is ", magdims
            magdims[2] = magdims[2] / 2.0
            # print "magdims for VE", magdims
            print "Creating BeamAssembly.start_VE_barray"
            # (BeamAssembly.start_VE_barray, BeamAssembly.start_VE_fint, BeamAssembly.start_VE_sint) = self.create_int_array(xmin, xmax, xstep, zmin, zmax, zstep, magdims, mingap)
            self.start_VE_barray = mt.generate_B_array_with_offsets(
                xmin,
                xmax,
                xstep,
                0.0,
                zmin,
                zmax,
                zstep,
                0.0,
                -2 * self.get_beam_length(),
                2 * self.get_beam_length(),
                self.mag_dims[2] / self.mag_steps,
                0.0,
                magdims,
                mingap,
            )
            print "Creating BeamAssembly.end_VE_barray"
            # (BeamAssembly.end_VE_barray, BeamAssembly.end_VE_fint, BeamAssembly.end_VE_sint) = self.create_int_array(xmin, xmax, xstep, zmin, zmax, zstep, magdims, mingap)
            self.end_VE_barray = mt.generate_B_array_with_offsets(
                xmin,
                xmax,
                xstep,
                0.0,
                zmin,
                zmax,
                zstep,
                0.0,
                -2 * self.get_beam_length(),
                2 * self.get_beam_length(),
                self.mag_dims[2] / self.mag_steps,
                0.0,
                magdims,
                mingap,
            )

            magdims[2] = magdims[2] + offset
            # print "magdims for HE", magdims
            print "Creating BeamAssembly.start_HE_barray"
            # (BeamAssembly.start_HE_barray, BeamAssembly.start_HE_fint, BeamAssembly.start_HE_sint) = self.create_int_array_with_offset(xmin, xmax, xstep, zmin, zmax, zstep, -(offset/2.0), magdims, mingap)
            self.start_HE_barray = mt.generate_B_array_with_offsets(
                xmin,
                xmax,
                xstep,
                0.0,
                zmin,
                zmax,
                zstep,
                0.0,
                -2 * self.get_beam_length(),
                2 * self.get_beam_length(),
                self.mag_dims[2] / self.mag_steps,
                -offset / 2.0,
                magdims,
                mingap,
            )

            print "Creating BeamAssembly.end_HE_barray"
            # (BeamAssembly.end_HE_barray, BeamAssembly.end_HE_fint, BeamAssembly.end_HE_sint) = self.create_int_array_with_offset(xmin, xmax, xstep, zmin, zmax, zstep, (offset/2.0), magdims, mingap)
            self.end_HE_barray = mt.generate_B_array_with_offsets(
                xmin,
                xmax,
                xstep,
                0.0,
                zmin,
                zmax,
                zstep,
                0.0,
                -2 * self.get_beam_length(),
                2 * self.get_beam_length(),
                self.mag_dims[2] / self.mag_steps,
                offset / 2.0,
                magdims,
                mingap,
            )

            for i in range(self.id_length):
                if self.types[i] == MagnetStore.HORIZONTAL_END:
                    if i < (self.id_length / 2):
                        self.b_arrays[i] = self.start_HE_barray
                        # self.fint_arrays[i] = self.start_HE_fint
                        # self.sint_arrays[i] = self.start_HE_sint
                    else:
                        self.b_arrays[i] = self.end_HE_barray
                        # self.fint_arrays[i] = self.end_HE_fint
                        # self.sint_arrays[i] = self.end_HE_sint
                if self.types[i] == MagnetStore.VERTICAL_END:
                    if i < (self.id_length / 2):
                        self.b_arrays[i] = self.start_VE_barray
                        # self.fint_arrays[i] = self.start_VE_fint
                        # self.sint_arrays[i] = self.start_VE_sint
                    else:
                        self.b_arrays[i] = self.end_VE_barray