File: test_read_extinction.py

package info (click to toggle)
specreduce-data 0%2Bgit2021.11.18-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 36,064 kB
  • sloc: python: 211; makefile: 109
file content (19 lines) | stat: -rw-r--r-- 646 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# test to make sure extinction data is properly packaged and can be read in correctly

import os
import warnings

from ..readers import read_basic_ascii_table, collect_data_files


def test_read_extinction():
    ext_dir = os.path.join("reference_data", "extinction")
    data_files = collect_data_files(ext_dir)
    for f in data_files:
        try:
            t = read_basic_ascii_table(f, names=['wavelength', 'extinction'])
            assert(len(t) > 0)
            assert(len(t.columns) == 2)
        except Exception as e:
            msg = f"Failed to load {f} as an AstroPy Table: {e.__class__.__name__}"
            warnings.warn(msg)