File: PYMOL-3260.py

package info (click to toggle)
pymol 3.1.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 74,084 kB
  • sloc: cpp: 482,660; python: 89,328; ansic: 29,512; javascript: 6,792; sh: 84; makefile: 25
file content (37 lines) | stat: -rw-r--r-- 1,022 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
'''
CCP4/MRC ORIGIN
'''

from chempy import cpv
from pymol import cmd, testing

EDGELENGTHS = (5.85, 5.85, 5.85)
ORIGINS = {
    # only SKWTRN
    "h2o-elf-skwtrn.ccp4": (1.2, 3.4, 5.6),
    # NSTART and SKWTRN, additive
    "h2o-elf-nstart-skwtrn.ccp4": (1.8, 3.85, 6.35),
    # NSTART and ORIGIN, not additive (NSTART is ignored)
    "h2o-elf-nstart-origin.mrc": (1.2, 3.4, 5.6),
    # only NSTART (not ignored)
    "h2o-elf-nstart.ccp4": (0.6, 0.45, 0.75),
}

@testing.requires_version('2.4')
class Test3260(testing.PyMOLTestCase):

    @testing.foreach(*ORIGINS)
    def test(self, filename):
        cmd.load(self.datafile(filename), 'map')

        ori = ORIGINS[filename]
        ext = [ori, cpv.add(ori, EDGELENGTHS)]

        self.assertArrayEqual(cmd.get_extent('map'), ext, delta=1e-3)

        with testing.mktemp('.map') as filename:
            cmd.save(filename, 'map')
            cmd.delete('*')
            cmd.load(filename, 'map')

        self.assertArrayEqual(cmd.get_extent('map'), ext, delta=1e-3)