İçeriğe atla

Dosya:Mpl example Helmoltz coils.svg

Sayfa içeriği diğer dillerde desteklenmemektedir.
Vikipedi, özgür ansiklopedi
    Tam çözünürlük (SVG dosyası, sözde 540 × 540 piksel, dosya boyutu: 63 KB)

    Özet

    Açıklama
    English: Cross section of B (magnetic field strength) magnitude in a Helmholtz coil (actually consisting of two coils: one at the top, one at the bottom in the plot). The eight contours are for field magnitudes of 0.5 {\displaystyle B_0}, 0.8 {\displaystyle B_0}, 0.9 {\displaystyle B_0}, 0.95 {\displaystyle B_0}, 0.99 {\displaystyle B_0}, 1.01 {\displaystyle B_0}, 1.05 {\displaystyle B_0}, and 1.1 {\displaystyle B_0}, where {\displaystyle B_0} is field strength at center. The large center area has almost uniform field strength.
    Tarih
    Kaynak Yükleyenin kendi çalışması
    Yazar Adrien F. Vincent
    SVG gelişimi
    InfoField
     Bu SVG kaynak kodu geçerlidir.
     Bu vektörel grafik Matplotlib ile oluşturuldu.

    Rationale: this work aims at providing an up-to-date version of the similar work https://commons.wikimedia.org/wiki/File:Helmholtz_coil,_B_magnitude_cross_section.svg, done by Morn.

    Source code has been modified into fully object-oriented matplotlib interface. It now uses the "viridis" colormap, instead of "jet" which produces perceptual glitches. Besides, some changes had to be done to work with versions of numpy more recent than the one originally used.

    The matplotlib (mpl) version is 1.5.3, with Python 2.7 and numpy 1.10

    Source code

    Bu, Logosu: Matplotlib – comprehensive library for creating static, animated, and interactive visualizations in Python
    Bu, Logosu: Matplotlib – comprehensive library for creating static, animated, and interactive visualizations in Python
    This media was created with Matplotlib (comprehensive library for creating static, animated, and interactive visualizations in Python) and Python (programlama dili) and NumPy (numerical programming package for the Python programming language)
    Here is a listing of the source used to create this file.

    Deutsch  English  +/−

    ##########
    ## Code for the figure
    ##########
    # -*- coding: utf-8 -*-
    from __future__ import division
    
    import matplotlib.pyplot as plt
    import numpy as np
    
    from matplotlib.cm import viridis as colormap  # future default colormap
    
    """
    Setup
    """
    r = 1.0
    res = 200  # grid resolution. 100 may be enough, resulting in smaller SVG file)
    
    def dist3(a, b, c, d, e, f):
        """Compute the Euclidian distance from (d, e, f) to (a, b, c),
        raised to the 3rd power (and with lower boundary `r`).
        """
        return np.maximum(r, np.sqrt((a - d)**2 + (b - e)**2 + (c - f)**2))
    
    x = np.linspace(-150, 150, res)
    y = np.linspace(-150, 150, res)
    X, Y = np.meshgrid(x, y)
    F = np.zeros((res, res, 3))
    
    """
    Computing part
    """
    # Loop over two coils
    for coils in [1.0, -1.0]:
        # Sum field contributions from coil in 10-degree steps
        for p in np.arange(0, 360, 10):
            xc = 100 * np.sin(np.pi * p / 180.0)
            yc = 50 * coils
            zc = 100 * np.cos(np.pi * p / 180.0)
            MAG = 1.0 / ((r + dist3(X, Y, 0.0, xc, yc, zc))**3)
            # (We leave out the necessary constants that would be required
            # to get proper units because only scaling behavior will be shown
            # in the plot. This is also why a sum instead of an integral
            # can be used.)
            #
            # Due to more stringent casting rules in recent Numpy (>=1.10),
            # one builds an explicit list of all the vectors (X - xc, Y - yc, -zc)
            # instead of relying on broadcasting. One then reshapes the array Z
            # (of the cross-product results) as previously expected.
            vectors = np.array([[xval - xc, yval - yc, -zc] for (xval, yval)
                                in zip(X.reshape(-1), Y.reshape(-1))])
            Z = np.cross(vectors, (-zc, 0.0, xc))
            Z = Z.reshape(res, res, 3)
            F += Z * MAG[:,:,np.newaxis]
    
    # Compute the B-field
    B = np.sqrt(F[..., 0]**2 + F[..., 1]**2 + F[..., 2]**2)
    # Scale field strength by value at center
    B = B / B[res // 2, res // 2]
    
    """
    Plotting part
    """
    fig_label = "helmoltz_coils"
    plt.close(fig_label)
    fig, ax = plt.subplots(figsize=(6, 6), num=fig_label, frameon=False)
    
    levels = (0.5, 0.8, 0.9, 0.95, 0.99, 1.01, 1.05, 1.1)
    cs = ax.contour(x, y, B, cmap=colormap, levels=levels)
    
    # Add wire symbols
    ax.scatter((100, 100, -100, -100), (50, -50, 50, -50), s=400, color="Black")
    
    ax.axis((-130, 130, -130, 130))
    ax.set_xticks([])
    ax.set_yticks([])
    
    plt.tight_layout()
    plt.show()
    
    fig.savefig("Helmholtz_coil,_B_magnitude_cross_section.svg")
    ##########
    

    Lisanslama

    Ben, bu işin telif sahibi, burada işi aşağıdaki lisans altında yayımlıyorum:
    w:tr:Creative Commons
    atıf benzer paylaşım
    Bu dosya, Creative Commons Atıf-Benzer Paylaşım 4.0 Uluslararası lisansı ile lisanslanmıştır.
    Şu seçeneklerde özgürsünüz:
    • paylaşım – eser paylaşımı, dağıtımı ve iletimi
    • içeriği değiştirip uyarlama – eser adaptasyonu
    Aşağıdaki koşullar geçerli olacaktır:
    • atıf – Esere yazar veya lisans sahibi tarafından belirtilen (ancak sizi ya da eseri kullanımınızı desteklediklerini ileri sürmeyecek bir) şekilde atıfta bulunmalısınız.
    • benzer paylaşım – Maddeyi yeniden düzenler, dönüştürür veya inşa ederseniz, katkılarınızı özgünüyle aynı veya uyumlu lisans altında dağıtmanız gerekir.

    Altyazılar

    Bu dosyanın temsil ettiği şeyin tek satırlık açıklamasını ekleyin.

    Bu dosyada gösterilen öğeler

    betimlenen

    26 Eylül 2016

    Dosya geçmişi

    Dosyanın herhangi bir zamandaki hâli için ilgili tarih/saat kısmına tıklayın.

    Tarih/SaatKüçük resimBoyutlarKullanıcıYorum
    güncel09.52, 27 Eylül 201609.52, 27 Eylül 2016 tarihindeki sürümün küçültülmüş hâli540 × 540 (63 KB)Adrien F. VincentUser created page with UploadWizard

    Aşağıdaki sayfa bu dosyayı kullanmaktadır:

    Küresel dosya kullanımı

    Aşağıdaki diğer vikiler bu dosyayı kullanmaktadır:

    Üstveri