Beispiel #1
0
def test_extract_power_noiseless_data_third_harmonic(real_data):
    """
    """
    desired_power = 5e-19 * 1e-12 * (ureg.A**2)
    frequency = 3 * 100 * ureg.Hz
    actual_power = extract_power(real_data,
                                 frequency,
                                 siding='double',
                                 window='hann')
    assert_allclose_qt(actual_power, desired_power, atol=1e-32, rtol=1e-3)
Beispiel #2
0
def test_extract_power_double_sided_sinewave():
    """
    """
    data = pd.DataFrame({'Time (s)': [0, 1, 2, 3], 'Value (A)': [0, 1, 0, -1]})
    desired_power = 0.5 * ureg.A**2
    frequency = 0.25 * ureg.Hz
    actual_power = extract_power(data,
                                 frequency,
                                 siding='double',
                                 window='boxcar')
    assert_allclose_qt(actual_power, desired_power)
Beispiel #3
0
def test_extract_power_double_sided_with_leak_hann():
    """
    """
    data = pd.DataFrame({
        'Time (s)': [0, 1, 2, 3, 4],
        'Value (A)': [1, -1, 1, -1, 1]
    })
    desired_power = 1 * ureg.A**2
    frequency = 0.5 * ureg.Hz
    actual_power = extract_power(data,
                                 frequency,
                                 siding='double',
                                 window='hann')
    assert_allclose_qt(actual_power, desired_power)
Beispiel #4
0
def test_extract_power_double_sided_no_leak_diff_units():
    """
    """
    data = pd.DataFrame({
        'Time (ms)': [0, 1, 2, 3],
        'Value (A)': [1, -1, 1, -1]
    })
    desired_power = 1 * ureg.A**2
    frequency = 0.5 * ureg.kHz
    actual_power = extract_power(data,
                                 frequency,
                                 siding='double',
                                 window='boxcar')
    assert_allclose_qt(actual_power, desired_power)