Beispiel #1
0
    def __init__(self):
        """ UVBase test object. """
        # add some test UVParameters to the class

        self._int1 = uvp.UVParameter(
            "int1", description="integer value", expected_type=int, value=3
        )

        self._int2 = uvp.UVParameter(
            "int2", description="integer value", expected_type=int, value=5
        )

        self._float1 = uvp.UVParameter(
            "float1", description="float value", expected_type=np.float, value=18.2
        )

        self._string1 = uvp.UVParameter(
            "string1", description="string value", form="str", value="test"
        )

        self._string2 = uvp.UVParameter(
            "string2", description="string value", expected_type="str", value="test"
        )

        self._floatarr = uvp.UVParameter(
            "floatarr",
            description="float array",
            form=("int1", "int2"),
            expected_type=np.float,
            value=np.random.rand(self._int1.value, self._int2.value),
        )

        self._floatarr2 = uvp.UVParameter(
            "floatarr2",
            description="float array",
            form=4,
            expected_type=np.float,
            value=np.random.rand(4),
        )

        self._strlist = uvp.UVParameter(
            "strlist",
            description="string list",
            form=("int1",),
            expected_type=str,
            value=["s" + str(i) for i in np.arange(self._int1.value)],
        )

        self._intlist = uvp.UVParameter(
            "intlist",
            description="integer list",
            form=("int1",),
            expected_type=int,
            value=list(range(self._int1.value)),
        )

        self._angle = uvp.AngleParameter(
            "angle", description="angle", expected_type=np.float, value=np.pi / 4.0
        )

        self._location = uvp.LocationParameter(
            "location", description="location", value=np.array(ref_xyz)
        )

        self._optional_int1 = uvp.UVParameter(
            "optional_int1",
            description="optional integer value",
            expected_type=int,
            value=3,
            required=False,
        )

        self._optional_int2 = uvp.UVParameter(
            "optional_int2",
            description="optional integer value",
            expected_type=int,
            value=5,
            required=False,
        )

        self._unset_int1 = uvp.UVParameter(
            "unset_int1",
            description="An unset parameter.",
            expected_type=int,
            value=None,
            required=False,
        )

        super(UVTest, self).__init__()
Beispiel #2
0
def test_location_acceptable_none():
    param1 = uvp.LocationParameter(name="p2", value=1, acceptable_range=None)

    assert param1.check_acceptability()
Beispiel #3
0
    def __init__(self):
        """ UVBase test object. """
        # add some test UVParameters to the class

        self._int1 = uvp.UVParameter('int1',
                                     description='integer value',
                                     expected_type=int,
                                     value=3)

        self._int2 = uvp.UVParameter('int2',
                                     description='integer value',
                                     expected_type=int,
                                     value=5)

        self._float1 = uvp.UVParameter('float1',
                                       description='float value',
                                       expected_type=np.float,
                                       value=18.2)

        self._string1 = uvp.UVParameter('string1',
                                        description='string value',
                                        form='str',
                                        value='test')

        self._string2 = uvp.UVParameter('string2',
                                        description='string value',
                                        expected_type='str',
                                        value='test')

        self._floatarr = uvp.UVParameter('floatarr',
                                         description='float array',
                                         form=('int1', 'int2'),
                                         expected_type=np.float,
                                         value=np.random.rand(
                                             self._int1.value,
                                             self._int2.value))

        self._floatarr2 = uvp.UVParameter('floatarr2',
                                          description='float array',
                                          form=4,
                                          expected_type=np.float,
                                          value=np.random.rand(4))

        self._strlist = uvp.UVParameter(
            'strlist',
            description='string list',
            form=('int1', ),
            expected_type=str,
            value=['s' + str(i) for i in np.arange(self._int1.value)])

        self._intlist = uvp.UVParameter('intlist',
                                        description='integer list',
                                        form=('int1', ),
                                        expected_type=int,
                                        value=list(range(self._int1.value)))

        self._angle = uvp.AngleParameter('angle',
                                         description='angle',
                                         expected_type=np.float,
                                         value=np.pi / 4.)

        self._location = uvp.LocationParameter('location',
                                               description='location',
                                               value=np.array(ref_xyz))

        self._optional_int1 = uvp.UVParameter(
            'optional_int1',
            description='optional integer value',
            expected_type=int,
            value=3,
            required=False)

        self._optional_int2 = uvp.UVParameter(
            'optional_int2',
            description='optional integer value',
            expected_type=int,
            value=5,
            required=False)

        super(UVTest, self).__init__()
Beispiel #4
0
def test_location_set_lat_lon_alt_degrees_none():
    param1 = uvp.LocationParameter(name="p2", value=1)
    param1.set_lat_lon_alt_degrees(None)

    assert param1.value is None
Beispiel #5
0
def test_location_set_lat_lon_alt_none():
    param1 = uvp.LocationParameter(name='p2', value=1)
    param1.set_lat_lon_alt(None)

    assert param1.value is None