-
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.
add tests for all built-in plans (#24)
* count * rel_scan * list_scan * rel_list_scan * list_grid_scan * rel_list_grid_scan * grid_scan * rel_grid_scan * log_scan * rel_log_scan * scan_nd * spiral * spiral_fermat * spiral_square * rel_spiral * rel_spiral_fermat * rel_spiral_square * blacken * basename fix * initialize hardware for rel scan
- Loading branch information
Showing
50 changed files
with
625 additions
and
0 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,24 @@ | ||
import pathlib | ||
import time | ||
import subprocess | ||
import yaqc_bluesky | ||
from yaqd_core import testing | ||
from bluesky import RunEngine | ||
from bluesky.plans import count | ||
|
||
|
||
__here__ = pathlib.Path(__file__).parent | ||
|
||
|
||
@testing.run_daemon_entry_point( | ||
"fake-triggered-sensor", config=__here__ / "triggered-sensor-config.toml" | ||
) | ||
def test_simple_count(): | ||
RE = RunEngine() | ||
hardware = yaqc_bluesky.Device(39424) | ||
sensor = yaqc_bluesky.Device(39425) | ||
RE(count([sensor], 41)) | ||
|
||
|
||
if __name__ == "__main__": | ||
test_simple_count() |
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,2 @@ | ||
[sensor] | ||
port = 39425 |
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,2 @@ | ||
[hardware] | ||
port = 39424 |
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,27 @@ | ||
import pathlib | ||
import time | ||
import subprocess | ||
import yaqc_bluesky | ||
from yaqd_core import testing | ||
from bluesky import RunEngine | ||
from bluesky.plans import grid_scan | ||
|
||
|
||
__here__ = pathlib.Path(__file__).parent | ||
|
||
|
||
@testing.run_daemon_entry_point( | ||
"fake-triggered-sensor", config=__here__ / "triggered-sensor-config.toml" | ||
) | ||
@testing.run_daemon_entry_point( | ||
"fake-continuous-hardware", config=__here__ / "continuous-hardware-config.toml" | ||
) | ||
def test_simple_grid_scan(): | ||
RE = RunEngine() | ||
hardware = yaqc_bluesky.Device(39424) | ||
sensor = yaqc_bluesky.Device(39425) | ||
RE(grid_scan([sensor], hardware, -10, 10, 15)) | ||
|
||
|
||
if __name__ == "__main__": | ||
test_simple_grid_scan() |
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,2 @@ | ||
[sensor] | ||
port = 39425 |
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,2 @@ | ||
[hardware] | ||
port = 39424 |
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,28 @@ | ||
import pathlib | ||
import time | ||
import subprocess | ||
import yaqc_bluesky | ||
from yaqd_core import testing | ||
from bluesky import RunEngine | ||
from bluesky.plans import list_grid_scan | ||
|
||
|
||
__here__ = pathlib.Path(__file__).parent | ||
|
||
|
||
@testing.run_daemon_entry_point( | ||
"fake-triggered-sensor", config=__here__ / "triggered-sensor-config.toml" | ||
) | ||
@testing.run_daemon_entry_point( | ||
"fake-continuous-hardware", config=__here__ / "continuous-hardware-config.toml" | ||
) | ||
def test_simple_list_grid_scan(): | ||
RE = RunEngine() | ||
hardware = yaqc_bluesky.Device(39424) | ||
sensor = yaqc_bluesky.Device(39425) | ||
lis = [-10, -8, 4, 2, 10] | ||
RE(list_grid_scan([sensor], hardware, lis)) | ||
|
||
|
||
if __name__ == "__main__": | ||
test_simple_list_grid_scan() |
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,2 @@ | ||
[sensor] | ||
port = 39425 |
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,2 @@ | ||
[hardware] | ||
port = 39424 |
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,28 @@ | ||
import pathlib | ||
import time | ||
import subprocess | ||
import yaqc_bluesky | ||
from yaqd_core import testing | ||
from bluesky import RunEngine | ||
from bluesky.plans import list_scan | ||
|
||
|
||
__here__ = pathlib.Path(__file__).parent | ||
|
||
|
||
@testing.run_daemon_entry_point( | ||
"fake-triggered-sensor", config=__here__ / "triggered-sensor-config.toml" | ||
) | ||
@testing.run_daemon_entry_point( | ||
"fake-continuous-hardware", config=__here__ / "continuous-hardware-config.toml" | ||
) | ||
def test_simple_list_scan(): | ||
RE = RunEngine() | ||
hardware = yaqc_bluesky.Device(39424) | ||
sensor = yaqc_bluesky.Device(39425) | ||
lis = [-10, -8, 4, 2, 10] | ||
RE(list_scan([sensor], hardware, lis)) | ||
|
||
|
||
if __name__ == "__main__": | ||
test_simple_list_scan() |
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,2 @@ | ||
[sensor] | ||
port = 39425 |
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,2 @@ | ||
[hardware] | ||
port = 39424 |
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,27 @@ | ||
import pathlib | ||
import time | ||
import subprocess | ||
import yaqc_bluesky | ||
from yaqd_core import testing | ||
from bluesky import RunEngine | ||
from bluesky.plans import log_scan | ||
|
||
|
||
__here__ = pathlib.Path(__file__).parent | ||
|
||
|
||
@testing.run_daemon_entry_point( | ||
"fake-triggered-sensor", config=__here__ / "triggered-sensor-config.toml" | ||
) | ||
@testing.run_daemon_entry_point( | ||
"fake-continuous-hardware", config=__here__ / "continuous-hardware-config.toml" | ||
) | ||
def test_simple_log_scan(): | ||
RE = RunEngine() | ||
hardware = yaqc_bluesky.Device(39424) | ||
sensor = yaqc_bluesky.Device(39425) | ||
RE(log_scan([sensor], hardware, -10, 10, 15)) | ||
|
||
|
||
if __name__ == "__main__": | ||
test_simple_log_scan() |
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,2 @@ | ||
[sensor] | ||
port = 39425 |
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,2 @@ | ||
[hardware] | ||
port = 39424 |
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,27 @@ | ||
import pathlib | ||
import time | ||
import subprocess | ||
import yaqc_bluesky | ||
from yaqd_core import testing | ||
from bluesky import RunEngine | ||
from bluesky.plans import rel_grid_scan | ||
|
||
|
||
__here__ = pathlib.Path(__file__).parent | ||
|
||
|
||
@testing.run_daemon_entry_point( | ||
"fake-triggered-sensor", config=__here__ / "triggered-sensor-config.toml" | ||
) | ||
@testing.run_daemon_entry_point( | ||
"fake-continuous-hardware", config=__here__ / "continuous-hardware-config.toml" | ||
) | ||
def test_simple_rel_grid_scan(): | ||
RE = RunEngine() | ||
hardware = yaqc_bluesky.Device(39424) | ||
sensor = yaqc_bluesky.Device(39425) | ||
RE(rel_grid_scan([sensor], hardware, -1, 1, 15)) | ||
|
||
|
||
if __name__ == "__main__": | ||
test_simple_rel_grid_scan() |
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,2 @@ | ||
[sensor] | ||
port = 39425 |
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,2 @@ | ||
[hardware] | ||
port = 39424 |
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,28 @@ | ||
import pathlib | ||
import time | ||
import subprocess | ||
import yaqc_bluesky | ||
from yaqd_core import testing | ||
from bluesky import RunEngine | ||
from bluesky.plans import rel_list_grid_scan | ||
|
||
|
||
__here__ = pathlib.Path(__file__).parent | ||
|
||
|
||
@testing.run_daemon_entry_point( | ||
"fake-triggered-sensor", config=__here__ / "triggered-sensor-config.toml" | ||
) | ||
@testing.run_daemon_entry_point( | ||
"fake-continuous-hardware", config=__here__ / "continuous-hardware-config.toml" | ||
) | ||
def test_simple_rel_list_grid_scan(): | ||
RE = RunEngine() | ||
hardware = yaqc_bluesky.Device(39424) | ||
sensor = yaqc_bluesky.Device(39425) | ||
lis = [-0.1, 0, 0.1, 0.2, 0.5] | ||
RE(rel_list_grid_scan([sensor], hardware, lis)) | ||
|
||
|
||
if __name__ == "__main__": | ||
test_simple_rel_list_grid_scan() |
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,2 @@ | ||
[sensor] | ||
port = 39425 |
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,2 @@ | ||
[hardware] | ||
port = 39424 |
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,28 @@ | ||
import pathlib | ||
import time | ||
import subprocess | ||
import yaqc_bluesky | ||
from yaqd_core import testing | ||
from bluesky import RunEngine | ||
from bluesky.plans import rel_list_scan | ||
|
||
|
||
__here__ = pathlib.Path(__file__).parent | ||
|
||
|
||
@testing.run_daemon_entry_point( | ||
"fake-triggered-sensor", config=__here__ / "triggered-sensor-config.toml" | ||
) | ||
@testing.run_daemon_entry_point( | ||
"fake-continuous-hardware", config=__here__ / "continuous-hardware-config.toml" | ||
) | ||
def test_simple_rel_list_scan(): | ||
RE = RunEngine() | ||
hardware = yaqc_bluesky.Device(39424) | ||
sensor = yaqc_bluesky.Device(39425) | ||
lis = [-0.1, 0, 0.1, 0.2, 0.5] | ||
RE(rel_list_scan([sensor], hardware, lis)) | ||
|
||
|
||
if __name__ == "__main__": | ||
test_simple_rel_list_scan() |
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,2 @@ | ||
[sensor] | ||
port = 39425 |
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,2 @@ | ||
[hardware] | ||
port = 39424 |
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,27 @@ | ||
import pathlib | ||
import time | ||
import subprocess | ||
import yaqc_bluesky | ||
from yaqd_core import testing | ||
from bluesky import RunEngine | ||
from bluesky.plans import rel_log_scan | ||
|
||
|
||
__here__ = pathlib.Path(__file__).parent | ||
|
||
|
||
@testing.run_daemon_entry_point( | ||
"fake-triggered-sensor", config=__here__ / "triggered-sensor-config.toml" | ||
) | ||
@testing.run_daemon_entry_point( | ||
"fake-continuous-hardware", config=__here__ / "continuous-hardware-config.toml" | ||
) | ||
def test_simple_rel_log_scan(): | ||
RE = RunEngine() | ||
hardware = yaqc_bluesky.Device(39424) | ||
sensor = yaqc_bluesky.Device(39425) | ||
RE(rel_log_scan([sensor], hardware, -10, 10, 15)) | ||
|
||
|
||
if __name__ == "__main__": | ||
test_simple_rel_log_scan() |
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,2 @@ | ||
[sensor] | ||
port = 39425 |
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,2 @@ | ||
[hardware] | ||
port = 39424 |
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,28 @@ | ||
import pathlib | ||
import time | ||
import subprocess | ||
import yaqc_bluesky | ||
from yaqd_core import testing | ||
from bluesky import RunEngine | ||
from bluesky.plans import rel_scan | ||
|
||
|
||
__here__ = pathlib.Path(__file__).parent | ||
|
||
|
||
@testing.run_daemon_entry_point( | ||
"fake-triggered-sensor", config=__here__ / "triggered-sensor-config.toml" | ||
) | ||
@testing.run_daemon_entry_point( | ||
"fake-continuous-hardware", config=__here__ / "continuous-hardware-config.toml" | ||
) | ||
def test_simple_rel_scan(): | ||
RE = RunEngine() | ||
hardware = yaqc_bluesky.Device(39424) | ||
print(hardware.stop) | ||
sensor = yaqc_bluesky.Device(39425) | ||
RE(rel_scan([sensor], hardware, -1, 1, 15)) | ||
|
||
|
||
if __name__ == "__main__": | ||
test_simple_rel_scan() |
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,2 @@ | ||
[sensor] | ||
port = 39425 |
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,5 @@ | ||
[hardware1] | ||
port = 39423 | ||
|
||
[hardware2] | ||
port = 39424 |
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,35 @@ | ||
import pathlib | ||
import time | ||
import subprocess | ||
from cycler import cycler | ||
import yaqc_bluesky | ||
from yaqd_core import testing | ||
from bluesky import RunEngine | ||
from bluesky.plans import rel_spiral | ||
|
||
|
||
__here__ = pathlib.Path(__file__).parent | ||
|
||
|
||
@testing.run_daemon_entry_point( | ||
"fake-triggered-sensor", config=__here__ / "triggered-sensor-config.toml" | ||
) | ||
@testing.run_daemon_entry_point( | ||
"fake-continuous-hardware", config=__here__ / "continuous-hardware-config.toml" | ||
) | ||
def test_simple_rel_spiral(): | ||
RE = RunEngine() | ||
hardware_x = yaqc_bluesky.Device(39423) | ||
hardware_y = yaqc_bluesky.Device(39424) | ||
sensor = yaqc_bluesky.Device(39425) | ||
hardware_x.set(0) | ||
hardware_y.set(0) | ||
RE( | ||
rel_spiral( | ||
[sensor], x_motor=hardware_x, y_motor=hardware_y, x_range=1, y_range=1, dr=0.5, nth=10 | ||
) | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
test_simple_rel_spiral() |
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,2 @@ | ||
[sensor] | ||
port = 39425 |
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,5 @@ | ||
[hardware1] | ||
port = 39423 | ||
|
||
[hardware2] | ||
port = 39424 |
Oops, something went wrong.