From 4bf2e0a38201a5eea87f3e1a1d75c0a45a247724 Mon Sep 17 00:00:00 2001 From: Niklaus Johner <nij2003@med.cornell.edu> Date: Fri, 18 May 2012 12:21:14 -0400 Subject: [PATCH] Added functions to get th best fit line and best fit plane to an EntityView in the structure_analysis.py python module --- modules/mol/alg/pymod/structure_analysis.py | 29 +++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/modules/mol/alg/pymod/structure_analysis.py b/modules/mol/alg/pymod/structure_analysis.py index 662ed914d..761a30807 100644 --- a/modules/mol/alg/pymod/structure_analysis.py +++ b/modules/mol/alg/pymod/structure_analysis.py @@ -84,3 +84,32 @@ def GetAlphaHelixContent(sele1): f=GetFrameFromEntity(eh) return f.GetAlphaHelixContent(sele1) + +def CalculateBestFitLine(sele1): + """ + This function calculates the best fit line to the atoms in sele1. + Input: + sele1 : EntityView + It returns a geom::Line3 + """ + if not sele1.IsValid(): + print 'invalid view' + return + eh=sele1.GetHandle() + f=GetFrameFromEntity(eh) + return f.GetODRLine(sele1) + +def CalculateBestFitPlane(sele1): + """ + This function calculates the best fit plane to the atoms in sele1. + Input: + sele1 : EntityView + It returns a geom::Plane + """ + if not sele1.IsValid(): + print 'invalid view' + return + eh=sele1.GetHandle() + f=GetFrameFromEntity(eh) + return f.GetODRPlane(sele1) + -- GitLab