~ubuntu-branches/ubuntu/natty/python-cogent/natty

« back to all changes in this revision

Viewing changes to tests/test_struct/test_dihedral.py

  • Committer: Bazaar Package Importer
  • Author(s): Steffen Moeller
  • Date: 2010-12-04 22:30:35 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20101204223035-j11kinhcrrdgg2p2
Tags: 1.5-1
* Bumped standard to 3.9.1, no changes required.
* New upstream version.
  - major additions to Cookbook
  - added AlleleFreqs attribute to ensembl Variation objects.
  - added getGeneByStableId method to genome objects.
  - added Introns attribute to Transcript objects and an Intron class.
  - added Mann-Whitney test and a Monte-Carlo version
  - exploratory and confirmatory period estimation techniques (suitable for
    symbolic and continuous data)
  - Information theoretic measures (AIC and BIC) added
  - drawing of trees with collapsed nodes
  - progress display indicator support for terminal and GUI apps
  - added parser for illumina HiSeq2000 and GAiix sequence files as 
    cogent.parse.illumina_sequence.MinimalIlluminaSequenceParser.
  - added parser to FASTQ files, one of the output options for illumina's
    workflow, also added cookbook demo.
  - added functionality for parsing of SFF files without the Roche tools in
    cogent.parse.binary_sff
  - thousand fold performance improvement to nmds
  - >10-fold performance improvements to some Table operations

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
__contributors__ = ["Kristian Rother", "Sandra Smit"]
13
13
__credits__ = ["Janusz Bujnicki", "Nils Goldmann"]
14
14
__license__ = "GPL"
15
 
__version__ = "1.4.1"
 
15
__version__ = "1.5.0"
16
16
__maintainer__ = "Kristian Rother"
17
17
__email__ = "krother@rubor.de"
18
18
__status__ = "Production"
19
19
 
20
20
from cogent.util.unit_test import main, TestCase
21
21
from cogent.struct.dihedral import dihedral, scalar, angle, \
22
 
    DihedralGeometryError, AngleGeometryError
 
22
    calc_angle, DihedralGeometryError, AngleGeometryError
23
23
from random import random
24
24
from numpy import array
25
25
from math import pi, cos, sin
82
82
        self.assertAlmostEqual(angle(array([100000000.0,0,1]),\
83
83
            array([1,0,0])),0.0)
84
84
 
 
85
    def test_calc_angle_simple(self):
 
86
        """Tests the calc_angle function for one- and two-dimensional vectors."""
 
87
        # test two-dimensional vectors (not arrays!)
 
88
        self.assertEqual(calc_angle(array([0,1]),array([0,0]),array([1,0])),0.5*pi)
 
89
        self.assertEqual(calc_angle(array([5,0]),array([0,0]),array([13,0])),0.0)
 
90
        self.assertEqual(calc_angle(array([4,3]),array([2,0]),array([28,39])),0.0)
 
91
        self.assertEqual(calc_angle(array([2,-13]),array([0,-10]),array([-3,-12])),0.5*pi)        
 
92
        self.assertEqual(calc_angle(array([-5,0]),array([0,0]),array([13,0])),pi)
 
93
        # test three-dimensional vectors (not arrays!)        
 
94
        self.assertEqual(calc_angle(array([0,0,-1]),array([0,0,0]),array([0,0,1])),pi)
 
95
        self.assertEqual(calc_angle(array([0,15,-1]),array([0,0,0]),array([0,-15,1])),pi)
 
96
        self.assertEqual(calc_angle(array([0,10,7]),array([0,10,0]),array([14,24,0])),0.5*pi)
 
97
        self.assertEqual(calc_angle(array([0,7,7]),array([0,0,0]),array([0,14,14])),0.0)
 
98
        self.assertAlmostEqual(calc_angle(array([100000000.0,0,1]),\
 
99
            array([0,0,0]),array([1,0,0])),0.0)
 
100
 
 
101
 
 
102
 
85
103
    ##    def make_scipy_angles(self):
86
104
    ##        """Generates the test data given below. Was commented out 
87
105
    ##        for getting rid of the library dependency"""