You are a guest. Restricted access. Read more.
Command disabled: revisions
SCaVis manual

SCaVis IDE

SCaVis screenshot

SCaVis is an environment for scientific computation, data analysis and data visualization designed for scientists, engineers and students. The program incorporates many open-source software packages into a coherent interface using the concept of dynamic scripting It includes many components. First, most obvious, is SCaVis IDE (Integrated development environment), which can be used as a programming powerful editor for desktops running Windows,Linux, OS/2 or any other system which can run Java.

This section describes SCaVis IDE for desktops and any other computers with large screens. If you need a version of SCaVis IDE for small devices with a typical screen size 600×400, you can use an alternative IDE optimised for small screens. In this case, please go to the section working_with_porto.

SCaVis examples

You can get some ideas about the capabilities of SCaVis using SCaVis examples ([Tools]→[Online examples]). Look at this clip that shows YouTube ScaVis online tutorial

The windows for online examples after selecting [Tools]→[Online examples] is shown below:

The examples are created for all supported languages, Java, Jython, Octave/Matlab, BeanShell, JRuby, Groovy. Icones with read “F” shows free examples that does not require ScaVis activation.

You can also look at this link to see what SCaVis can do: SCaVis Jython Examples.

SCaVis structure

Many components of ScaVis are free. But many services (including the full access to this manual) and jar components are only accessible for full members. This diagram shows ScaVis structure, where yellow components show GNU-licensed parts of the program.

If you are non-member, you will see the yellow boxes such as this:

You are not full member and have a limited access to this section. One can unlock this part after becoming a full member.

which protects some information and example codes. Users with the member privileges do not see such yellow boxes.

Jython scripts in the SCaVis

Use SCaVis IDE in a similar way as any editor. It supports many programming languages: C/C++, JAVA, PHP, FORTRAN and many more. It is also specially designed for editing LaTeX files. It has several unique features, such as:

  • The only Java-based editor with on-fly spell checking
  • The only editor with color syntax highlighting for all classes and methods of ROOT
  • Color syntax highlighting for many programming languages
  • Multiple clipboards
  • Multiple Eclipse-like bookmarks
  • File browser
  • Multi-document support
  • Linux/Unix - like commands cp, mv, rm, cat etc. are supported.
  • Extensive LaTeX support: a structure viewer, build-in Bibtex manager, LatexTools
  • LaTeX equations can be inserted into Jython scripts, mixing articles with Jython code
  • A document structure viewer for fast navigation

Getting started with SCaVis

The script scavis.sh (Linux/UNIX/Mac) or scavis.bat (any Windows) starts the SCaVis IDE from the file jehep.jar, called jeHEP. Run one of these scrips depending on your platform.

Now you have a choice: either to open any Python/Jython file in the editor (main window) using the [File] menu (a file should have an extension py) or type Jython/Python commands interactively (click on JythonShell). For the first approach, you can run a Python/Jython file clicking on the icon 20), in the second approach just type “Enter”.

The easiest way to check your installation and understand what SCaVis actually can do is to run JHPlot examples. Go to [Tools] and then [examples]. Select any Jython script from the categories and run it. You may also open a file and then click on the icon 20) to execute it. The examples are located in “macros/examples” folder of your installations. The number of examples is about 20.

For advanced users, you can access more than 200 examples from a online database. Select [Tools]-[Online examples]. Some examples are marked with red letter “F”, i.e. “free” (GNU licensed) examples. In order to access all online examples, you should activate ScaVis as [Help]-[Activate]. Here you should enter your SCavis user name.

Activation should be done via this link.

Of course one can use the editor to work with Java, NetBeans or even LaTeX files

Updating SCaVis

Users of SCaVis-Pro (professional edition) receive separate updated jar files regularity. The community edition requires re-installation of the entire program. Use [Help]-[Activate] to activate SCaVis-Pro.

Configuration of SCaVis

You may wish to activate on-fly spelling for a particular language. Copy OpenOffice dictionaries to the directory dic of the main SCaVis directory where the jehep.jar file is located. Then go to menu Tools - On-fly spelling and select active dictionary. To activate spelling, press the button Start spelling from the main menu. Note: English dictionary is already included to the downloaded package. Use double-click to replace a wrong word or to view alternative proposals To reload either the File Browser or Jython/Bean shell consoles, one should use the reload buttons located directly on small blue tabs. For bookmarks, the user should click on the right border of the jeHEP editor window. One should see a blue mark there, if the bookmark is set. One can click on it to come back to a specific text location. All preference files are locate in the

$HOME/.jehep

directory (Linux) or

$HOME/jehep.ini

for windows. They are: the user dictionary file, JabRef preference files and other initialisation files

Jython and Bean shell consoles

SCaVis includes two consoles (or shells) to run the BeanShell and Jython commands. Use the help options to learn more about additional features for interactions with the native OS. Both shells contain their own help system. JythonShell and BeanShell can be used to run external programs. Just type a exclamation in front of the program name you want to execute. Here are a few examples:

 !latex <file>  #  will execute latex for the file <file>
 !make          #  will execute make file
 !gv            #  will start gv (for linux/unix) 
 !ls            #  shows the current directory

The user can use the command history (Key: Up and Down), Java and Python completion (Key: Ctrl + Space). It is important to note that there are several predefined variables available for the consoles. They have been exported by the scripts located in the macros/system directory: sysjehep.py (for Jython) sysjehep.bsh (for BeanShell). For example, assume the user is editing an Jython file. The information about this file can be found by typing the following commands the JythonShell:

 print DocName
 print DocDir
 print ClassPath
 print fSep (a file separator)
 print DicDir (a directory with dictionaries)
 print DocMasterName
 print DocMasterNameShort

All these variables are automatically imported by the IDE. The user can also use methods of the Editor class which holds the currently opened document. For example, by typing print Editor.DocDir() one can print the full path to the currently opened document. One can access all public methods of the Editor static class by using the SCaVis Code Assist for the Editor class. Analogously, one can print all such variables using the BeanShell commands (but using the BeanShell syntax).

LaTeX equations in comments

One important feature of this IDE is a “CodeView” feature (look at “View→CodeView” menu or [F3]). This allows to display and correctly lay out mathematical equations using the LaTeX syntax. LaTeX equations can be inserted in multiline comments of Jython and Python files, which are defined using triple-quotes.

This feature is especially useful for students and academic scientists, since one can embed equations in what are called doc strings. For the multiline comments, one can use the usual HTML tags, plus one can use the dollar sign symbol and the double dollar sign symbols (equation on a separate line) to enclose the LaTeX equations. This means that one can mix Jython/Python code with a full-featured scientific article with a proper formatting using HTML tags and mathematical equations using the LateX syntax. This code can be executed (as explained below, since Jython/Python), plus can be viewed as an article with a professional formatting.

Note that equations and HTML tags cannot be viewed for the “single-line” Jython/Python comments when using the “#” symbol.

Here is an example. Assume you opened a file which contains a multiline comment like:

You can view a well-formatted comment text with the Latex equation if you press [F3] or [View]→[ViewCode]

 (View code)

The HTML version of the Jython/Python code is normally generated in a background. You can access HTML code from the directory “cachedir”.

LaTeX equations can be inserted using DragMath (See the Menu [Tools]→[DragMath]. This brings us a window where one can write a LaTeX equations. The one can insert equations using the menu [File]-[push to jeHEP editor], which will insert a LaTeX equations under the cursor.

Executing scripts using the IDE

To run a Jython script, open a Jython file inside the IDE editor and click on the *run* button (indicated with the icon ) from the ToolBar of SCaVis. This executes the script from top to the bottom. The “print” outputs are redirected to the JythonShell (at the bottom of the IDE editor).

One can also use the [F8] key for fast execution of Jython scripts.

In case of run-time error, the SCaVis main editor will move the cursor to the appropriate line with error, and indicate it in red. Errors will be shown in the JythonShell. Press any key to remove the red line highlighting. You can also reload the JythonShell to remove the error message.

You can also use Java or BeanShell files inside the IDE editor. You can execute such files exactly as in the case of Jython scripts.

Jython commands can also be run interactively inside the JythonShell (at the bottom of the IDE editor). The outputs will be redirected to the same JythonShell

Code assist of SCaVis editor

The code assist of SCaVis is based on Java serialisation mechanism and Python methods.

If you are working with a Jython file, type the object name, then type a dot and press [F4]. The object should be instantiated earlier in the file, and it can belong to either Java or Jython class. You will get a detailed description of all methods of this class in a pop-up table. For example, assume you created a function in SCaVis IDE editor:

example.py
from jhplot  import *
f1 = F1D("x*sin(x)",-3.0,3.0)
f1.   # and press  [F4]

Alternatively, one can click on the icon instead of [F4].

One can get a detailed description of this class in a sortable method and also can insert a necessary method to the place right after the dot. The table will be show as

If the object belongs to the jhplot package, you can get a detailed API information by selecting the necessary method and clicking on the menu “describe”.

Finally, almost each class of SCaVis has a method called “doc()”. Execute it as:

example.py
from jhplot  import *
f1 = F1D("x*sin(x)",-3.0,3.0)
f1.doc()

You will on-line help in a Java WWW browser

 WW browser

Code assist in JythonShell

One can develop short Jython programs interactively. If you are working with JythonShell interactively, one can also obtain help on selected objects. Type an object name, a dot, and then press [Ctrl]-[Space]. You will see a drop-down menu with the methods. This is how it works look for the example below:

If you are using JythonShell or SCaVis source-code editor, use the method dir(f1) to print its methods.

Code assist for other IDEs

If you are using Java instead of Jython and working with Eclipse or NetBeans IDE, use the code assist of these IDEs. The description of these IDEs is beyond the scope of this book.

Scripting with SCaVis IDE

The main idea of SCaVis is that you can use Jython scripts to access any Java library. This also means that you can access the TextArea of the scripts itself and all internal variables of the jeHEP IDE.

In fact,a script can modify itself at runtime, or even design itself while executing itself. This offers a tremendous power!

Let us consider how to access internal variable of the SCaVis IDE. Load this script into the IDE and execute it:

example.py
from jehep.ui import SetEnv
from jehep.ui import Editor
print Editor.DocName() # name of this script
print Editor.DocDir()  # directory of this script
print SetEnv.ProjDir   # project directory
print SetEnv.ClassPath # Java classpath

Now let us make a Jython script which, after being loaded to SCaVis IDE, prints itself:

example.py
print view.getText()                 # access the TextArea of this script and prints itself
cc=view.getCaretPosition()           # get the current caret position
view.insertString("inserted text at position 4", 4) # inset some text at position 4

In fact, this script simply destroys itself since it insert some line in itself! Note “view” in this case is an instance if the TextArea which is used to keep the file. This class is very comprehensive, it has about 100 methods for text manipulation.

Now, let us do something useful and constrictive. What we want to do is to generate an HTML page with LaTeX equation. As we know from above, we can use double dollar character to enclose LateX equation and generate an HTML file with equation image using “CodeView” ([View]-[CodeView] menu).

But we do not need to use GUI for this, in SCaVis one can use just a script which will do everything you need.

"""
<H2>This is an equation </H2>
Our equation is
$$
y=frac{sin(x)}{2*sqrt(x)}
$$
"""
# 1 means to display HTML file
view.generateHtml(1)

Look at view.generateHtml(1) method. The script executes itself, generates an HTML file from the multi-line comment and opens a HTML browser inside SCaVis. Your HTML file with the equation is ready! The file is located in the directory “cachedir” together with the image of this equation.

Read more about the text processing using Java and Python in Section Text processing

Information for advanced users

Unregistered users have a limited access to this section. You can unlock advanced pages after becoming a full member. You can also request to edit this manual and insert comments.

click here if you want to know more

click here if you want to know more

click here if you want to know more

A complete description of how to use Java, Jython and SCaVis for scientific analysis is described in the book Scientific data analysis using Jython and Java published by Springer Verlag, London, 2010 (by S.V.Chekanov)

Sergei Chekanov 2010/12/02 19:52

man/general/working_with_ide.txt · Last modified: 2014/04/04 14:29 by admin
CC Attribution-Share Alike 3.0 Unported
Powered by PHP Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0 Valid HTML5