def test_compareflat(self): equallightshotdesc = workflow.createShotdescription(1, self.duration, self.project, self.imagetype) flatshotdesc = copy.copy(equallightshotdesc) flatshotdesc.cameraconfiguration = self.cameraconfiguration self.assertTrue(equallightshotdesc.imagingfunctions == flatshotdesc.imagingfunctions) self.assertFalse(equallightshotdesc.imagingfunctions != flatshotdesc.imagingfunctions) self.assertTrue(flatshotdesc.compareflat(equallightshotdesc)) differentshotdesc = workflow.createShotdescription(1,3,self.project, self.imagetype) self.assertFalse(flatshotdesc.compareflat(differentshotdesc))
def test_captureflat(self): flatshotdesc = workflow.createShotdescription(0,self.duration,self.project,self.imagetype) flatshotdesc.kind = 'flat' flatshotdesc.captureflat() self.assertEqual(len(flatshotdesc.images),1) for img in flatshotdesc.images: self.assertEqual(len(img.signal), 4)
def test_persistshotdescription(self): self.dbmock.insertshotdescription = mock.MagicMock(return_value=1) projid = (1,) self.dbmock.getProjectIdFor = mock.MagicMock(return_value=projid) duration = 0.03 shotdesc = workflow.createShotdescription(5, duration, self.project) self.persistencefacade.persistshotdescription( shotdesc, self.project) self.dbmock.insertshotdescription.assert_called_with(duration, 'RAW Bayer', projid[0])
def test_createShotdescription(self): nrOfShots = 5 shotdesc = workflow.createShotdescription(nrOfShots, self.duration, self.project, self.imagetype) self.assertEqual(len(self.cameraconfiguration.imagingfunctions['RAW Bayer']),3) self.assertIsNotNone(shotdesc) self.assertEqual(shotdesc.duration, self.duration) self.assertEqual(shotdesc.imagetype, self.imagetype) self.assertEqual(len(shotdesc.images), nrOfShots) self.assertGreater(len(self.project.shotdescriptions), 0) self.assertIsNotNone(shotdesc.cameraconfiguration) self.assertEqual(shotdesc.images[0].order, 1) self.assertEqual(len(shotdesc.imagingfunctions), 3)
def setUp(self): self.project = workflow.Project('jupiter') self.cameraconfiguration = workflow.CameraConfiguration('TIS dbk22au618.as 2012') camera = mock.MagicMock() camera.formats = ['RGB Bayer'] testimage = [1,2,3,4] camera.capture = mock.MagicMock(return_value=testimage) self.cameraconfiguration.camera = camera self.cameraconfiguration.initImageTypes() self.project.cameraconfiguration = self.cameraconfiguration self.imagetype = 'RAW Bayer' self.duration = 0.03 self.shotdesc = workflow.createShotdescription(1, self.duration, self.project, self.imagetype)
pf.persistproject(project) camerainterface.getInterfaceNames() cam = camerainterface.Camera() cam.formats = ['RGB Bayer'] config = workflow.CameraConfiguration('the imaging source 2012', cam) config.interface = 'The Imaging Source' config.initImageTypes() project.cameraconfiguration = config pf.persistcameraconfiguration(config, project) nrOfShots = 3 duration = 3 shotdesc = workflow.createShotdescription(nrOfShots, duration, project, 'RAW Bayer') pf.persistshotdescription(shotdesc, project) pf.configdict = {} pf.projectdict = {} pf.loadcameraconfigurations() pf.loadprojects() projlist = pf.projectdict.values() for proj in projlist: print('Project: ' + proj.name) print('Cameraconfiguration: ' + proj.cameraconfiguration.name) imgfuncdict = proj.cameraconfiguration.imagingfunctions print('Nr of Image types: ' + str(len(imgfuncdict))) for shotdesc in proj.shotdescriptions:
def test_setimagetype(self): shotdesc = workflow.createShotdescription(0,0,self.project,'') self.assertEqual(len(shotdesc.imagingfunctions),0) shotdesc.setimagetype('RAW Bayer') self.assertEqual(shotdesc.imagetype, 'RAW Bayer') self.assertEqual(len(shotdesc.imagingfunctions),3)