You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
100 lines
2.4 KiB
100 lines
2.4 KiB
""" test fixtures """ |
|
|
|
from pathlib import Path |
|
|
|
import pandas |
|
import pytest |
|
|
|
EXAMPLE_DIR_WO_PARAMS = "mtp_wo_parameters" |
|
EXAMPLE_DIR_WITH_PARAMS = "mtp_with_parameters" |
|
|
|
|
|
@pytest.fixture |
|
def example_dir(request): |
|
root_dir = Path(request.config.rootdir) |
|
yield root_dir / "example_data" |
|
|
|
|
|
@pytest.fixture |
|
def example_file(example_dir): |
|
data_dir = example_dir / EXAMPLE_DIR_WO_PARAMS |
|
yield data_dir / "160218_SG2-013-001_Regen1_Cy3-100_1_A1_1.csv" |
|
|
|
|
|
@pytest.fixture |
|
def exposure_df(): |
|
from pandas import DataFrame |
|
|
|
yield DataFrame(data={"Exposure.Id": [1, 2, 3]}) |
|
|
|
|
|
@pytest.fixture |
|
def dir_for_caching(tmpdir, example_file): |
|
import shutil |
|
|
|
temp_path = Path(tmpdir) |
|
dest = temp_path / example_file.name |
|
shutil.copy(example_file, dest) |
|
yield temp_path |
|
|
|
|
|
@pytest.fixture |
|
def normalization_data_frame(): |
|
from sensospot_data.columns import COLUMN_NORMALIZATION |
|
|
|
overflow_test_values = [ |
|
(1, 1, 1, 50, 1, 0), |
|
(1, 1, 2, 50, 1, 2), |
|
(1, 1, 3, 50, 1, 2), |
|
(1, 1, 4, 50, 1, 0), |
|
(1, 1, 1, 25, 2, 0), |
|
(1, 1, 2, 25, 2, 0), |
|
(1, 1, 3, 25, 2, 2), |
|
(1, 1, 4, 25, 2, 2), |
|
(1, 1, 1, 10, 3, 0), |
|
(1, 1, 2, 10, 3, 0), |
|
(1, 1, 3, 10, 3, 2), |
|
(1, 1, 4, 10, 3, 0), |
|
(1, 2, 1, 50, 10, 0), |
|
(1, 2, 2, 50, 10, 0), |
|
(1, 2, 3, 50, 10, 0), |
|
(1, 2, 4, 50, 10, 0), |
|
(1, 2, 1, 25, 20, 0), |
|
(1, 2, 2, 25, 20, 0), |
|
(1, 2, 3, 25, 20, 2), |
|
(1, 2, 4, 25, 20, 2), |
|
(1, 2, 1, 10, 30, 0), |
|
(1, 2, 2, 10, 30, 0), |
|
(1, 2, 3, 10, 30, 2), |
|
(1, 2, 4, 10, 30, 0), |
|
(2, 1, 1, 50, 100, 0), |
|
(2, 1, 2, 50, 100, 0), |
|
(2, 1, 3, 50, 100, 0), |
|
(2, 1, 4, 50, 100, 0), |
|
(2, 1, 1, 25, 200, 0), |
|
(2, 1, 2, 25, 200, 0), |
|
(2, 1, 3, 25, 200, 2), |
|
(2, 1, 4, 25, 200, 2), |
|
(2, 1, 1, 10, 300, 0), |
|
(2, 1, 2, 10, 300, 0), |
|
(2, 1, 3, 10, 300, 2), |
|
(2, 1, 4, 10, 300, 0), |
|
] |
|
overflow_test_keys = [ |
|
"Well.Row", |
|
"Well.Column", |
|
"Pos.Id", |
|
"Exposure.Time", |
|
"Value", |
|
"Saturation", |
|
] |
|
overflow_test_data = [ |
|
dict(zip(overflow_test_keys, v)) for v in overflow_test_values |
|
] |
|
data_frame = pandas.DataFrame(overflow_test_data) |
|
data_frame["Exposure.Channel"] = "Cy5" |
|
|
|
for value_column in COLUMN_NORMALIZATION.keys(): |
|
data_frame[value_column] = data_frame["Value"] |
|
|
|
yield data_frame
|
|
|