Commit fd9379ff authored by Adrian Nievergelt's avatar Adrian Nievergelt

make mdoc parsing more robust and fix imod path

parent f11dabbf
......@@ -69,10 +69,16 @@ for section in parser.sections():
tempDict['filename'] = re.search("\\\\([\w.-]+)$", tempDict['subframepath']).group(1)
for imageParam in ['countsperelectron', 'defocus', 'exposuredose', 'exposuretime', 'intensity', 'pixelspacing', 'priorrecorddose', 'rotationangle', 'stagez', 'targetdefocus', 'tiltangle']:
tempDict[imageParam] = float(tempDict[imageParam])
try:
tempDict[imageParam] = float(tempDict[imageParam])
except:
tempDict[imageParam] = 0
for imageParam in ['binning', 'cameraindex', 'dividedby2', 'magindex', 'magnification', 'numsubframes', 'spotsize']:
tempDict[imageParam] = int(tempDict[imageParam])
try:
tempDict[imageParam] = int(tempDict[imageParam])
except:
tempDict[imageParam] = 0
tempDict['frameDose'] = float(tempDict['framedosesandnumber'].split()[0])
stackParams.append(tempDict)
......@@ -132,7 +138,7 @@ with open(os.path.join(mdocDir, inBaseName + "_alignFramesMC2.sh"), "w+") as scr
scriptFile.write("echo Aligning frame stack %s \n" % (os.path.join(subframesDir, imageParams['filename']) ))
scriptFile.write("MotionCor2-cuda%i -InMrc %s -OutMrc %s -Patch %i %i -InFmMotion 1 -Iter 30 -Tilt %f -FtBin %i -PixSize %f%s%s\n\n" %(args.cudaVer, os.path.join(subframesDir, imageParams['filename']), os.path.join(alignedDir, imageParams['filename']), args.patchSize, args.patchSize, imageParams['tiltangle'], args.binning, imageParams['pixelspacing'], doseWeightParams, verboseString) )
scriptFile.write("echo Creating combined tilt series stack %s\n" % (inBaseName + "_mc2.mrc"))
scriptFile.write("imodenv\n")
scriptFile.write("/sw/apps/imod/current/imodenv\n")
scriptFile.write("newstack -fileinlist %s -output %s -tilt %s%s\n\n" % ( os.path.basename(stackFileName), inBaseName + "_mc2.mrc", os.path.basename(tiltFileName), verboseString ))
if not args.keepFrames:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment