Example #1
0
    def test_unequal_arrays(self):
        r"""Test errors upon unequal array lengths"""

        with pytest.raises(ValueError):
            Characteristic(self.bias_longarr, current_arr)

        with pytest.raises(ValueError):
            Characteristic(bias_arr, self.current_longarr)
Example #2
0
    def test_subtraction(self):
        r"""Test addition of characteristic objects"""

        a = Characteristic(bias_arr, current_arr)

        b = Characteristic(bias_arr, self.current_arr2)

        ab_sub = Characteristic(bias_arr, current_arr - self.current_arr2)

        errStr = (f"Subtraction of characteristic objects is not behaving as "
                  f"it should.")
        assert (a.current - b.current == ab_sub.current).all(), errStr
Example #3
0
    def test_addition(self):
        r"""Test addition of characteristic objects"""

        a = Characteristic(bias_arr, current_arr)

        b = Characteristic(bias_arr, self.current_arr2)

        ab_sum = Characteristic(bias_arr, current_arr + self.current_arr2)

        errStr = (f"Addition of characteristic objects is not behaving as it "
                  f"should.")
        assert (a.current + b.current == ab_sum.current).all(), errStr
Example #4
0
def characteristic_simulated():
    r""""Create a simulated probe characteristic (provisional)"""

    T_e_sim = 1 * u.eV
    n_e_sim = 1e18 * u.m**-3
    probe_area_sim = 1 * u.cm**2
    I_es_sim = (n_e_sim * probe_area_sim * const.e *
                np.sqrt(T_e_sim / (2 * np.pi * const.m_e)))

    # Create bias array
    bias_simarr = np.arange(-20, 15, 0.1) * u.V

    # Calculate electron current and limit to electron saturation current
    current_simarr = np.exp(const.e * bias_simarr / T_e_sim) * u.A
    current_simarr[current_simarr > I_es_sim] = I_es_sim

    # Add simulated linear sheath expansion current
    current_simarr[current_simarr == I_es_sim] += (
        bias_simarr[current_simarr == I_es_sim] * 5e-4 * u.A / u.V)

    # Add simulated linear ion collection current
    current_simarr[current_simarr < I_es_sim] += (
        bias_simarr[current_simarr < I_es_sim] * 1e-4 * u.A / u.V)

    return Characteristic(bias_simarr, current_simarr)
Example #5
0
def shuffle_characteristic(characteristic):
    r""""Shuffle a given characteristic"""

    _shuffle = sorted(np.arange(len(characteristic.bias)),
                      key=lambda k: np.random.random())
    U_shuffled = characteristic.bias[_shuffle]
    I_shuffled = characteristic.current[_shuffle]
    return Characteristic(U_shuffled, I_shuffled)
import os

######################################################
# The first characteristic we analyze is a simple single-probe measurement in
# a low (ion) temperature, low density plasma with a cylindrical probe. This
# allows us to utilize OML theory implemented in `swept_probe_analysis`.
# The data has been preprocessed with some smoothing, which allows us to obtain
# a Electron Energy Distribution Function (EEDF) as well.

# Load the bias and current values stored in the .p pickle file.
path = os.path.join("langmuir_samples", "Beckers2017.npy")
bias, current = np.load(path)

# Create the Characteristic object, taking into account the correct units
characteristic = Characteristic(
    np.array(bias) * u.V,
    np.array(current) * 1e3 * u.mA)

# Calculate the cylindrical probe surface area
probe_length = 1.145 * u.mm
probe_diameter = 1.57 * u.mm
probe_area = (probe_length * np.pi * probe_diameter +
              np.pi * 0.25 * probe_diameter**2)

######################################################
# Now we can actually perform the analysis. Since the plasma is in Helium an
# ion mass number of 4 is entered. The results are visualized and the obtained
# EEDF is also shown.
print(
    swept_probe_analysis(characteristic,
                         probe_area,
Example #7
0
def characteristic():
    r""""Create a dummy characteristic with random values"""
    return Characteristic(bias_arr, current_arr)
Example #8
0
    def test_infinite_U(self):
        r"""Test error upon an infinite bias value"""

        with pytest.raises(ValueError):
            Characteristic(self.bias_infarr, current_arr)
Example #9
0
    def test_infinite_I(self):
        r"""Test error upon an infinite current value"""

        with pytest.raises(ValueError):
            Characteristic(bias_arr, self.current_infarr)
Example #10
0
import os
from pprint import pprint

######################################################
# The first characteristic we analyze is a simple single-probe measurement in
# a low (ion) temperature, low density plasma with a cylindrical probe. This
# allows us to utilize OML theory implemented in `swept_probe_analysis`.
# The data has been preprocessed with some smoothing, which allows us to obtain
# a Electron Energy Distribution Function (EEDF) as well.

# Load the bias and current values stored in the .p pickle file.
path = os.path.join("langmuir_samples", "Beckers2017.npy")
bias, current = np.load(path)

# Create the Characteristic object, taking into account the correct units
characteristic = Characteristic(u.Quantity(bias, u.V),
                                u.Quantity(current, u.A))

# Calculate the cylindrical probe surface area
probe_length = 1.145 * u.mm
probe_diameter = 1.57 * u.mm
probe_area = (probe_length * np.pi * probe_diameter +
              np.pi * 0.25 * probe_diameter**2)

######################################################
# Now we can actually perform the analysis. Since the plasma is in Helium an
# ion mass number of 4 is entered. The results are visualized and the obtained
# EEDF is also shown.
pprint(
    swept_probe_analysis(characteristic,
                         probe_area,
                         'He-4+',