-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Codify the expectation that in-place experiment construction does not…
… rely on TileFetcher data When we construct an experiment in-place, the source data comes from the tiles already on disk. Therefore, whatever image data we provide the TileFetcher that we pass into `write_experiment_json` should be discarded. This verifies that the data from the tiles on the disk are what gets constituted into the experiment, and that the data returned by TileFetcher is ignored. Test plan: passed the test. Fixes #1388
- Loading branch information
Tony Tung
committed
Jun 12, 2019
1 parent
803d930
commit 14cb0de
Showing
2 changed files
with
38 additions
and
25 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 |
---|---|---|
@@ -1,18 +1,24 @@ | ||
import os | ||
import subprocess | ||
import sys | ||
import tempfile | ||
from pathlib import Path | ||
|
||
from starfish.core.experiment.experiment import Experiment | ||
import numpy as np | ||
|
||
from starfish.core.experiment.experiment import Experiment, FieldOfView | ||
|
||
def test_inplace(): | ||
|
||
def test_inplace(tmpdir): | ||
this = Path(__file__) | ||
inplace_script = this.parent / "inplace_script.py" | ||
|
||
with tempfile.TemporaryDirectory() as tmpdir_str: | ||
tmpdir = Path(tmpdir_str) | ||
tmpdir_path = Path(tmpdir) | ||
|
||
subprocess.check_call([sys.executable, os.fspath(inplace_script), os.fspath(tmpdir_path)]) | ||
|
||
subprocess.check_call([sys.executable, os.fspath(inplace_script), os.fspath(tmpdir)]) | ||
Experiment.from_json(os.fspath(tmpdir / "experiment.json")) | ||
# load up the experiment, and select an image. Ensure that it has non-zero data. This is to | ||
# verify that we are sourcing the data from the tiles that were already on-disk, and not the | ||
# artificially zero'ed tiles that we feed the experiment builder. | ||
experiment = Experiment.from_json(os.fspath(tmpdir_path / "experiment.json")) | ||
primary_image = experiment.fov().get_image(FieldOfView.PRIMARY_IMAGES) | ||
assert not np.allclose(primary_image.xarray, 0) |