def DemoJilaOrLocal(demoName, localPath): """ Looks for the demo dir in the default (jila-hosted) space. If nothing is found, looks in the paths specified by localpath (where it puts input and output directories according to its name) Args: demoName: see GetDemoInOut localPath: equivalent of baseDir in GetDemoInOut. Where we put the input and Output directories for the unit test if JILA can't be found. Returns: tuple of <inputDir>,<outputDir> """ inDir, outDir = GetDemoInOut(demoName, raiseOnError=False) if (not pGenUtil.dirExists(inDir)): print("Warning: Couldn't connect to JILA's Network. Using local data.") # get "sanitary paths" which as OS-indepdent (in theory..) localPath = pGenUtil.ensureEnds(localPath, "/") inDir = pGenUtil.getSanitaryPath(localPath) outDir = pGenUtil.getSanitaryPath(localPath + "Output" + demoName + "/") pGenUtil.ensureDirExists(outDir) if (not pGenUtil.dirExists(inDir)): # whoops... raise IOError("Demo Directory {:s} not found anywhere.".\ format(inDir)) return inDir, outDir
def DemoJilaOrLocal(demoName,localPath): """ Looks for the demo dir in the default (jila-hosted) space. If nothing is found, looks in the paths specified by localpath (where it puts input and output directories according to its name) Args: demoName: see GetDemoInOut localPath: equivalent of baseDir in GetDemoInOut. Where we put the input and Output directories for the unit test if JILA can't be found. Returns: tuple of <inputDir>,<outputDir> """ inDir,outDir = GetDemoInOut(demoName,raiseOnError=False) if (not pGenUtil.dirExists(inDir)): print("Warning: Couldn't connect to JILA's Network. Using local data.") # get "sanitary paths" which as OS-indepdent (in theory..) localPath = pGenUtil.ensureEnds(localPath,"/") inDir = pGenUtil.getSanitaryPath(localPath) outDir = pGenUtil.getSanitaryPath(localPath + "Output" + demoName +"/") pGenUtil.ensureDirExists(outDir) if (not pGenUtil.dirExists(inDir)): # whoops... raise IOError("Demo Directory {:s} not found anywhere.".\ format(inDir)) return inDir,outDir
def getDatabaseFile(fileName, extension=".hdf"): """ Returns the absolute path to a previously-saved file with the given filename Path is *not* guaranteed to exist, if the file hasn't been saved already. Args: fileName: the name of the file (usually according to the "TraceData" table, field "FileTimSepFor") extension: the recquired extension Returns: Where the file is located, an absolute path. Doesn't guarantee the file *does* exist, just that *if* it does, it would be there. """ fileWithExt = pGenUtil.ensureEnds(fileName, extension) return getDatabaseFolder() + fileWithExt
def getDatabaseFile(fileName,extension=".hdf"): """ Returns the absolute path to a previously-saved file with the given filename Path is *not* guaranteed to exist, if the file hasn't been saved already. Args: fileName: the name of the file (usually according to the "TraceData" table, field "FileTimSepFor") extension: the recquired extension Returns: Where the file is located, an absolute path. Doesn't guarantee the file *does* exist, just that *if* it does, it would be there. """ fileWithExt = pGenUtil.ensureEnds(fileName,extension) return getDatabaseFolder() + fileWithExt
def __init__(self,data,mFile,force=False,frameRate=0.1,ext='.npz'): ''' passed in a data object ''' self._data = data self._filePath = pGenUtil.ensureEnds(mFile,ext) self._force = force self._frameRate = frameRate