Пример #1
0
def microscope():
    from autoscript_sdb_microscope_client import SdbMicroscopeClient

    microscope = SdbMicroscopeClient()
    microscope.connect("localhost")
    microscope.beams.ion_beam.scanning.rotation.value = 0.0
    return microscope
Пример #2
0
def test__validate_scanning_rotation(rotation):
    from autoscript_sdb_microscope_client import SdbMicroscopeClient

    microscope = SdbMicroscopeClient()
    microscope.connect("localhost")
    microscope.beams.ion_beam.scanning.rotation.value = rotation
    _validate_scanning_rotation(microscope)
    microscope.beams.ion_beam.scanning.rotation.value = 0.0
Пример #3
0
def test__validate_scanning_rotation_invalid(invalid_rotation):
    from autoscript_sdb_microscope_client import SdbMicroscopeClient

    microscope = SdbMicroscopeClient()
    microscope.connect("localhost")
    microscope.beams.ion_beam.scanning.rotation.value = invalid_rotation
    with pytest.raises(ValueError):
        _validate_scanning_rotation(microscope)
    microscope.beams.ion_beam.scanning.rotation.value = 0.0
Пример #4
0
def initialize(ip_address="localhost"):
    """Initialize autoscript for the FIBSEM microscope.

    Parameters
    ----------
    ip_address : str, optional
        The ip address of the microscope, by default 'localhost'.
        Use 'localhost' to connect to Autoscript offline.

    Returns
    -------
    Autoscript microscope instance
    """
    from autoscript_sdb_microscope_client import SdbMicroscopeClient

    microscope = SdbMicroscopeClient()
    microscope.connect(ip_address)
    microscope = reset_beam_shift(microscope)
    microscope.imaging.set_active_view(2)  # the ion beam view
    return microscope
Пример #5
0
def test_mock_adorned():
    pytest.importorskip(
        "autoscript_sdb_microscope_client", reason="Autoscript is not available."
    )
    import autolamella.autoscript
    from autoscript_sdb_microscope_client import SdbMicroscopeClient

    microscope = SdbMicroscopeClient()
    microscope.connect("localhost")
    expected = microscope.imaging.get_image()
    output = autolamella.data.mock_adorned_image()
    assert np.allclose(output.data, expected.data)
    assert np.isclose(
        output.metadata.binary_result.pixel_size.x,
        expected.metadata.binary_result.pixel_size.x,
    )
    assert np.isclose(
        output.metadata.binary_result.pixel_size.y,
        expected.metadata.binary_result.pixel_size.y,
    )
def microscope():
    from autoscript_sdb_microscope_client import SdbMicroscopeClient

    microscope = SdbMicroscopeClient()
    microscope.connect("localhost")
    return microscope
Пример #7
0
def initialize(ip_address='10.0.0.1'):
    """Initialize connection to FIBSEM microscope with Autoscript."""
    from autoscript_sdb_microscope_client import SdbMicroscopeClient
    microscope = SdbMicroscopeClient()
    microscope.connect(ip_address)
    return microscope
Пример #8
0
import numpy as np
import pytest

from piescope.data.mocktypes import MockAdornedImage
import piescope.fibsem

autoscript = pytest.importorskip("autoscript_sdb_microscope_client",
                                 reason="Autoscript is not available.")

try:
    from autoscript_sdb_microscope_client import SdbMicroscopeClient
    microscope = SdbMicroscopeClient()
    microscope.connect("localhost")
except Exception as e:
    pytest.skip(
        "AutoScript cannot connect to localhost, skipping all AutoScript tests.",
        allow_module_level=True)


def test_initialize():
    """Test connecting to the microscope offline with localhost."""
    microscope = piescope.fibsem.initialize("localhost")


@pytest.fixture
def microscope():
    from autoscript_sdb_microscope_client import SdbMicroscopeClient

    microscope = SdbMicroscopeClient()
    microscope.connect("localhost")
    return microscope