def insertAlignIteration(alignrundata, protomodata, params, refinedict, refimagedata): # protmoalign refinement cycle parameters refineparamsq = appiondata.ApProtomoRefinementParamsData() refineparamsq['protomo'] = protomodata refineparamsq['cycle'] = params['cycle'] refineparamsq['alismp'] = refinedict['alismp'] refineparamsq['alibox'] = { 'x': refinedict['alibox_x'], 'y': refinedict['alibox_y'] } refineparamsq['cormod'] = refinedict['cormod'] refineparamsq['imgref'] = refinedict['imgref'] refineparamsq['reference'] = refimagedata refineparamsdata = apTomo.publish(refineparamsq) # good cycle used for reset tlt params if params['goodcycle'] is None: goodrefineparamsdata = None else: goodq = appiondata.ApProtomoRefinementParamsData( protomo=protomodata, cycle=params['goodcycle']) results = goodq.query(results=1) if results: goodrefineparamsdata = results[0] else: goodrefineparamsdata = None # protomoaligner parameters alignerdata = apTomo.insertAlignerParams(alignrundata, params, protomodata, refineparamsdata, goodrefineparamsdata, refimagedata) return alignerdata
def insertModel2(alignerdata, geometrydict): # general protomo2 model data q = appiondata.ApProtomoModelData() q['aligner'] = alignerdata q['psi'] = geometrydict['psi'] q['theta'] = geometrydict['theta'] q['phi'] = geometrydict['phi'] q['azimuth'] = geometrydict['azimuth'] modeldata = apTomo.publish(q) return modeldata
def insertModel(alignerdata, results): # general protmo parameters q = appiondata.ApProtomoModelData() q['aligner'] = alignerdata q['psi'] = results[-2]['psi'] q['theta'] = results[-2]['theta'] q['phi'] = results[-2]['phi'] q['azimuth'] = results[-2]['azimuth'] modeldata = apTomo.publish(q) return modeldata
def insertTiltAlignment(alignerdata,imagedata,number,result,center=None): if not center: imgshape = imagedata['image'].shape center = {'x':imgshape[1]/2,'y':imgshape[0]/2} q = appiondata.ApProtomoAlignmentData() q['aligner'] = alignerdata q['image'] = imagedata q['number'] = number q['rotation'] = result['rotation'] q['shift'] = {'x':result['x'] - center['x'], 'y':result['y'] - center['y']} aligndata = apTomo.publish(q) return aligndata
def insertTiltAlignment(alignerdata, imagedata, number, result, center=None): if not center: imgshape = imagedata['image'].shape center = {'x': imgshape[1] / 2, 'y': imgshape[0] / 2} q = appiondata.ApProtomoAlignmentData() q['aligner'] = alignerdata q['image'] = imagedata q['number'] = number q['rotation'] = result['rotation'] q['shift'] = { 'x': result['x'] - center['x'], 'y': result['y'] - center['y'] } aligndata = apTomo.publish(q) return aligndata
def insertAlignIteration(alignrundata, protomodata, params, refinedict,refimagedata): # protmoalign refinement cycle parameters refineparamsq = appiondata.ApProtomoRefinementParamsData() refineparamsq['protomo'] = protomodata refineparamsq['cycle'] = params['cycle'] refineparamsq['alismp'] = refinedict['alismp'] refineparamsq['alibox'] = {'x':refinedict['alibox_x'],'y':refinedict['alibox_y']} refineparamsq['cormod'] = refinedict['cormod'] refineparamsq['imgref'] = refinedict['imgref'] refineparamsq['reference'] = refimagedata refineparamsdata = apTomo.publish(refineparamsq) # good cycle used for reset tlt params if params['goodcycle'] is None: goodrefineparamsdata = None else: goodq = appiondata.ApProtomoRefinementParamsData(protomo=protomodata,cycle=params['goodcycle']) results = goodq.query(results=1) if results: goodrefineparamsdata = results[0] else: goodrefineparamsdata = None # protomoaligner parameters alignerdata = apTomo.insertAlignerParams(alignrundata,params,protomodata,refineparamsdata,goodrefineparamsdata,refimagedata) return alignerdata
def insertProtomoParams(seriesname): # general protmo parameters protomoq = appiondata.ApProtomoParamsData() protomoq['series_name'] = seriesname protomodata = apTomo.publish(protomoq) return protomodata