Starting ChIPS
ChIPS Threads (CIAO 4.0)
OverviewLast Update: 22 Aug 2007 - new for CIAO 4.0 [Beta 2] Synopsis: This thread describes how to start ChIPS for the first time, how to change the default from Python to S-Lang, and how to access the help files for ChIPS commands in a variety of ways. |
Contents
- Starting ChIPS for the First Time
- Setting the Default ChIPS Language
- Getting Help
- Finding a Command
- Running CIAO and unix commands from the ChIPS Prompt
- Undo and Redo
- Exiting ChIPS
- Using ChIPS from S-Lang and Python
- History
Starting ChIPS for the First Time
ChIPS can be run in two different languages: S-Lang and Python. CIAO must be told which language to use the first time that ChIPS is run.
This is done by setting the CHIPS_SCRIPT_LANG environment variable. If this variable is not set, ChIPS starts up in the Python mode by default.
unix% setenv CHIPS_SCRIPT_LANG python
or
unix% setenv CHIPS_SCRIPT_LANG slang
Then, from the CIAO command line, type:
unix% chips
The startup script loads the ChIPS module, as well as the CRATES module, which handles file input and output ("ahelp crates").
Setting the Default ChIPS Language
Once you have decided which language you prefer using, it can be set as the default in the ChIPS preferences file:
unix% setenv CHIPS_SCRIPT_LANG python
unix% chips
chips-1> set_preferences("chips.shell=python")
chips-2> save_preferences()
or
unix% setenv CHIPS_SCRIPT_LANG slang
unix% chips
slsh version 0.7.7-1; S-Lang version: 2.0.7
Copyright (C) 2005-2006 John E. Davis <jed@jedsoft.org>
This is free software with ABSOLUTELY NO WARRANTY.
chips-1> set_preferences("chips.shell=slang");
chips-2> save_preferences;
The preference is saved to $HOME/.chips.rc. The next time ChIPS is started, the preference file is read and the specified language is used.
If ~/.chips.rc already exists, a text editor may be used to change the chips.shell value as well.
Getting Help
There are several ways to access the ChIPS help files.
From the CIAO command line
-
Python syntax, description and examples for a specific command:
unix% ahelp py.chips <command>
or to list all ChIPS Python help files:
unix% ahelp -c py.chips
-
S-Lang syntax, description and examples for a specific command:
unix% ahelp sl.chips <command>
or to list all ChIPS S-Lang help files:
unix% ahelp -c sl.chips
From within ChIPS
From within Python or S-Lang, ahelp may be called two ways:
-
Python:
chips-3> ahelp "<command>" chips-4> !ahelp py.chips <command>
-
S-Lang:
chips-3> ahelp("<command>"); chips-4> !ahelp sl.chips <command>
The native help systems - called "help" in both cases - may also be used to obtain syntax information:
# Python chips-5> help <command> % S-Lang chips-5> help <command>
Creating an ahelp alias
Users can create an alias for ahelp to default to one syntax.
To always use Python:
unix% alias pyhelp "ahelp py.chips" unix% pyhelp add_curve
To always use S-Lang:
unix% alias slhelp "ahelp sl.chips" unix% slhelp add_curve
Finding a Command
Here are some tips on how to find the name of a command while working in ChIPS.
In Python: ? and <TAB>
To search for a phrase, use the "?" system:
chips-6> ? *label* ChipsAxisTicklabel add_label chips_label current_label delete_label display_label ... hide_label move_label
Type the start of a command and hit <TAB> for all possible completions:
chips-7> move_ move_axis move_label move_plot move_region move_frame move_line move_point
In S-Lang: apropos
The apropos command returns a list of functions that contain that the given string:
chips-6> apropos display apropos display ==> display_axis display_contour display_curve display_depth display_frame display_frame_border display_histogram display_label display_line display_plot display_point display_region chips-7> apropos curve apropos curve ==> ChipsCurve ChipsCurveLimit ChipsCurveLine add_curve chips_curve current_curve delete_curve display_curve get_curve ... shuffle_curve
Running CIAO and unix commands from the ChIPS Prompt
Any line beginning with "!" is passed from ChIPS to the shell. This allows you to run CIAO and shell commands from the ChIPS prompt.
For example:
chips-8> !pwd /data/ciao_demo/threads/acis-s/1838/primary chips-9> !ls acisf01838_000N001_bpix1.fits acisf01838N001_src2.fits acisf01838N001_evt2.fits pcadf084244404N001_asol1.fits chips-10> !dmkeypar acisf01838N001_evt2.fits OBJECT echo+ G21.5-0.9 chips-11> !dmcopy "acisf01838N001_evt2.fits[energy=300:10000]" 1838_energy.fits
Undo and Redo
There is a history mechanism - accessed using the undo() and redo() routines - that allows you to easily recover from accidental or unwanted changes.
Refer to the help files for information about how ChIPS stores the undo and redo stacks.
Using ChIPS from S-Lang and Python
The ChIPS and Crates modules can be loaded into S-Lang and Python by saying
require ("chips_hlui");
require ("crates");
and
from pychips.hlui import * from pycrates import *
respectively.
History
| 22 Aug 2007 | new for CIAO 4.0 [Beta 2] |
