This repository has been archived by the owner on Nov 15, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
msm_basic.formula_imager_segm refactoring and bug fixing
* splitted compute_sf_images method into several ones * added code for handling cases when gen_iso_peak_images returns two images for the same formula-adduct-peak * sci test report update (fix of the previous buggy report) * new test module for msm_basic.formula_imager_segm
- Loading branch information
Showing
5 changed files
with
89 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from scipy.sparse import coo_matrix | ||
|
||
from sm.engine.tests.util import spark_context | ||
from sm.engine.msm_basic.formula_imager_segm import gen_iso_sf_images | ||
|
||
|
||
def test_gen_iso_sf_images(spark_context): | ||
iso_peak_images = spark_context.parallelize([((3079, '+H'), (0, coo_matrix([[1., 0., 0.]]))), | ||
((3079, '+H'), (3, coo_matrix([[2., 1., 0.]]))), | ||
((3079, '+H'), (3, coo_matrix([[0., 0., 10.]])))]) | ||
exp_iso_sf_imgs = [((3079, '+H'), [coo_matrix([[1., 0., 0.]]), | ||
None, | ||
None, | ||
coo_matrix([[2., 1., 0.]])])] | ||
|
||
iso_sf_imgs = gen_iso_sf_images(iso_peak_images, shape=(1, 3)).collect() | ||
|
||
assert len(iso_sf_imgs) == len(exp_iso_sf_imgs) | ||
for (k, l), (ek, el) in zip(iso_sf_imgs, exp_iso_sf_imgs): | ||
assert k == ek | ||
assert len(l) == len(el) | ||
for m, em in zip(l, el): | ||
if em is None: | ||
assert m is None | ||
else: | ||
assert (m == em).toarray().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
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