示例#1
0
    def testGetVolumeField(self):
        import numpy
        cmd.load(self.datafile('emd_1155.ccp4'), 'map1')
        fieldcopy = cmd.get_volume_field('map1')
        field = cmd.get_volume_field('map1', copy=0)
        self.assertEqual(field.shape, (141, 91, 281))
        self.assertTrue(numpy.allclose(field, fieldcopy))

        # data manipulation with copy=0
        mean1 = field.mean()
        field += 5.0
        mean2 = cmd.get_volume_field('map1', copy=0)[:].mean()
        self.assertAlmostEqual(mean1 + 5.0, mean2, delta=1e-2)
示例#2
0
 def testLoad_cube(self):
     cmd.load(self.datafile('h2o-elf.cube'))
     extent = cmd.get_extent('h2o-elf')
     self.assertArrayEqual(
         extent, [[-0.075, -0.075, -0.075], [5.925, 5.925, 5.925]],
         delta=1e3)
     field = cmd.get_volume_field('h2o-elf', copy=0)
     self.assertEqual(field.shape, (40, 40, 40))
     self.assertAlmostEqual(field.mean(), 0.06915, delta=1e-4)
示例#3
0
 def testLoad_cube(self):
     cmd.load(self.datafile('h2o-elf.cube'))
     extent = cmd.get_extent('h2o-elf')
     self.assertArrayEqual(extent, [
         [  -0.075,  -0.075,  -0.075],
         [   5.925,   5.925,   5.925]], delta=1e3)
     field = cmd.get_volume_field('h2o-elf', copy=0)
     self.assertEqual(field.shape, (40, 40, 40))
     self.assertAlmostEqual(field.mean(), 0.06915, delta=1e-4)
示例#4
0
    def testLoad_map(self, ext, check_extent):
        filename = self.datafile('emd_1155' + ext)
        if not os.path.exists(filename):
            self.skipTest("missing " + filename)

        cmd.load(filename, 'map1')
        field = cmd.get_volume_field('map1', copy=0)
        self.assertEqual(field.shape, (141, 91, 281))

        if check_extent:
            extent = cmd.get_extent('map1')
            self.assertArrayEqual(extent, [[0.0, 0.0, 0.0], [2296.0, 1476.0, 4592.0]], delta=1e-2)
示例#5
0
 def set_isoslider(self, mrc, setvalue=True):
     self.grid = cmd.get_volume_field(mrc)
     isomin = self.grid.min()
     isomax = self.grid.max()
     self.form.label_isomin.setText('%.4f' % isomin)
     self.form.label_isomax.setText('%.4f' % isomax)
     self.form.isoslider.setMinimum(self.iso_to_slider(isomin))
     self.form.isoslider.setMaximum(self.iso_to_slider(isomax))
     self.form.isoslider.setTickInterval(1)
     if setvalue:
         self.form.isoslider.setValue(
             self.iso_to_slider(isomin + (isomax - isomin) / 2.))
     self.form.isoval_edit.setText(str(self.isoslider_value))
示例#6
0
    def testLoad_map(self, ext, check_extent):
        filename = self.datafile('emd_1155' + ext)
        if not os.path.exists(filename):
            self.skipTest("missing " + filename)

        cmd.load(filename, 'map1')
        field = cmd.get_volume_field('map1', copy=0)
        self.assertEqual(field.shape, (141, 91, 281))

        if check_extent:
            extent = cmd.get_extent('map1')
            self.assertArrayEqual(extent,
                                  [[0.0, 0.0, 0.0], [2296.0, 1476.0, 4592.0]],
                                  delta=1e-2)
示例#7
0
 def testCopyMap(self):
     cmd.load(self.datafile('emd_1155.ccp4'), 'map1')
     cmd.copy('map2', 'map1')
     self.assertEqual(cmd.get_symmetry('map1'), cmd.get_symmetry('map2'))
     self.assertArrayEqual(cmd.get_volume_field('map1'), cmd.get_volume_field('map2'))