-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Benjamin Alan Weaver
committed
Feb 29, 2016
1 parent
1586865
commit ef4818f
Showing
6 changed files
with
101 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Licensed under a 3-clause BSD style license - see LICENSE.rst | ||
# -*- coding: utf-8 -*- | ||
|
||
|
||
def test_spec_append(): | ||
import os | ||
from numpy import array | ||
from .. import spec_append | ||
spec1 = array([[1, 1, 1, 1, 1], | ||
[1, 1, 1, 1, 1]]) | ||
spec2 = array([[2, 2, 2, 2, 2], | ||
[2, 2, 2, 2, 2]]) | ||
s = spec_append(spec1, spec2) | ||
assert (s == array([[1, 1, 1, 1, 1], | ||
[1, 1, 1, 1, 1], | ||
[2, 2, 2, 2, 2], | ||
[2, 2, 2, 2, 2]])).all() | ||
spec2 = array([[2, 2, 2, 2], | ||
[2, 2, 2, 2]]) | ||
s = spec_append(spec1, spec2) | ||
assert (s == array([[1, 1, 1, 1, 1], | ||
[1, 1, 1, 1, 1], | ||
[2, 2, 2, 2, 0], | ||
[2, 2, 2, 2, 0]])).all() | ||
s = spec_append(spec1, spec2, 1) | ||
assert (s == array([[1, 1, 1, 1, 1], | ||
[1, 1, 1, 1, 1], | ||
[0, 2, 2, 2, 2], | ||
[0, 2, 2, 2, 2]])).all() | ||
spec1 = array([[1, 1, 1], | ||
[1, 1, 1]]) | ||
spec2 = array([[2, 2, 2, 2, 2], | ||
[2, 2, 2, 2, 2]]) | ||
s = spec_append(spec1, spec2, -2) | ||
assert (s == array([[0, 0, 1, 1, 1], | ||
[0, 0, 1, 1, 1], | ||
[2, 2, 2, 2, 2], | ||
[2, 2, 2, 2, 2]])).all() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Licensed under a 3-clause BSD style license - see LICENSE.rst | ||
# -*- coding: utf-8 -*- | ||
|
||
|
||
def test_spec_path(): | ||
import os | ||
from numpy import array | ||
from .. import spec_path | ||
if 'BOSS_SPECTRO_REDUX' in os.environ: | ||
bsr_orig = os.environ['BOSS_SPECTRO_REDUX'] | ||
bsr = bsr_orig | ||
else: | ||
bsr_orig = None | ||
bsr = '/boss/spectro/redux' | ||
os.environ['BOSS_SPECTRO_REDUX'] = bsr | ||
if 'RUN2D' in os.environ: | ||
run2d_orig = os.environ['RUN2D'] | ||
run2d = run2d_orig | ||
else: | ||
run2d_orig = None | ||
run2d = 'v1_2_3' | ||
os.environ['RUN2D'] = run2d | ||
p = spec_path(1234) | ||
assert p[0] == os.path.join(bsr, run2d, '1234') | ||
p = spec_path(1234, topdir=bsr, run2d=run2d) | ||
assert p[0] == os.path.join(bsr, run2d, '1234') | ||
p = spec_path(array([1234, 5678]), topdir=bsr, run2d=run2d) | ||
assert p[0] == os.path.join(bsr, run2d, '1234') | ||
assert p[1] == os.path.join(bsr, run2d, '5678') | ||
p = spec_path(1234, path=bsr) | ||
assert p[0] == bsr | ||
if bsr_orig is None: | ||
del os.environ['BOSS_SPECTRO_REDUX'] | ||
if run2d_orig is None: | ||
del os.environ['RUN2D'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters