コード例 #1
0
ファイル: scatt_test2.py プロジェクト: sebajor/ccat
 def plot_data(self, *args):
     #ipdb.set_trace()
     color_pts = self.colormap.map(args[0][1])
     brush = [QtGui.QBrush(QtGui.QColor(*color_pts))]
     self.scatter.addPoints(x=[args[0][0][0]],
                            y=[args[0][0][1]],
                            brush=brush)
コード例 #2
0
 def plot_data(self, *args):
     #ipdb.set_trace()
     color_pts = self.colormap.map(args[0][1][0])
     brush = QtGui.QBrush(QtGui.QColor(*color_pts))
     self.brushes[args[0][1][1] % self.n_points] = brush
     self.pos[args[0][1][1] % self.n_points, 0] = args[0][0][0]
     self.pos[args[0][1][1] % self.n_points, 1] = args[0][0][1]
     #self.scatter.addPoints(x=self.x_pos, y=self.y_pos, brush=self.brushes)
     self.scatter.setData(pos=self.pos, brush=self.brushes)
コード例 #3
0
 def __init__(self, parent, myView=[]):
     QtGui.QGraphicsScene.__init__(self, parent)
     self.myView = myView
     # Some items in scene
     self.txt = self.addSimpleText("///////")
     self.txt.setPos(2, -20)
     self.txt.setScale(2)
     self.txt.setBrush(QtGui.QBrush(QtCore.Qt.green))
     self.addRect(0, 16, 20, 20, pen=QtGui.QPen(QtCore.Qt.blue))
     self.addRect(10, 60, 32, 8, pen=QtGui.QPen(QtCore.Qt.red))
     self.addRect(30, 16, 20, 20, pen=QtGui.QPen(QtCore.Qt.blue))
     self.N = 0
コード例 #4
0
    def __init__(self, *args, **kwargs):
        super(map_sim, self).__init__()
        self.n_points = 100  #with 1500 could see the whole orbit

        self.counter = 0
        self.pos = np.random.random([self.n_points, 2]) + 20
        values = np.zeros(self.n_points)

        ##This is simulation orbit
        undersamp = 5
        self.x_pos = np.loadtxt('x_val')[::undersamp]
        self.y_pos = np.loadtxt('y_val')[::undersamp]
        ##

        self.win = pg.GraphicsWindow()
        self.win.setWindowTitle('scatt anim')
        self.win.show()
        p = self.win.addPlot()
        p.disableAutoRange()
        p.setRange(xRange=[-10, 10], yRange=[-10, 10])
        p.showGrid(x=True, y=True)
        self.scatter = pg.ScatterPlotItem()
        p.addItem(self.scatter)
        self.colormap = self.mapping_init(0, 100)

        aux = self.colormap.map(values)
        self.brushes = [
            QtGui.QBrush(QtGui.QColor(*aux[i, :].tolist()))
            for i in range(aux.shape[0])
        ]
        #ipdb.set_trace()
        #self.values = [QtGui.QBrush(QtGui.QColor(*aux))]

        self.threadpool = QtCore.QThreadPool(parent=self.win)
        self.threadpool.setMaxThreadCount(1)
        self.update()
コード例 #5
0


    def get_data(self):
        [x,y] = get_pos()  ###simular!!
        [A, B, re, im] = get_vals()     #ver como importarlo..
        pow_diff = 10*(np.log10(A+1)-np.log10(B+1))        
        ang_diff = np.rad2deg(np.arctan2(im, re))
        
        return [[x,y], [pow_diff, ang_diff]]


    def process_data(self, *args)
        
        color_ang = self.color_ang.map(args[1][1])
        brush_ang = [QtGui.QBrush(QtGui.QColor(*color_ang))]
        self.ang.addPoints(x=[args[0][0]], y=[args[0][1]], brush=brush_ang)
        
        color_pow = self.color_pow.map(args[1][0])
        brush_pow = [QtGui.QBrush(QtGui.QColor(*color_pow))]
        self.pow.addPoints(x=[args[0][0]], y=[args[0][1]], brush=brush_pow)
        





##################################
"""
Para correrlo falta hacer
コード例 #6
0
ファイル: dirreader.py プロジェクト: whigg/h5browse
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
#
#

# Code:
"""Read data distributed in a directory structure"""

import os
from pyqtgraph import (QtCore, QtGui)
from pyqtgraph import parametertree as ptree

bgBrush = QtGui.QBrush(QtGui.QColor('lightsteelblue'))


class PathParams(ptree.parameterTypes.GroupParameter):
    def __init__(self, **opts):
        opts['type'] = 'group'
        opts['addText'] = "Add rule"
        opts['addList'] = ['timestamp', 'regex', 'string']
        super(PathParams, self).__init__(**opts)

    def addNew(self, typ):
        val = {
            'timestamp': 'YYYY-mm-dd HH:MM:SS',
            'regex': '.*',
            'string': '_'
        }[typ]