<commit_before>import rfpipe
import pytest
import evla_mcast
import os.path

_install_dir = os.path.abspath(os.path.dirname(__file__))


@pytest.fixture(scope="module")
def config():
    config = evla_mcast.scan_config.ScanConfig(vci=os.path.join(_install_dir, 'data/vci.xml'),
                                               obs=os.path.join(_install_dir, 'data/obs.xml'),
                                               ant=os.path.join(_install_dir, 'data/antprop.xml'),
                                               requires=['ant', 'vci', 'obs'])
    config.stopTime = config.startTime+1/(24*3600.)

    return config


@pytest.fixture(scope="module", params=[{'npix_max': 128}, {'nsegment': 2},
                                        {'maxdm': 100}])
def inprefs(request):
    return request.param


def test_configstate(config, inprefs):
    st = rfpipe.state.State(config=config, inprefs=inprefs, preffile=None)

    assert st.nints
    assert st.endtime_mjd
    assert st.segmenttimes


def test_metastate(config, inprefs):
    meta = rfpipe.metadata.config_metadata(config, datasource='sim')

    st = rfpipe.state.State(inmeta=meta, inprefs=inprefs, preffile=None)

    assert st.nints
    assert st.endtime_mjd
    assert st.segmenttimes


def test_sim(config, inprefs):
    meta = rfpipe.metadata.config_metadata(config, datasource='sim')

    st = rfpipe.state.State(inmeta=meta, inprefs=inprefs,
                            preffile=os.path.join(_install_dir,
                                                  'data/realfast.yml'))

    segment = 0
    data = rfpipe.source.read_segment(st, segment)
    assert data.shape == st.datashape
<commit_msg>bug fix for test<commit_after>import rfpipe
import pytest
import evla_mcast
import os.path

_install_dir = os.path.abspath(os.path.dirname(__file__))


@pytest.fixture(scope="module")
def config():
    config = evla_mcast.scan_config.ScanConfig(vci=os.path.join(_install_dir, 'data/vci.xml'),
                                               obs=os.path.join(_install_dir, 'data/obs.xml'),
                                               ant=os.path.join(_install_dir, 'data/antprop.xml'),
                                               requires=['ant', 'vci', 'obs'])
    config.stopTime = config.startTime+1/(24*3600.)

    return config


@pytest.fixture(scope="module", params=[{'npix_max': 128}, {'nsegment': 2},
                                        {'maxdm': 100}])
def inprefs(request):
    return request.param


def test_configstate(config, inprefs):
    st = rfpipe.state.State(config=config, inprefs=inprefs, preffile=None)

    assert st.nints
    assert st.metadata.nints
    assert st.metadata.endtime_mjd
    assert st.segmenttimes


def test_metastate(config, inprefs):
    meta = rfpipe.metadata.config_metadata(config, datasource='sim')

    st = rfpipe.state.State(inmeta=meta, inprefs=inprefs, preffile=None)

    assert st.nints
    assert st.metadata.nints
    assert st.metadata.endtime_mjd
    assert st.segmenttimes


def test_sim(config, inprefs):
    meta = rfpipe.metadata.config_metadata(config, datasource='sim')

    st = rfpipe.state.State(inmeta=meta, inprefs=inprefs,
                            preffile=os.path.join(_install_dir,
                                                  'data/realfast.yml'))

    segment = 0
    data = rfpipe.source.read_segment(st, segment)
    assert data.shape == st.datashape

{'fraction_non_alphanumeric': 0.1185098269287181, 'fraction_numerical': 0.00880023467292461, 'mean_word_length': 2.369565217391304, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 18, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4190451', 'n_tokens_mistral': 1114, 'n_tokens_neox': 1063, 'n_words': 179}