Beispiel #1
0
    def testUnitProjections(self):
        imgs = self.import_fake_file(name="testUnitProjections",
                                     exposureTime=1.2)
        img = imgs[0]

        as_map = self.query.projection(
            ("select pi.exposureTime from PlaneInfo pi "
             "join pi.pixels as pix join pix.image as img "
             "where img.id = :id"),
            omero.sys.ParametersI().addId(img.id.val))[0][0]
        as_map = unwrap(as_map)
        pytest.assertAlmostEqual(1.2, as_map.get("value"))
        assert "SECOND" == as_map.get("unit")
        assert "s" == as_map.get("symbol")

        as_objs = self.query.projection(
            ("select pi.exposureTime.value, "
             "pi.exposureTime.unit, "
             "cast(pi.exposureTime.unit as text) from PlaneInfo pi "
             "join pi.pixels as pix join pix.image as img "
             "where img.id = :id"),
            omero.sys.ParametersI().addId(img.id.val))[0]
        as_objs = unwrap(as_objs)
        pytest.assertAlmostEqual(1.2, as_objs[0])
        assert "SECOND" == as_objs[1]
        assert "s" == as_objs[2]
Beispiel #2
0
    def testConversionData(self, data):
        Type, v_from, u_from, v_to, u_to = data

        q_from = Type(v_from, u_from)
        q_to = Type(q_from, u_to)
        pytest.assertAlmostEqual(v_to, q_to.getValue(), places=4)

        q_to = Type(v_to, u_to)
        q_from = Type(q_to, u_from)
        pytest.assertAlmostEqual(v_from, q_from.getValue(), places=4)
    def testUnitProjections(self):
        img = self.importMIF(name="testUnitProjections", exposureTime=1.2)[0]

        as_map = self.query.projection((
            "select pi.exposureTime from PlaneInfo pi "
            "join pi.pixels as pix join pix.image as img "
            "where img.id = :id"),
            omero.sys.ParametersI().addId(img.id.val))[0][0]
        as_map = unwrap(as_map)
        pytest.assertAlmostEqual(1.2, as_map.get("value"))
        assert "SECOND" == as_map.get("unit")
        assert "s" == as_map.get("symbol")

        as_objs = self.query.projection((
            "select pi.exposureTime.value, "
            "pi.exposureTime.unit, "
            "cast(pi.exposureTime.unit as text) from PlaneInfo pi "
            "join pi.pixels as pix join pix.image as img "
            "where img.id = :id"),
            omero.sys.ParametersI().addId(img.id.val))[0]
        as_objs = unwrap(as_objs)
        pytest.assertAlmostEqual(1.2, as_objs[0])
        assert "SECOND" == as_objs[1]
        assert "s" == as_objs[2]
 def assertEquals(self, a, b, places=6):
     assertAlmostEqual(a, b, places=places)