def setup_method(self): self.tmpdir = tempfile.mkdtemp() print self.tmpdir self.persister = UBCalculationJSONPersister(self.tmpdir, UBCalcStateEncoder) f = open(os.path.join(self.tmpdir, 'unexpected_file'), 'w') f.close()
def _createPersister(self): self.tmpdir = tempfile.mkdtemp() print self.tmpdir self.persister = UBCalculationJSONPersister(self.tmpdir) f = open(os.path.join(self.tmpdir, 'unexpected_file'), 'w') f.close() return self.persister
def setup_method(self): self.tempdir = tempfile.mkdtemp() geometry = SixCircle() # pass through hardware = Mock() names = 'm', 'd', 'n', 'e', 'c', 'p' hardware.get_axes_names.return_value = names self.tmpdir = tempfile.mkdtemp() print self.tmpdir self.ubcalc = UBCalculation(hardware, geometry, UBCalculationJSONPersister(self.tmpdir), YouUbCalcStrategy())
except NameError: IPYTHON = False module_name = sys.argv[1] #3 if IPYTHON else 1] debug = sys.argv[2] == 'True' #4 if IPYTHON else 2]) print print bold('-' * 34 + ' DIFFCALC ' + '-' * 35) # configure persisentence DIFFCALC_VAR = os.path.join(os.path.expanduser('~'), '.diffcalc', module_name) if not os.path.exists(DIFFCALC_VAR): print "Making diffcalc var folder:'%s'" % DIFFCALC_VAR os.makedirs(DIFFCALC_VAR) diffcalc.settings.ubcalc_persister = UBCalculationJSONPersister(DIFFCALC_VAR) # configure debug diffcalc.util.DEBUG = debug if debug: print "WARNING: debug mode on; help for command syntax errors disabled." # import script script = os.path.join(DIFFCALC_ROOT, 'startup', module_name) + '.py' print "Startup script: '%s'" % script namespace = {} execfile(script, namespace) globals().update(namespace) diffcalc.gdasupport.minigda.command.ROOT_NAMESPACE_DICT = dict(namespace) print bold('-' * 36 + ' Help ' + '-' * 37)
IPYTHON = False try: from gda.device.scannable.scannablegroup import ScannableGroup from gdascripts.scannable.dummy import SingleInputDummy as Dummy from diffcmd.diffcmd_utils import alias_commands GDA = True except ImportError: # Not running in gda environment so fall back to minigda emulation from diffcalc.gdasupport.minigda.scannable import ScannableGroup from diffcalc.gdasupport.minigda.scannable import SingleFieldDummyScannable as Dummy GDA = False HELP_STRING = \ """Quick: https://github.com/DiamondLightSource/diffcalc/blob/master/README.rst Manual: http://diffcalc.readthedocs.io/en/latest/youmanual.html Type: > help ub > help hkl""" if GDA: from gda.configuration.properties import LocalProperties # @UnresolvedImport var_folder = LocalProperties.get("gda.var") diffcalc_persistance_path = os.path.join(var_folder, 'diffcalc') if not os.path.exists(diffcalc_persistance_path): print "Making diffcalc var folder:'%s'" % diffcalc_persistance_path os.makedirs(diffcalc_persistance_path) settings.ubcalc_persister = UBCalculationJSONPersister( diffcalc_persistance_path, YouStateEncoder) # else: should have been set if outside GDA
__IPYTHON__ # @UndefinedVariable IPYTHON = True except NameError: IPYTHON = False module_name = sys.argv[1] #3 if IPYTHON else 1] debug = sys.argv[2] == 'True' #4 if IPYTHON else 2]) print print(bold('-' * 34 + ' DIFFCALC ' + '-' * 35)) # configure persisentence DIFFCALC_VAR = os.path.join(os.path.expanduser('~'), '.diffcalc', module_name) if not os.path.exists(DIFFCALC_VAR): print("Making diffcalc var folder:'%s'" % DIFFCALC_VAR) os.makedirs(DIFFCALC_VAR) diffcalc.settings.ubcalc_persister = UBCalculationJSONPersister( DIFFCALC_VAR, UBCalcStateEncoder) # configure debug diffcalc.util.DEBUG = debug if debug: print("WARNING: debug mode on; help for command syntax errors disabled.") # import script script = os.path.join(DIFFCALC_ROOT, 'startup', module_name) + '.py' print("Startup script: '%s'" % script) namespace = {} exec(open(script).read(), namespace) globals().update(namespace) diffcalc.gdasupport.minigda.command.ROOT_NAMESPACE_DICT = dict(namespace) print(bold('-' * 36 + ' Help ' + '-' * 37))