コード例 #1
0
ファイル: test.py プロジェクト: cjwiggins/MagnetoShim
def harmplotterGNU(bw,harms,mode="NONE"):
    """GNUPlot some harmonics"""
    import Gnuplot, Gnuplot.funcutils    
    g=Gnuplot.Gnuplot()
    g.title('Input Data')
    y=array(SHT.azimuthal_measurement_points(bw))
    x=array(SHT.declination_measurement_points(bw))
    g('set parametric')
    g('set xrange [0:pi]')
    g('set yrange [0:2*pi]')
    g('set data style lines')
    g('set hidden3d')
  #  g('set pm3d')
    g('set contour base')
    g.xlabel('theta (declination)')
    g.ylabel('phi (azimuth)')
    class funcboy:
        def __init__(self,harms,mode="NONE"):
            self.harms=harms
            self.mode=mode
        def val(self,theta,phi):
            d,rdata=SHT.harmonizer([(theta,phi)],self.harms,mode=self.mode)
            result=float(rdata[0])
            return result

      
    f=funcboy(harms,mode=mode)
    g.splot(Gnuplot.funcutils.compute_GridData(x,y,f.val))#GridData(m,x,y))
    raw_input('Please press return to continue...\n')