-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* setSuns method at the module level can now take a scalar to set an entire module. Can also still use len-1 list. Fixes #33 * Adding tests for improved setSuns method. Added ducktyping to string-level setting as well. Relaxed constraint on test_pvcell.test_calc_series to allow for change due to Numpy update.
- Loading branch information
Showing
3 changed files
with
64 additions
and
6 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,50 @@ | ||
""" | ||
Test for setSuns method. | ||
Bennet Meyers 10/10/16 | ||
""" | ||
|
||
import numpy as np | ||
from nose.tools import ok_ | ||
from pvmismatch.pvmismatch_lib.pvsystem import PVsystem | ||
|
||
|
||
def test_basic(): | ||
pvsys = PVsystem() | ||
pvsys.setSuns(.75) | ||
ok_(np.isclose(pvsys.Pmp, 23907.936630685774)) | ||
|
||
|
||
def test_dictionary(): | ||
pvsys = PVsystem() | ||
Ee = {1: {3: {'cells': np.arange(30), 'Ee': [.25] * 30}}} | ||
pvsys.setSuns(Ee) | ||
ok_(np.isclose(pvsys.Pmp, 31618.1813179655)) | ||
|
||
|
||
def test_set_mod_1(): | ||
pvsys = PVsystem() | ||
Ee = {1: {3: [.2], 0: [.1]}} | ||
pvsys.setSuns(Ee) | ||
ok_(np.isclose(pvsys.Pmp, 29566.303088387336)) | ||
|
||
|
||
def test_set_mod_2(): | ||
pvsys = PVsystem() | ||
Ee = {1: {3: .2, 0: .1}} | ||
pvsys.setSuns(Ee) | ||
ok_(np.isclose(pvsys.Pmp, 29566.303088387336)) | ||
|
||
|
||
def test_set_str_1(): | ||
pvsys = PVsystem() | ||
Ee = {1: [.1]} | ||
pvsys.setSuns(Ee) | ||
ok_(np.isclose(pvsys.Pmp, 29136.544447716446)) | ||
|
||
|
||
def test_set_str_2(): | ||
pvsys = PVsystem() | ||
Ee = {1: .1} | ||
pvsys.setSuns(Ee) | ||
ok_(np.isclose(pvsys.Pmp, 29136.544447716446)) |