Esempio n. 1
0
    def plot( self, xylog = 0, domainMin = None, domainMax = None, rangeMin = None , rangeMax = None, title = '' ) :

        import subprocess, os
        from fudge.core.utilities import fudgeFileMisc
        from fudge.vis.gnuplot import plotbase

        def getUnitlessNumber( value, unit, default ) :

            if( value is None ) : return( default )
            if( not( isinstance( value, PQU.PQU ) ) ) : value = PQU.PQU( value )
            return( value.getValueAs( unit ) )

        if( self.axes is None ) :
            xUnit, yUnit = '', ''
            xLabel, yLabel = '', ''
        else :
            xUnit = self.getAxisUnitSafely( xAxisIndex )
            yUnit = self.getAxisUnitSafely( yAxisIndex )
            xLabel = self.axes[xAxisIndex].plotLabel( )
            yLabel = self.axes[yAxisIndex].plotLabel( )

        domainMin = getUnitlessNumber( domainMin, xUnit, self.domainMin )
        domainMax = getUnitlessNumber( domainMax, xUnit, self.domainMax )
        rangeMin = getUnitlessNumber( rangeMin, yUnit, self.rangeMin )
        rangeMax = getUnitlessNumber( rangeMax, yUnit, self.rangeMax )

        dt = plotbase.parsePlotOptions( domainMin, domainMax, rangeMin, rangeMax, xLabel, yLabel, title )
        f = fudgeFileMisc.fudgeTempFile( )
        f.write( self.toString( ) )
        f.close( )
        p = os.path.join( os.path.realpath( __file__ ).split( '/xData' )[0], "fudge", "vis", "gnuplot", "endl2dplot.py" )
        args = [ "python", p, 'xylog', str( xylog ) ] + dt + [ f.getName( ) ]
        subprocess.Popen( args )
Esempio n. 2
0
    def plot(self,
             xMin=None,
             xMax=None,
             yMin=None,
             yMax=None,
             xylog=0,
             xLabel=None,
             yLabel=None,
             title=None,
             style="lines"):
        """Plots the fluxes

xylog meanings::
    xylog   plot-type
   -----------------------
      0     linear-linear
      1     log-linear
      2     linear-log
      3     log-log"""

        if (xLabel == None): xLabel = 'Energy (MeV)'
        if (yLabel == None): yLabel = 'A. U.'
        dt = plotbase.parsePlotOptions(xMin, xMax, yMin, yMax, xLabel, yLabel,
                                       title)
        f = fudgeFileMisc.fudgeTempFile()
        for lGroup in self.EF_l:
            for p in lGroup:
                f.write('   '.join(map(str, p)) + '\n')
            f.write('\n')
        f.close()
        p = os.path.join(
            __file__.split('fudge/processing/')[0], "fudge", "vis", "gnuplot",
            "endl2dplot.py")
        s = ['python', p, 'xylog', str(xylog)] + dt + [f.getName()]
        subprocessing.spawn(s)
Esempio n. 3
0
    def plot(self,
             xMin=None,
             xMax=None,
             yMin=None,
             yMax=None,
             xylog=0,
             xLabel=None,
             yLabel=None,
             title=None,
             style="lines"):
        """Plots the group boundaries.

xylog meanings::
    xylog   plot-type
   -----------------------
      0     linear-linear
      1     log-linear
      2     linear-log
      3     log-log"""

        if (xLabel is None): xLabel = 'Energy (MeV)'
        if (yLabel is None): yLabel = 'A. U.'
        dt = plotbase.parsePlotOptions(xMin, xMax, yMin, yMax, xLabel, yLabel,
                                       title)
        f = fudgeFileMisc.fudgeTempFile()
        for p in self.gb:
            f.write("%15.7e 0.1\n%15.7e 10.\n\n" % (p, p))
        f.close()
        p = os.path.join(
            __file__.split('fudge/processing/')[0], "fudge", "vis", "gnuplot",
            "endl2dplot.py")
        s = ['python', p, 'xylog', str(xylog)] + dt + [f.getName()]
        subprocessing.spawn(s)
Esempio n. 4
0
    def plot(self,
             xMin=None,
             xMax=None,
             yMin=None,
             yMax=None,
             zMin=None,
             zMax=None,
             xyzlog=0,
             xLabel=None,
             yLabel=None,
             zLabel=None,
             title=None,
             xrot=None,
             zrot=None):
        """
        Plots the data.

        xyzlog values and meaning::

            xyzlog   plot-type for x-y-z axis
           -----------------------------------
              0     linear-linear-linear
              1     log-linear-linear
              2     linear-log-linear
              3     log-log-linear
              4     linear-linear-log
              5     log-linear-log
              6     linear-log-log
              7     log-log-log
        """

        if (xLabel == None) and (self.xLabel != None): xLabel = self.xLabel
        if (yLabel == None) and (self.yLabel != None): yLabel = self.yLabel
        if (zLabel == None) and (self.zLabel != None): zLabel = self.zLabel
        dt = plotbase.parsePlotOptions( xMin, xMax, yMin, yMax, xLabel, yLabel, title, zMin = zMin, zMax = zMax, zLabel = zLabel, \
            xrot = xrot, zrot = zrot )
        f = fudgeFileMisc.fudgeTempFile()
        f.write(endl3dmath.__repr__(self))
        f.close()
        p = os.path.join(
            __file__.split('fudge/legacy/')[0], "fudge", "vis", "gnuplot",
            "endl3dplot.py")
        s = ['python', p, 'xyzlog', str(xyzlog)] + dt + [f.getName()]
        subprocessing.spawn(s)
Esempio n. 5
0
    def plot(self,
             xMin=None,
             xMax=None,
             yMin=None,
             yMax=None,
             xylog=0,
             xLabel=None,
             yLabel=None,
             title=None):
        """
        This routine is like qplot (quick plot) except it spawns an interactive plot.  qplot is faster while plot is more flexible.

        ===== =============
        xylog   plot-type
        ===== =============
        0     linear-linear
        1     log-linear
        2     linear-log
        3     log-log
        ===== =============
        """

        if (xLabel is None): xLabel = 'indice'
        if (yLabel is None): yLabel = self.yLabel
        dt = plotbase.parsePlotOptions(xMin, xMax, yMin, yMax, xLabel, yLabel,
                                       title)
        f = fudgeFileMisc.fudgeTempFile()
        i = 0
        for v in self.data:
            f.write("%d %14.8e\n" % (i, v))
            i += 1
        f.close()
        p = os.path.join(
            __file__.split('/fudge/core/')[0], "fudge", "vis", "gnuplot",
            "endl2dplot.py")
        s = ['python', p, 'xylog', str(xylog)] + dt + [f.getName()]
        subprocessing.spawn(s)
Esempio n. 6
0
    def plot( self, xMin = None, xMax = None, yMin = None, yMax = None, zMin = None, zMax = None, xyzlog = 0, \
        tLabel = None, xLabel = None, yLabel = None, zLabel = None, title = None, tScaleLabel = None, \
        xrot = None, zrot = None, style = None ) :                        # class endl4dmath
        """
        Plots the data.

        xyzlog values and meaning are ::

            xyzlog   plot-type for x-y-z axis
           -----------------------------------
              0     linear-linear-linear
              1     log-linear-linear
              2     linear-log-linear
              3     log-log-linear
              4     linear-linear-log
              5     log-linear-log
              6     linear-log-log
              7     log-log-log
        """

        if (tLabel is None) and (self.tLabel is not None): tLabel = self.tLabel
        if (xLabel is None) and (self.xLabel is not None): xLabel = self.xLabel
        if (yLabel is None) and (self.yLabel is not None): yLabel = self.yLabel
        if (zLabel is None) and (self.zLabel is not None): zLabel = self.zLabel

        dt = plotbase.parsePlotOptions( xMin, xMax, yMin, yMax, xLabel, yLabel, title, zMin = zMin, zMax = zMax, \
            zLabel = zLabel, tLabel = tLabel, tScaleLabel = tScaleLabel, xrot = xrot, zrot = zrot, style = style )
        f = fudgeFileMisc.fudgeTempFile()
        format = fudgemisc.getFormat(self)
        f.write(endl4dmath.toString(self, format=format))
        f.close()
        p = os.path.join(
            __file__.split('/fudge/legacy/')[0], "fudge", "vis", "gnuplot",
            "endl4dplot.py")
        s = ['python', p, 'xyzlog', str(xyzlog)] + dt + [f.getName()]
        subprocessing.spawn(s)