Skip to Main Content
Spotfire Ideas Portal

Support of interaction between TERR and Python

Sometimes we need to call Python from TERR scripts, and vice versa.

To accomplish this, at least below functions are required;

1) Get path of currently configured Python executable in TERR .

or

2) Get path and other information of TERR in Python

It is appreciated these functions will be implemented in the future version.

  • Attach files
      Drop here to upload
    • Admin
      Niklas Amberntsson
      Reply
      |
      Apr 28, 2020

      Many thanks Junhong.

    • Guest
      Reply
      |
      Apr 23, 2020

      Here is a use case of call Python from TERR.

      umap package provides user an optional calculation method by calling python package "umap-learn".

      To call python package from TERR, I need get Python executable's path and set it in "use_python" function since bundled Python is not a system installation.

      ---------

      library(umap)

      library(reticulate)

      use_python("C:/Program Files (x86)/TIBCO/Spotfire/10.8.0/Modules/Python Interpreter_3.7.5.0/python")

      custom.settings <- umap.defaults

      custom.settings$n_components <- nComponents

      custom.settings$n_neighbors <- nNeighbors

      custom.settings$min_dist <- minDist

      custom.settings$metric <- metric

      umapModel = umap(trainTable,custom.settings,method="umap-learn")

      #umap will utilize

      umapResult=umapModel$layout

      colnames(umapResult)=paste("umap_",1:nComponents,sep="")

      ------

    • Admin
      Niklas Amberntsson
      Reply
      |
      Apr 23, 2020

      Hi Junhong, many thanks for contributing. Would it be possible to describe the use cases you see for calling Python from TERR, and vice versa?