Skip to content

plotShot.m

Basic Information

  SYNTAX:  [ shot_data, fig_handles, conn]=...
        plotShot(snlist, fig_setup, tokOrServer, figs_layout_spec, tightx, shot_data, conn, slice_options)

  PURPOSE:  For quick plotting of experimental data, with options for more
   post-processing as needed.

  INPUTS:
   snlist = array of shot numbers to plot data from, or a single number if
            only one shot is desired.
            (Required input)

   fig_setup = a cellarray defining a figure or set of figures. For
               many examples, or quick layouts to start with, see
               bookmarks.m.
               (Required input)

               Basic spec for a signal definition (string!) is a string
               pointname followed by a series of deliminators before added
               options. Deliminators are nedded before adding these
               argurments, but if leaving default do not supply any
               deliminators not being used.

                   Minimum: 'ptname'
                   Common: 'ptname:tree'

                   Full spec:
                   'ptname[chord]:tree#pltargs$label*calib@postprocfunc(t0,t1)&dependency1,dep2units?Description'

                   * Note that everything but the ptname is optional!

                   Details on each part of the spec ():

                   ptname = pointname of desired signal
                   [chord] = optional designation of chord location
                   :tree = ptdata or a mdsplus tree where the data
                           resides. If not set, first looks for ptdata,
                           then searches for a tree where it finds the
                           pointname. If in EFIT trees, the order of
                           preference for EFIT to use is set per-tokamak
                           in get_defaults_for_tok.m. For D3D, it is
                           EFIT01,EFITRT1...
                           *Note: if the user is defining a new signal
                           that is constructed from multiple other signals
                           via a post-processing function, then tree MUST
                           be set to 'D' (which is to stand for derived).
                   #pltargs = comma deliminated set of plotting arguments
                              to be passed to the plot function. Do not
                              use quotation marks. For example, to set the
                              line-width to 2, you would put this in your
                              signal spec: 'ptname#LineWidth,2'
                   $label = a label to use for plotting y-axis and legend.
                            using standard matlab stying. Example: 'ipsip$I_p'
                   *calib = a multiplicative calibration factor to apply
                               *instead* of the one stored in mdsplus
                   @postprocfunc = a post-processing function to apply to
                                   the signal. This function must expect
                                   the appropriate inputs and give the
                                   right outputs. See all of provided
                                   functions in
                                   GAplotting/derivedd_data_funcs for
                                   examples. Many useful functions already
                                   exist. Of particular note is d_math.
                   (t0,t1) = subwindow of time to include data from, if
                             not desired to use the full time series
                   &dependency1,dep2,dep3... = a list of other ptnames
                                               that must be loaded as well
                                               before applying the
                                               post-processing function to
                                               this signal.
                   units = units for labelling in the plots. If not
                            supplied, then first mdsplus will be checked
                            to see if units are associated with the
                            pointname. Then, get_defaults_for_tok.m will
                            be used to check for noted units for
                            pointnames listed there.
                   ?Description = optional description of the signal,
                                  stored in the output data structure

               Separate subplots into sub-cell arrays:
               {{subplot1}, {subplot2}, {subplot3}}


   tokOrServer = the name of a tokamak or server address collect data
                 from. For recognized tokamak names, the server address is
                 known and applied (see get_defaults_for_tok.m).
                 (Default: d3d)

                 Tokamaks recognized: d3d, kstar, east, eastga,
                                       mastu, nstxu, jet
                       *eastga = GA local server of subset of EAST data.

   figs_layout_spec = [# rows, # columns] for the layout of subplots in
                       the output figures. If only one number is
                       specified, it is assumed to be the number of rows,
                       and # columns assumed to be 1. Set just an empty
                       array like [] to auto-scale the # rows and #
                       columns to fit all of the subplots defined in a
                       single plot.
                       (Default: [])

                       *If the number of subplots define din fig_setup is
                       larger than the #rows * # plots, then multiple
                       figures will be generated, following the defined
                       order of subplots defined in fit_setup, and each
                       with [# rows, # columns].

   tightx = Set to a true value if it is desired to have plots in the same
            column be closer together vertically, hiding the x-axis labels
            for all but the bottom plot. The x-axes will be linked so that
            all of the x-axes have the same scales, and change together.
            Especially useful for figures of several time-series signals.

   shot_data = a structure of the type produced by pullShotData.m. If
               provided, then before pulling data from servers this
               structure will be first checked to see if the data already
               exists locally. This is the same type as output by this
               function. This is to save time from repeatedly downloading
               data when unnecessary. If set to NaN, then just load all of
               the data first.
               (Default: nan = no starting data, just reload all needed)

   conn = an mds connection object as can be obtained from getmdsconn.m,
          which can be used to connect to a remote mds server. Reusing a
          connection save serious time in downloading data, using the
          getmdata.m function instead of getmds.m. Note that a connection
          of this type is also an output - allowing for easy reuse of
          connections to save time. Set to nan to ignore and just open a
          new connection.
          (Default: nan = open a new connection)

   slice_options = If it is desired to sync all loaded data to a common
                   timebase, then define a structure here of the type
                   expected by getTBase.m. See getTBase.m for how to
                   define this structure if synchronizing timebase is
                   desired. Set to nan to just keep the original timebase
                   of each loaded signal.
                   (Default: nan = keep indivicual, original signal
                             timebases).

  OUTPUT:
   shot_data = a structure of the type produced by pullShotData.m,
               containing all data loaded for plotting. If the user
               supplied a shot_data structure as an input, the
               user-supplied data was used where possible, and any
               additional data was loaded as needed. See pullShotData.m
               for more detailed specification of the structure layout.

   fig_handles = an array of figure handles for each of the figures
                 produced by this function while plotting.

   conn = a reusable mds connection object as can be obtained from
          getmdsconn.m, and the original user-given objust if this
          optional input was provided. See more details in input
          definition above or in getmdsconn.m


  EXAMPLES:

       plotShot(181035,{'ip','kappa:EFIT01','bmspinj'})

       [shot_data,~,conn]=plotShot([181035,181041],{'ipsip','li','sysfpstrip'})
       plotShot([181035,181041],{'ipsip','li','sysfpstrip'},'d3d',[],1,shot_data,conn)

       plotShot(95145,{'ip'},'east')

       plotShot(181035,bookmarks('basic','d3d'),'d3d')

       plotShot(181035,{'ipsip$I_p*1e6A'})
       plotShot(181035,{'ip','gasTot:D@d_math&+gasa,+gasb,+gasc,+gasd,+gase'})

  RESTRICTIONS:

  METHOD:

  WRITTEN BY:  Jayson Barr