<commit_before># Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
import pytest
import numpy as np
from .. import vv
from .. import process
from ... import common

HAS_L1_ARCHIVE = os.path.exists(process.asp_l1_arch.CONFIG['data_root'])
HAS_VV_ARCHIVE = (os.path.exists(vv.FILES['data_root'])
                  & os.path.exists(vv.FILES['asp1_proc_table'])
                  & os.path.exists(vv.FILES['h5_file']))

@pytest.mark.skipif('not HAS_VV_ARCHIVE', reason='Test requires vv archive')
def test_get_vv_dir():
    obsdir = vv.get_vv_dir(16504)
    assert obsdir == os.path.abspath(os.path.join(common.MICA_ARCHIVE, 'vv/16/16504_v01'))

@pytest.mark.skipif('not HAS_VV_ARCHIVE', reason='Test requires vv archive')
def test_get_vv_files():
    obsfiles = vv.get_vv_files(16504)
    assert sorted(obsfiles)[-1] == os.path.abspath(os.path.join(common.MICA_ARCHIVE,
                                                                'vv/16/16504_v01/vv_report.pkl'))

def test_get_rms_data():
    data = vv.get_rms_data()
    dz_rms = data[(data['obsid'] == 16505) & (data['slot'] == 4) & (data['isdefault'] == 1)]['dz_rms'][0]
    assert np.allclose(dz_rms, 0.047886185719034906)

@pytest.mark.skipif('not HAS_VV_ARCHIVE', reason='Test requires vv archive')
def test_get_vv():
    obs = vv.get_vv(16504)
    assert np.allclose(obs['slots']['7']['dz_rms'], 0.11610256063309182)<commit_msg>Add test skip on missing mica vv h5 file<commit_after># Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
import pytest
import numpy as np
from .. import vv
from .. import process
from ... import common

HAS_L1_ARCHIVE = os.path.exists(process.asp_l1_arch.CONFIG['data_root'])
HAS_VV_ARCHIVE = (os.path.exists(vv.FILES['data_root'])
                  & os.path.exists(vv.FILES['asp1_proc_table'])
                  & os.path.exists(vv.FILES['h5_file']))
HAS_VV_TABLE = os.path.exists(vv.FILES['h5_file'])


@pytest.mark.skipif('not HAS_VV_ARCHIVE', reason='Test requires vv archive')
def test_get_vv_dir():
    obsdir = vv.get_vv_dir(16504)
    assert obsdir == os.path.abspath(os.path.join(common.MICA_ARCHIVE, 'vv/16/16504_v01'))

@pytest.mark.skipif('not HAS_VV_ARCHIVE', reason='Test requires vv archive')
def test_get_vv_files():
    obsfiles = vv.get_vv_files(16504)
    assert sorted(obsfiles)[-1] == os.path.abspath(os.path.join(common.MICA_ARCHIVE,
                                                                'vv/16/16504_v01/vv_report.pkl'))

@pytest.mark.skipif('not HAS_VV_TABLE', reason='Test requires vv h5 table')
def test_get_rms_data():
    data = vv.get_rms_data()
    dz_rms = data[(data['obsid'] == 16505) & (data['slot'] == 4) & (data['isdefault'] == 1)]['dz_rms'][0]
    assert np.allclose(dz_rms, 0.047886185719034906)

@pytest.mark.skipif('not HAS_VV_ARCHIVE', reason='Test requires vv archive')
def test_get_vv():
    obs = vv.get_vv(16504)
    assert np.allclose(obs['slots']['7']['dz_rms'], 0.11610256063309182)
{'fraction_non_alphanumeric': 0.15102589976454758, 'fraction_numerical': 0.05819038008745375, 'mean_word_length': 3.728139904610493, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2098667', 'n_tokens_mistral': 1228, 'n_tokens_neox': 1108, 'n_words': 192}