Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Launch IMASViz tool as explained in section 1. Getting Started
  2. From the main GUI, select the Scripting tab. An IMASViz embedded Python3 Shell will open.
    Image Removed
    Image Added


  3. In Scripting window write the following code:

    Code Block
    api = Browser_API()
    datasourceFactory = DataSourceFactory()
    datasource = datasourceFactory.create(52682,0,'g2lfleur','test','NATIVE')
    Warning

    When typing api = Browser_API(), do not forget the parenthesis at the end of the command! No error will be displayed, however, other following commands (using api object) will fail!

    Tip
    While editing code in the Script window, you can recall a command by pressing CTRL button + UP ARROW once or several times to get previously edited commands.


    By running this code a data source object, attached to the shot 52682 in the test database of user g2lfleur, will be created.

     Image RemovedImage Added

5.2 Loading IDS data

...

  1. First, IMAS_VIZ needs to build a 'view' (a wx.TreeCtrl component) that will be later populated with magnetics nodes.
    This is done by running the following code:

    Code Block
    view = api.CreateDataTree(datasource)
  2. The view is displayed by running the following code:

    Code Block
    view.Show()


    Image RemovedImage Added

     

  3. To load the magnetics IDS data, run the following code:

    Code Block
    api.LoadIDSData(view, 'magnetics', occurrence=0)


    The view is updated with the nodes of the magnetics IDS.
    Image Removed
    Image Added

    At the end of this session, the scripting window should look something like this:
    Image Removed
    Image Added

5.3 Plotting multiple FLT_1D array nodes

...

  1. Run the following code

    Code Block
    paths = []
    for i in range(0,6):
       paths.append('magnetics/flux_loop(' + str(i) + ')/flux')
    api.SelectSignals(view)
  2. Check if the wanted nodes have been selected (selected nodes are red) by expanding the magnetics node in the view
    Image Removed
    Image Added

    Info
    Selecting nodes for the first time without calling LoadIDSData() previously will load the IDS data (occurrence 0 by default)

...

  1. Run the following code:

    Code Block
    api.PlotSelectedSignals(view)


    You should get the image below.


    Image RemovedImage Added

5.3.3 Plotting selected FLT_1D arrays nodes to multiplot frame

...

An image similar to the one below should be displayed.

Image AddedImage Removed

5.3.4 Applying a multiplot configuration to a shot

...

  1. Create a multiplot configuration using the GUI (see tutorial, 5. Scripting (advanced)3. Plotting 1D arrays) with the name 
    Magnetics_flux_loop_bpol_probes

  2. Run the following code:

    Code Block
    api = Browser_API()
    datasourceFactory = DataSourceFactory()
    datasource = datasourceFactory.create(52344,0,'g2lfleur','test','NATIVE')
    view = api.CreateDataTree(datasource)
    multiPlotConfiguration = api.GetMultiplotConfigurationPath('Magnetics_flux_loop_bpol_probes')
    api.ApplyMultiPlotConfiguration(view, multiPlotConfiguration )


    An image similar to the one below should be displayed.
    Image Removed
    Image Added

 

5.3.5 Comparing FLT_1D arrays of 2 different shots

...

  1. Run the following code:

    Code Block
    api = Browser_API()
    datasourceFactory = DataSourceFactory()
     
    #Create datasource for shot 52344
    datasource_52344 = datasourceFactory.create(52344,0,'g2lfleur','test','NATIVE')
     
    #Create datasource for shot 52682
    datasource_52682 = datasourceFactory.create(52682,0,'g2lfleur','test','NATIVE')
     
    #Create the view for shot 52344
    view_52344 = api.CreateDataTree(datasource_52344)
     
    #Create the view for shot 52682
    view_52682 = api.CreateDataTree(datasource_52682)
     
    #Selection path (paths is Python list)
    paths = ['magnetics/flux_loop(0)/flux']
     
    #Selection of the nodes
    api.SelectSignals(view_52344,paths)
    api.SelectSignals(view_52682,paths)
     
    api.PlotSelectedSignals(view_52344)
    figureKeys = api.GetFiguresKeys()
    api.PlotSelectedSignals(view_52682,figureKeys[0])
    
    


    An image similar to the one below should be displayed.

    Image RemovedImage Added

5.4 Executing the user-made script outside IMASViz

...