-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from pluskal-lab/issue05
Create basic_ci.yml
- Loading branch information
Showing
4 changed files
with
80 additions
and
38 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Basic CI | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
basic_tests: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.11 | ||
- name: Python info | ||
run: | | ||
which python | ||
python --version | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -e .[dev] | ||
- name: Show pip list | ||
run: | | ||
pip list | ||
- name: Run tests | ||
run: | | ||
pytest |
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,41 @@ | ||
import numpy as np | ||
import matchms | ||
from massspecgym.transforms import SpecTokenizer | ||
|
||
|
||
def test_spec_tokenizer(): | ||
spec = matchms.Spectrum( | ||
mz=np.array( | ||
[ | ||
45.134823, | ||
45.13699, | ||
110.096245, | ||
130.064972, | ||
136.111862, | ||
277.16571, | ||
289.165924, | ||
307.177856, | ||
406.223083, | ||
] | ||
), | ||
intensities=np.array( | ||
[ | ||
0.01082, | ||
0.01064, | ||
0.17184, | ||
0.1397, | ||
0.00874, | ||
1.0, | ||
0.52842, | ||
0.00793, | ||
0.43696 | ||
] | ||
), | ||
metadata={"precursor_mz": 406.22}, | ||
) | ||
|
||
tokenizer = SpecTokenizer(n_peaks=60) | ||
spec_np = tokenizer(spec) | ||
assert spec_np.shape == (60, 2) | ||
assert (spec_np[:spec.peaks.mz.shape[0], 0] == spec.peaks.mz).all() | ||
assert (spec_np[:spec.peaks.intensities.shape[0], 1] == spec.peaks.intensities).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