def checkConflicts(self):
		if self.params['align'] and not self.params['defergpu']:
			exename = 'dosefgpu_driftcorr'
			gpuexe = subprocess.Popen("which "+exename, shell=True, stdout=subprocess.PIPE).stdout.read().strip()
			if not os.path.isfile(gpuexe):
				apDisplay.printError('Correction program "%s" not available' % exename)
			# We don't have gpu locking
			if self.params['parallel']:
					apDisplay.printWarning('Make sure that you use different gpuid for each parallel process')
			# Local directory creating and permission checking
			if self.params['tempdir']:
				try:
					fileutil.mkdirs(self.params['tempdir'])
					os.access(self.params['tempdir'],os.W_OK|os.X_OK)
				except:
					raise
					apDisplay.printError('Local temp directory not writable')
		else:
			# makes no sense to save gain corrected ddstack in tempdir if no alignment
			# will be done on the same machine
			if self.params['tempdir']:
				apDisplay.printWarning('tempdir is not neccessary without aligning on the same host. Reset to None')
				self.params['tempdir'] = None
			# Stack cleaning should not be done in some cases
			if not self.params['keepstack']:
				if self.params['defergpu']:
					apDisplay.printWarning('The gain/dark-corrected stack must be saved if alignment is deferred')
					self.params['keepstack'] = True
				else:
					apDisplay.printError('Why making only gain/dark-corrected ddstacks but not keeping them')
	def saveImageFromImageData(self,datainst):
		old_image_path = datainst['session']['image path']
		bits = old_image_path.split(datainst['session']['name'])
		tail = bits[-1]
		# assumes that the path separator is '/'
		while tail[0] == '/':
			tail = tail[1:]
		new_image_path = os.path.join(self.output_base_path,datainst['session']['name'],tail)
		fileutil.mkdirs(new_image_path)
		filename = datainst['filename']+'.mrc'
		source = os.path.join(old_image_path,filename)
		destination = os.path.join(new_image_path,filename)
		print 'copy to ', destination
		shutil.copy(source,destination)
 def saveImageFromImageData(self, datainst):
     old_image_path = datainst['session']['image path']
     bits = old_image_path.split(datainst['session']['name'])
     tail = bits[-1]
     # assumes that the path separator is '/'
     while tail[0] == '/':
         tail = tail[1:]
     new_image_path = os.path.join(self.output_base_path,
                                   datainst['session']['name'], tail)
     fileutil.mkdirs(new_image_path)
     filename = datainst['filename'] + '.mrc'
     source = os.path.join(old_image_path, filename)
     destination = os.path.join(new_image_path, filename)
     print 'copy to ', destination
     shutil.copy(source, destination)
	def makeFrameDir(self,newdir):
		fileutil.mkdirs(newdir)