|
1
|
|
|
# -*- coding: utf-8 -*- |
|
2
|
|
|
# vim:fileencoding=utf-8 |
|
3
|
|
|
# |
|
4
|
|
|
# Copyright (c) 2019 Stefan Bender |
|
5
|
|
|
# |
|
6
|
|
|
# This module is part of sciapy. |
|
7
|
|
|
# sciapy is free software: you can redistribute it or modify |
|
8
|
|
|
# it under the terms of the GNU General Public License as published |
|
9
|
|
|
# by the Free Software Foundation, version 2. |
|
10
|
|
|
# See accompanying LICENSE file or http://www.gnu.org/licenses/gpl-2.0.html. |
|
11
|
|
|
"""SCIAMACHY regression module command line interface tests |
|
12
|
|
|
|
|
13
|
|
|
Test functions to assure that the command line interface works in |
|
14
|
|
|
most of the cases, if not all. |
|
15
|
|
|
""" |
|
16
|
|
|
from os import path |
|
17
|
|
|
from pkg_resources import resource_filename |
|
18
|
|
|
from subprocess import Popen |
|
19
|
|
|
|
|
20
|
|
|
data_file = resource_filename("sciapy", |
|
21
|
|
|
path.join("data", "nitric_oxide", |
|
22
|
|
|
"scia_mlt_dzmNO_part_2008-2012_v6.2_2.1_akm0.002_geomag10_nw.nc")) |
|
23
|
|
|
|
|
24
|
|
|
|
|
25
|
|
|
def test_main_help(): |
|
26
|
|
|
p = Popen(["python", "-m", "sciapy.regress", "-h"]) |
|
27
|
|
|
p.communicate() |
|
28
|
|
|
p.wait() |
|
29
|
|
|
assert p.returncode == 0 |
|
30
|
|
|
|
|
31
|
|
|
|
|
32
|
|
|
def test_main_lin_mean(): |
|
33
|
|
|
p = Popen(["python", "-m", "sciapy.regress", |
|
34
|
|
|
data_file, |
|
35
|
|
|
"-A", "70", |
|
36
|
|
|
"-L", "65", |
|
37
|
|
|
"-k", |
|
38
|
|
|
"-O1", |
|
39
|
|
|
"-w", "50", |
|
40
|
|
|
"-b", "20", |
|
41
|
|
|
"-p", "40", |
|
42
|
|
|
"--plot_median", |
|
43
|
|
|
"--plot_residuals", |
|
44
|
|
|
"--plot_maxlnpres", |
|
45
|
|
|
"--random_seed=1234", |
|
46
|
|
|
"-q", |
|
47
|
|
|
]) |
|
48
|
|
|
p.communicate() |
|
49
|
|
|
p.wait() |
|
50
|
|
|
assert p.returncode == 0 |
|
51
|
|
|
|
|
52
|
|
|
|
|
53
|
|
|
def test_main_lin_gp(): |
|
54
|
|
|
p = Popen(["python", "-m", "sciapy.regress", |
|
55
|
|
|
data_file, |
|
56
|
|
|
"-A", "70", |
|
57
|
|
|
"-L", "65", |
|
58
|
|
|
"-k", |
|
59
|
|
|
"-K", "Mat32", |
|
60
|
|
|
"-O1", |
|
61
|
|
|
"-w", "4", |
|
62
|
|
|
"-b", "20", |
|
63
|
|
|
"-p", "40", |
|
64
|
|
|
"--no-plot_samples", |
|
65
|
|
|
"--random_seed=1234", |
|
66
|
|
|
"-q", |
|
67
|
|
|
]) |
|
68
|
|
|
p.communicate() |
|
69
|
|
|
p.wait() |
|
70
|
|
|
assert p.returncode == 0 |
|
71
|
|
|
|
|
72
|
|
|
|
|
73
|
|
|
def test_main_nonlin_gp(): |
|
74
|
|
|
p = Popen(["python", "-m", "sciapy.regress", |
|
75
|
|
|
data_file, |
|
76
|
|
|
"-A", "70", |
|
77
|
|
|
"-L", "65", |
|
78
|
|
|
"-k", |
|
79
|
|
|
"-F", "\"\"", |
|
80
|
|
|
"-I", "GM", |
|
81
|
|
|
"--fit_annlifetimes", "GM", |
|
82
|
|
|
"--positive_proxies", "GM", |
|
83
|
|
|
"--lifetime_scan=60", |
|
84
|
|
|
"--lifetime_prior=exp", |
|
85
|
|
|
"--cnt_threshold=3", |
|
86
|
|
|
"--akd_threshold=0.01", |
|
87
|
|
|
"-K", "Mat32", |
|
88
|
|
|
"-O1", |
|
89
|
|
|
"-w", "4", |
|
90
|
|
|
"-b", "20", |
|
91
|
|
|
"-p", "40", |
|
92
|
|
|
"--no-plot_samples", |
|
93
|
|
|
"--random_seed=1234", |
|
94
|
|
|
"-q", |
|
95
|
|
|
]) |
|
96
|
|
|
p.communicate() |
|
97
|
|
|
p.wait() |
|
98
|
|
|
assert p.returncode == 0 |
|
99
|
|
|
|