[Python] How to calculate and plot field map from a current carrying wire using Magpylab?

Discussão em 'Python' iniciado por Stack, Maio 21, 2025.

  1. Stack

    Stack Membro Participativo

    I am using Magpylib package to plot 3D or 2D map of field from a current carrying wire. There is a code for older version of Magpylib (below).

    s4 = magpy.source.current.Line(curr=10, vertices=[(0,-5,0),(0,5,0)])

    This is what I expect : [​IMG]

    I have changed the code as below to get the expected plots. But the B values are way low and the streamplot does not seem to work.

    This is what I get

    [​IMG]


    current = 10 length = 10e-6 # 10 µm

    Create a short straight wire along x-axis wire = magpy.current.Line( current=current, vertices=[[-length/2, 0, 0], [length/2, 0, 0]] )
    ​

    Continue reading...

Compartilhe esta Página