Exemple #1
0
def test_process_labchart_errors(loaded_lab_file):
    header, channels, chtrig = loaded_lab_file

    # test file without header
    with raises(AttributeError) as errorinfo:
        txt.process_labchart(channels, chtrig=chtrig)
    assert 'not supported' in str(errorinfo.value)

    # test when units are not valid for process_labchart
    header[0][1] = ' 1 gHz'
    with raises(AttributeError) as errorinfo:
        txt.process_labchart(channels, chtrig=chtrig, header=header)
    assert 'not in a valid LabChart' in str(errorinfo.value)
Exemple #2
0
def test_process_labchart(loaded_lab_file, units, expected):
    header, channels, chtrig = loaded_lab_file
    header[0][1] = units
    phys_obj = txt.process_labchart(channels, chtrig=chtrig, header=header)
    assert math.isclose(phys_obj.freq[0], expected)
Exemple #3
0
def test_process_labchart_notime(notime_lab_file):
    chtrig = 0
    header, channels = txt.read_header_and_channels(notime_lab_file, chtrig)
    phys_obj = txt.process_labchart(channels, chtrig=chtrig, header=header)
    assert len(phys_obj.timeseries) == len(channels[0]) + 1
Exemple #4
0
def test_multifreq(loaded_lab_file):
    header, channels, chtrig = loaded_lab_file
    phys_obj = txt.process_labchart(channels, chtrig=chtrig, header=header)
    new_freq = txt.check_multifreq(phys_obj.timeseries,
                                   [phys_obj.freq[0]] * len(phys_obj.freq))
    assert new_freq[-4:-1] == [100, 40, 500]