Exemplo n.º 1
0
import loopfield

# compensation coils:
# r_in = 5mm, r_out = 30.25mm
# d_coil = 5.3mm
# w = 25mm + d_coil/2

# N_loop_1 = 9530
# N_loop_2 = 10623
# d_nomm = 100μm

# coil axis in z-direction
# sample midpoint in (0,0,0)
# untilted sample normal to (0,0,1)

field = loopfield.Field()


def save_3d_file(output_file, data, header):
    fh = open(output_file, 'w')
    fh.write(header + "\n")
    shape = data.shape
    for i in range(shape[0]):
        block = data[i]
        np.savetxt(fh, block, fmt="%.17g", delimiter="\t")
        fh.write("\n")
    fh.close()


def add_coil(pos,
             N,
Exemplo n.º 2
0
#!/usr/bin/env python3

#
# Maxwell coil plot example
#

import math
import loopfield as lf
import loopfield.plot as lfp

# field object
field = lf.Field(length_units=lf.cm, current_units=lf.A, field_units=lf.uT)

# Maxwell coil model with single current loops

R = 10

# center winding
c1 = lf.Loop([0, 0, 0], [1, 0, 0], R, 64)

# outer windings
c2 = lf.Loop([-R * math.sqrt(3. / 7.), 0, 0], [1, 0, 0],
             R * math.sqrt(4. / 7.), 49)
c3 = lf.Loop([+R * math.sqrt(3. / 7.), 0, 0], [1, 0, 0],
             R * math.sqrt(4. / 7.), 49)

# add windings to field
field.addLoop(c1)
field.addLoop(c2)
field.addLoop(c3)