def test_colorscale(file_3nob): m = molecule.load("mae", file_3nob) r = molrep.addrep(color="User2", selection="lipid", molid=m) assert molrep.get_scaleminmax(m, r) == pytest.approx((0., 0.)) with pytest.raises(ValueError): molrep.get_scaleminmax(m + 1, 0) with pytest.raises(ValueError): molrep.get_scaleminmax(m, r + 1) molrep.set_scaleminmax(molid=m, rep=r, scale_min=-10., scale_max=200.) assert molrep.get_scaleminmax(m, r) == pytest.approx((-10., 200.)) with pytest.raises(ValueError): molrep.set_scaleminmax(m + 1, 0, 0, 12) with pytest.raises(ValueError): molrep.set_scaleminmax(m, r + 1, 12, 13) with pytest.raises(RuntimeError): molrep.set_scaleminmax(m, r, scale_min=100, scale_max=0) # Test reset molrep.reset_scaleminmax(molid=m, rep=r) assert molrep.get_scaleminmax(m, r) == pytest.approx((-10., 200.)) with pytest.raises(ValueError): molrep.reset_scaleminmax(m + 1, 0) with pytest.raises(ValueError): molrep.reset_scaleminmax(m, r + 1) # Test changing with modrep assert molrep.modrep(m, r, scaleminmax=(2.0, 3.0)) assert molrep.get_scaleminmax(m, r) == pytest.approx((2.0, 3.0)) assert molrep.modrep(m, r, scaleminmax=[-10., -5.]) assert molrep.get_scaleminmax(m, r) == pytest.approx((-10., -5.)) molecule.delete(m)
def test_colorscale(file_3nob): m = molecule.load("mae", file_3nob) r = molrep.addrep(color="User2", selection="lipid", molid=m) assert molrep.get_scaleminmax(m, r) == pytest.approx((0., 0.)) with pytest.raises(ValueError): molrep.get_scaleminmax(m+1, 0) with pytest.raises(ValueError): molrep.get_scaleminmax(m, r+1) molrep.set_scaleminmax(molid=m, rep=r, scale_min=-10., scale_max=200.) assert molrep.get_scaleminmax(m, r) == pytest.approx((-10., 200.)) with pytest.raises(ValueError): molrep.set_scaleminmax(m+1, 0, 0, 12) with pytest.raises(ValueError): molrep.set_scaleminmax(m, r+1, 12, 13) with pytest.raises(RuntimeError): molrep.set_scaleminmax(m, r, scale_min=100, scale_max=0) # Test reset molrep.reset_scaleminmax(molid=m, rep=r) assert molrep.get_scaleminmax(m, r) == pytest.approx((-10., 200.)) with pytest.raises(ValueError): molrep.reset_scaleminmax(m+1, 0) with pytest.raises(ValueError): molrep.reset_scaleminmax(m, r+1) # Test changing with modrep assert molrep.modrep(m, r, scaleminmax=(2.0, 3.0)) assert molrep.get_scaleminmax(m, r) == pytest.approx((2.0, 3.0)) assert molrep.modrep(m, r, scaleminmax=[-10., -5.]) assert molrep.get_scaleminmax(m, r) == pytest.approx((-10., -5.)) molecule.delete(m)
def changeMaterial(self, material): """ Change the material for the rep to 'material'.""" for id,name in self.molecules.items(): repid = molrep.repindex(id, name) if not molrep.modrep(id, repid, material=material): raise ValueError("Invalid material'%s'" % material) self.material = str(material)
def changeSelection(self, selection): """ Change the atom selection of the rep to 'selection'.""" for id,name in self.molecules.items(): repid = molrep.repindex(id, name) if not molrep.modrep(id, repid, sel=selection): raise ValueError("Invalid selection '%s'" % selection) self.selection = str(selection)
def changeColor(self, color): """ Change the coloring method the rep to 'color'.""" for id,name in self.molecules.items(): repid = molrep.repindex(id, name) if not molrep.modrep(id, repid, color=color): raise ValueError("Invalid color '%s'" % color) self.color = str(color)
def changeStyle(self, style): """ Change the draw style of the rep to 'style'.""" for id,name in self.molecules.items(): repid = molrep.repindex(id, name) if not molrep.modrep(id, repid, style=style): raise ValueError("Invalid style '%s'" % style) self.style = str(style)
def test_modrep(file_3nob): m = molecule.load("mae", file_3nob) r = molrep.addrep(style="Licorice", color="ResID", selection="noh", material="AOEdgy", molid=m) with pytest.raises(ValueError): molrep.modrep(m + 1, 0) with pytest.raises(ValueError): molrep.modrep(m, r + 1) assert molrep.get_style(m, r) == "Licorice" assert molrep.modrep(m, r, style="Lines") assert molrep.get_style(m, r) == "Lines" assert not molrep.modrep(m, r, style="Invalid") assert molrep.get_style(m, r) == "Lines" assert molrep.modrep(m, r, color="ColorID 0", selection="resname TIP3", material="Transparent") assert molrep.get_selection(m, r) == "resname TIP3" assert molrep.get_material(m, r) == "Transparent" assert molrep.get_color(m, r) == "ColorID 0" molecule.delete(m)
def test_modrep(file_3nob): m = molecule.load("mae", file_3nob) r = molrep.addrep(style="Licorice", color="ResID", selection="noh", material="AOEdgy", molid=m) with pytest.raises(ValueError): molrep.modrep(m+1, 0) with pytest.raises(ValueError): molrep.modrep(m, r+1) assert molrep.get_style(m, r) == "Licorice" assert molrep.modrep(m, r, style="Lines") assert molrep.get_style(m, r) == "Lines" assert not molrep.modrep(m, r, style="Invalid") assert molrep.get_style(m, r) == "Lines" assert molrep.modrep(m, r, color="ColorID 0", selection="resname TIP3", material="Transparent") assert molrep.get_selection(m, r) == "resname TIP3" assert molrep.get_material(m, r) == "Transparent" assert molrep.get_color(m, r) == "ColorID 0" molecule.delete(m)