Esempio n. 1
0
    def __init__(self, **kwds):
        super().__init__(**kwds)

        directory = test.dataDirectory()
        filename = "movie_01"

        # Remove old movie (if any).
        fullname = os.path.join(directory, filename + ".dax")
        if os.path.exists(fullname):
            os.remove(fullname)
            
        self.test_actions = [TakeMovieAction1(directory = directory,
                                              length = 5,
                                              name = filename),
                             TakeMovieAction2(directory = directory,
                                              length = 2,
                                              name = filename,
                                              overwrite = False),
                             TakeMovieAction2(directory = directory,
                                              length = 2,
                                              name = filename,
                                              overwrite = False,
                                              test_mode = True),
                             TakeMovieAction1(directory = directory,
                                              length = 5,
                                              name = filename)]
Esempio n. 2
0
    def __init__(self, **kwds):
        super().__init__(**kwds)

        directory = test.dataDirectory()
        filename = "movie_01"
        self.test_actions = [TakeMovieAction3(directory = directory,
                                              length = 50,
                                              name = filename,
                                              parameters = "default",
                                              test_mode = True)]
Esempio n. 3
0
def test_hal_film_1():

    # This is expected to record a movie called 'movie_01.dax'
    halTest(config_xml = "none_classic_config.xml",
            class_name = "FilmTest1",
            test_module = "storm_control.test.hal.film_tests")

    # Check that the movie is the right length.
    movie = datareader.inferReader(os.path.join(test.dataDirectory(), "movie_01.dax"))
    assert(movie.filmSize() == [512, 512, 10])
Esempio n. 4
0
def test_hal_film():

    # This is expected to record a movie called 'movie_01.dax'
    halTest(config_xml="none_classic_config.xml",
            class_name="FilmTest1",
            test_module="storm_control.test.hal.film_tests")

    # Check that the movie is the right length.
    movie = datareader.inferReader(
        os.path.join(test.dataDirectory(), "movie_01.dax"))
    assert (movie.filmSize() == [512, 512, 10])
Esempio n. 5
0
def test_hal_film_5():
    """
    Test repeated film acquisition.
    """
    halTest(config_xml = "none_classic_config.xml",
            class_name = "FilmTest4",
            test_module = "storm_control.test.hal.film_tests")

    # Check that the final movie is correct.
    movie = datareader.inferReader(os.path.join(test.dataDirectory(), "movie_04.dax"))
    assert(movie.filmSize() == [512, 512, 1])
def test_v1_1():
    """
    This just tests that the XML file is created without crashing. The positions 
    file is the expected format, but with a few blank lines at the end to make
    it more interesting.
    """
    input_xml = test.daveXmlFilePathAndName("v1_generator_test.xml")
    input_positions = test.daveXmlFilePathAndName(
        "v1_generator_test_positions.txt")
    output_xml = os.path.join(test.dataDirectory(), "dave_sequence.xml")

    v1Generator.generate(None, input_xml, input_positions, output_xml)
Esempio n. 7
0
    def __init__(self, **kwds):
        super().__init__(**kwds)

        self.test_actions = [SetProgressionAction1(filename = test.halXmlFilePathAndName("prog_test.power"),
                                                   prog_type = "file"),
                             testActions.Timer(500),
                             SetProgressionAction1(prog_type = "lockedout"),
                             testActions.Timer(500),
                             TakeMovieAction1(directory = test.dataDirectory(),
                                              length = 5,
                                              name = "movie_01"),
                             testActions.Timer(500)]
Esempio n. 8
0
def test_hal_film_5():
    """
    Test repeated film acquisition.
    """
    halTest(config_xml="none_classic_config.xml",
            class_name="FilmTest4",
            test_module="storm_control.test.hal.film_tests")

    # Check that the final movie is correct.
    movie = datareader.inferReader(
        os.path.join(test.dataDirectory(), "movie_04.dax"))
    assert (movie.filmSize() == [512, 512, 1])
Esempio n. 9
0
    def __init__(self, **kwds):
        super().__init__(**kwds)

        directory = test.dataDirectory()
        filename = "movie_01"

        # Remove old movie (if any).
        fullname = os.path.join(directory, filename + ".dax")
        if os.path.exists(fullname):
            os.remove(fullname)

        self.test_actions = [testActions.SetDirectory(directory = directory),
                             testActions.Record(filename = filename)]
Esempio n. 10
0
    def __init__(self, **kwds):
        super().__init__(**kwds)

        directory = test.dataDirectory()
        filename = "movie_01"

        self.reps = 10
        self.test_actions = [
            testActions.RemoveFile(directory=directory, name=filename),
            tcpTests.TakeMovieAction1(directory=directory,
                                      length=5,
                                      name=filename)
        ]
Esempio n. 11
0
    def __init__(self, **kwds):
        super().__init__(**kwds)

        directory = test.dataDirectory()
        filename = "movie_01"

        p_name = "256x256"
        self.test_actions = [testActions.LoadParameters(filename = test.halXmlFilePathAndName(p_name + ".xml")),
                             TakeMovieAction4(directory = directory,
                                              length = 50,
                                              name = filename,
                                              parameters = p_name,
                                              test_mode = True)]
Esempio n. 12
0
    def __init__(self, **kwds):
        super().__init__(**kwds)

        directory = test.dataDirectory()
        filenames = ["movie_01", "movie_02"]

        # Remove old movies (if any).
        for elt in filenames:
            fullname = os.path.join(directory, elt + ".dax")
            if os.path.exists(fullname):
                os.remove(fullname)
            
        self.test_actions = [testActions.SetDirectory(directory = directory),
                             testActions.LoadParameters(filename = test.halXmlFilePathAndName("feed_test.xml")),
                             testActions.SetParameters(p_name = 0),
                             testActions.Timer(timeout = 200),
                             testActions.Record(filename = filenames[0]),
                             testActions.Timer(timeout = 200),
                             testActions.LoadParameters(filename = os.path.join(test.dataDirectory(), filenames[0] + ".xml")),
                             testActions.SetParameters(p_name = 0),
                             testActions.Timer(timeout = 200),
                             testActions.Record(filename = filenames[1]),
                             testActions.Timer(timeout = 200)]
Esempio n. 13
0
def test_hal_film_2():

    # This is expected to record several movies with names starting with 'movie_02'
    halTest(config_xml = "none_classic_config.xml",
            class_name = "FilmTest2",
            test_module = "storm_control.test.hal.film_tests")

    # Check that the movies are the right length.
    for name, size in [["movie_02.dax", [512, 512, 10]],
                       ["movie_02_average.dax", [512, 512, 1]],
                       ["movie_02_interval.dax", [508, 256, 2]],
                       ["movie_02_slice1.dax", [64, 65, 10]]]:
        movie = datareader.inferReader(os.path.join(test.dataDirectory(), name))
        assert(movie.filmSize() == size)
Esempio n. 14
0
def test_hal_film_2():

    # This is expected to record several movies with names starting with 'movie_02'
    halTest(config_xml="none_classic_config.xml",
            class_name="FilmTest2",
            test_module="storm_control.test.hal.film_tests")

    # Check that the movies are the right length.
    for name, size in [["movie_02.dax", [512, 512, 10]],
                       ["movie_02_average.dax", [512, 512, 1]],
                       ["movie_02_interval.dax", [508, 256, 2]],
                       ["movie_02_slice1.dax", [64, 65, 10]]]:
        movie = datareader.inferReader(os.path.join(test.dataDirectory(),
                                                    name))
        assert (movie.filmSize() == size)
Esempio n. 15
0
def test_hal_film_7():

    # This is expected to record several movies with names starting
    # with 'movie_01' and 'movie_02'.
    halTest(config_xml = "none_classic_config.xml",
            class_name = "FilmTest6",
            test_module = "storm_control.test.hal.film_tests")

    # Check that the movies are the right length.
    for name, size in [["movie_01.dax", [256, 256, 10]],
                       ["movie_01_slice1.dax", [128, 128, 10]],
                       ["movie_02.dax", [256, 256, 10]],
                       ["movie_02_slice1.dax", [128, 128, 10]]]:
        movie = datareader.inferReader(os.path.join(test.dataDirectory(), name))
        assert(movie.filmSize() == size)
Esempio n. 16
0
    def __init__(self, **kwds):
        super().__init__(**kwds)

        directory = test.dataDirectory()
        filename = "movie_04"

        # Remove old movie (if any).
        fullname = os.path.join(directory, filename + ".dax")
        if os.path.exists(fullname):
            os.remove(fullname)
            os.remove(os.path.join(directory, filename + ".xml"))

        self.test_actions = [testActions.SetDirectory(directory = directory)]
        for i in range(10):
            self.test_actions.append(testActions.Record(filename = filename, length = 1))
Esempio n. 17
0
    def __init__(self, **kwds):
        super().__init__(**kwds)

        directory = test.dataDirectory()
        filename = "movie_01"

        # Remove old movie (if any).
        fullname = os.path.join(directory, filename + ".dax")
        if os.path.exists(fullname):
            os.remove(fullname)
            
        self.test_actions = [TakeMovieAction1(directory = directory,
                                              length = 5,
                                              name = filename,
                                              parameters = "default")]
Esempio n. 18
0
    def __init__(self, **kwds):
        super().__init__(**kwds)

        directory = test.dataDirectory()
        filename = "movie_01"

        # Remove old movie (if any).
        fullname = os.path.join(directory, filename + ".dax")
        if os.path.exists(fullname):
            os.remove(fullname)
            os.remove(os.path.join(directory, filename + ".xml"))

        self.test_actions = [testActions.SetDirectory(directory = directory),
                             testActions.ShowGUIControl(control_name = "focus lock"),
                             testActions.Timer(100),
                             testActions.Record(filename = filename, length = 10)]
Esempio n. 19
0
def test_hal_film_7():

    # This is expected to record several movies with names starting
    # with 'movie_01' and 'movie_02'.
    halTest(config_xml="none_classic_config.xml",
            class_name="FilmTest6",
            test_module="storm_control.test.hal.film_tests")

    # Check that the movies are the right length.
    for name, size in [["movie_01.dax", [256, 256, 10]],
                       ["movie_01_slice1.dax", [128, 128, 10]],
                       ["movie_02.dax", [256, 256, 10]],
                       ["movie_02_slice1.dax", [128, 128, 10]]]:
        movie = datareader.inferReader(os.path.join(test.dataDirectory(),
                                                    name))
        assert (movie.filmSize() == size)
Esempio n. 20
0
    def __init__(self, **kwds):
        super().__init__(**kwds)

        directory = test.dataDirectory()
        filename = "movie_01"

        # Remove old movie (if any).
        fullname = os.path.join(directory, filename + ".dax")
        if os.path.exists(fullname):
            os.remove(fullname)

        p_name = "256x256"
        self.test_actions = [testActions.LoadParameters(filename = test.halXmlFilePathAndName(p_name + ".xml")),            
                             TakeMovieAction7(directory = directory,
                                              length = 5,
                                              name = filename,
                                              parameters = p_name)]
Esempio n. 21
0
    def __init__(self, **kwds):
        super().__init__(**kwds)

        directory = test.dataDirectory()
        filename = "movie_02"

        # Remove old movie (if any).
        fullname = os.path.join(directory, filename + ".dax")
        if os.path.exists(fullname):
            os.remove(fullname)
            
        self.test_actions = [testActions.SetDirectory(directory = directory),
                             testActions.LoadParameters(filename = test.halXmlFilePathAndName("feed_examples.xml")),
                             testActions.SetParameters(p_name = 0),
                             testActions.Timer(timeout = 1000),
                             testActions.Record(filename = filename),
                             testActions.Timer(timeout = 2000)]
Esempio n. 22
0
    def __init__(self, **kwds):
        super().__init__(**kwds)

        directory = test.dataDirectory()
        filename = "movie_03"

        # Remove old movie (if any).
        fullname = os.path.join(directory, filename + ".dax")
        if os.path.exists(fullname):
            os.remove(fullname)
            os.remove(os.path.join(directory, filename + ".xml"))
            
        self.test_actions = [testActions.SetDirectory(directory = directory),
                             testActions.Record(filename = filename),
                             testActions.LoadParameters(os.path.join(directory, "movie_03.xml")),
                             testActions.SetParameters(p_name = 0),
                             testActions.Timer(timeout = 500)]
Esempio n. 23
0
    def __init__(self, **kwds):
        super().__init__(**kwds)

        directory = test.dataDirectory()

        self.reps = 1

        # Initial setup.
        #

        # Lock focus.
        self.test_actions.append(
            tcpTests.SetFocusLockModeAction1(mode_name="Always On",
                                             locked=True))

        # Load parameters.
        self.test_actions.append(
            testActions.LoadParameters(
                filename=test.halXmlFilePathAndName("256x256.xml")))
        self.test_actions.append(
            testActions.LoadParameters(
                filename=test.halXmlFilePathAndName("256x512.xml")))

        # Turn off live mode.
        self.test_actions.append(testActions.SetLiveMode(live_mode=False))

        # Pause a second so that setup completes.
        self.test_actions.append(testActions.Timer(1000))

        # Add loop parameters.
        for i in range(10):

            ## Position 0

            # Move stage.
            self.test_actions.append(testActionsTCP.MoveStage(x=0.0, y=0.0))

            # Check focus.
            self.test_actions.append(
                testActionsTCP.CheckFocusLock(focus_scan=False,
                                              num_focus_checks=30))

            # Set parameters.
            self.test_actions.append(
                tcpTests.SetParametersAction1(name_or_index="256x256"))

            # Take Movie.
            self.test_actions.append(
                StandardDaveSequenceTakeMovieAction1(directory=directory,
                                                     length=5,
                                                     name="movie_01"))

            # Remove movie.
            self.test_actions.append(
                testActions.RemoveFile(directory=directory,
                                       name="movie_01.inf"))
            self.test_actions.append(
                testActions.RemoveFile(directory=directory,
                                       name="movie_01.dax"))

            ## Position 1

            # Move stage.
            self.test_actions.append(testActionsTCP.MoveStage(x=10.0, y=0.0))

            # Check focus.
            self.test_actions.append(
                testActionsTCP.CheckFocusLock(focus_scan=False,
                                              num_focus_checks=30))

            # Set parameters.
            self.test_actions.append(
                tcpTests.SetParametersAction1(name_or_index="256x512"))

            # Take Movie.
            self.test_actions.append(
                StandardDaveSequenceTakeMovieAction2(directory=directory,
                                                     length=5,
                                                     name="movie_02"))

            # Remove movie.
            self.test_actions.append(
                testActions.RemoveFile(directory=directory,
                                       name="movie_02.inf"))
            self.test_actions.append(
                testActions.RemoveFile(directory=directory,
                                       name="movie_02.dax"))
Esempio n. 24
0
#!/usr/bin/env python
"""
Test parsing of shutters files.
"""
import numpy

import storm_control.hal4000.illumination.xmlParser as xmlParser

import storm_control.test as test

data_dir = test.dataDirectory()
name_to_id = {"750" : 0,
              "647" : 1,
              "560" : 2}

def test_parser_1():
    """
    Test parsing a correctly formatted XML shutters file.
    """
    [s_info, waveforms, oversampling] = xmlParser.parseShuttersXML(name_to_id, data_dir + "shutters_test_1.xml")

    # Make we got it right.
    assert(s_info.color_data[0] is None)    
    assert(s_info.color_data[1] == [255,0,0])
    assert(s_info.color_data[2] is None)
        
    assert(s_info.frames == 3)
    assert(oversampling == 2)
    assert(numpy.allclose(numpy.zeros(6), waveforms[0]))
    assert(numpy.allclose(numpy.array([0.0, 0.0, 1.0, 1.0, 0.0, 0.0]), waveforms[1]))
    assert(numpy.allclose(numpy.zeros(6), waveforms[2]))
Esempio n. 25
0
#!/usr/bin/env python
"""
Test parsing of shutters files.
"""
import numpy

import storm_control.hal4000.illumination.xmlParser as xmlParser

import storm_control.test as test

data_dir = test.dataDirectory()
name_to_id = {"750": 0, "647": 1, "560": 2}


def test_parser_1():
    """
    Test parsing a correctly formatted XML shutters file.
    """
    [s_info, waveforms, oversampling
     ] = xmlParser.parseShuttersXML(name_to_id,
                                    data_dir + "shutters_test_1.xml")

    # Make we got it right.
    assert (s_info.color_data[0] is None)
    assert (s_info.color_data[1] == [255, 0, 0])
    assert (s_info.color_data[2] is None)

    assert (s_info.frames == 3)
    assert (oversampling == 2)
    assert (numpy.allclose(numpy.zeros(6), waveforms[0]))
    assert (numpy.allclose(numpy.array([0.0, 0.0, 1.0, 1.0, 0.0, 0.0]),