def unitTestInitialState(self): """ Check the initialization of the share: """ EDAssert.equal(False, EDShare.isInitialized(), "Check that EDShare is uninitialized") EDShare.initialize(os.path.join(tempfile.gettempdir(), "edna-%s" % os.environ["USER"])) EDShare["test1"] = range(10) EDVerbose.screen("Backend used is %s" % EDShare.backend) EDAssert.equal(1, len(EDShare.items())) EDAssert.equal(True, "test1" in EDShare, "list is actually present") for i, j in zip(range(10), EDShare["test1"]): EDAssert.equal(i, j, "elements are the same") EDShare.close() EDShare.initialize(os.path.join(tempfile.gettempdir(), "edna-%s" % os.environ["USER"])) EDAssert.equal(True, "test1" in EDShare, "list is still present") for i, j in zip(range(10), EDShare["test1"]): EDAssert.equal(i, j, "elements are still the same") filename = EDShare.filename EDShare.close(remove=True) EDAssert.equal(False, os.path.isfile(filename), "dump-file has been removed")
def unitTestInitialState(self): """ Check the initialization of the share: """ EDAssert.equal(False, EDShare.isInitialized(), "Check that EDShare is uninitialized") strEdnaUserTempFolder = EDUtilsPath.getEdnaUserTempFolder() EDShare.initialize(strEdnaUserTempFolder) EDShare["test1"] = range(10) EDVerbose.screen("Backend used is %s" % EDShare.backend) EDAssert.equal(1, len(EDShare.items())) EDAssert.equal(True, "test1" in EDShare, "list is actually present") for i, j in zip(range(10), EDShare["test1"]): EDAssert.equal(i, j, "elements are the same") EDShare.close() EDShare.initialize(strEdnaUserTempFolder) EDAssert.equal(True, "test1" in EDShare, "list is still present") for i, j in zip(range(10), EDShare["test1"]): EDAssert.equal(i, j, "elements are still the same") filename = EDShare.filename EDShare.close(remove=True) EDAssert.equal(False, os.path.isfile(filename), "dump-file has been removed")
else: ffx = FullFieldXas() if os.path.isfile(".XSDataInputFullFieldXAS.xml"): ffx.load(".XSDataInputFullFieldXAS.xml") ffx.dontAlign = dontAlign if dontAlign: print ("*" * 80) print ("*" + "Skipping image alignement part".center(78) + "*") print ("*" * 80) ffx.setup(_listInput=paths, _mode=mode) if not isinstance(ffx.reference, int): ffx.uploadReferenceFrame(ffx.reference) ffx.save(".XSDataInputFullFieldXAS.xml") ffx.dump("analysis-%s.json" % time.strftime("%Y%m%d-%Hh%Mm%Ss")) edna = EDParallelExecute( ffx.pluginName, ffx.makeXML, _functXMLerr=ffx.error, _bVerbose=True, _bDebug=debug, _iNbThreads=iNbCPU ) edna.runEDNA(ffx.listInput, ffx.strMode, ffx.bNewerOnly) EDVerbose.WARNING("Back to main !") EDJob.synchronizeAll() ffx.updateAttrRefImage() EDPluginControlAlignStackv1_0.showData() if keepShare: EDShare.close() elif (ffx.getNrErrors() == 0) and (not EDVerbose.isVerboseDebug()): EDVerbose.WARNING("All processing finished successfully: Remove EDShare's big HDF5 file") EDShare.close(remove=True) else: EDShare.close()
if replay: ffx = FullFieldXas.replay_from(replay) else: ffx = FullFieldXas() if os.path.isfile(".XSDataInputFullFieldXAS.xml"): ffx.load(".XSDataInputFullFieldXAS.xml") ffx.dontAlign = dontAlign if dontAlign: print("*"*80) print("*" + "Skipping image alignement part".center(78) + "*") print("*"*80) ffx.setup(_listInput=paths, _mode=mode) if not isinstance(ffx.reference, int): ffx.uploadReferenceFrame(ffx.reference) ffx.save(".XSDataInputFullFieldXAS.xml") ffx.dump("analysis-%s.json" % time.strftime("%Y%m%d-%Hh%Mm%Ss")) edna = EDParallelExecute(ffx.pluginName, ffx.makeXML, _functXMLerr=ffx.error, _bVerbose=True, _bDebug=debug, _iNbThreads=iNbCPU) edna.runEDNA(ffx.listInput, ffx.strMode , ffx.bNewerOnly) EDVerbose.WARNING("Back to main !") EDJob.synchronizeAll() ffx.updateAttrRefImage() EDPluginControlAlignStackv1_0.showData() if keepShare: EDShare.close() elif (ffx.getNrErrors() == 0) and (not EDVerbose.isVerboseDebug()): EDVerbose.WARNING("All processing finished successfully: Remove EDShare's big HDF5 file") EDShare.close(remove=True) else: EDShare.close()