Next: 6.6 Plot and Read
Up: 6. Including your own
Previous: 6.4 The papco_interface routines
Subsections
6.5 Simple Slices
Once you have your basic module working and can mix and play around with your
data panel together with all the other data in PaPCo, then you might be
thinking of adding some extra support for your data through the slice
facility.
Remember, this is considered to be ADVANCED PaPCo.
In the main PaPCo widget, ``Mouse Action'' calls up a menu with a set of
slice functions to be performed when the mouse is clicked inside a panel in
the active draw window.
This uses the built-in mouse functions in PaPCo, which basically can return
to the user the panel, time and y-value from a mouse-click. For the slice
types already built in, PaPCo constructs a call to a slice routine you
supply. This call is constructed in a logical way from your plot_type name,
so again to use this facility, adherence to the naming convention is critical.
There are two basic ways in which you can add a slice. One uses PaPCo
internal slices and routines which do most of the work for the user. Or the
user can specify his own slice function name, write an application on his/her
own, and configure PaPCo with it.
The PaPCo slices are explained here, as adding support fro them is
relatively straightforward. Writing completely new mouse support and
functionality for PaPCo is DEFINITELY ADVANCED PaPCo and somewhat more
involved so that we devoted a separate Section to it (6.9).
The first five entries in the ``Mouse Action'' menu are the default PaPCo
slice functions:
- 1.
- papco Zoom Click and drag mouse in panel to highlight a subsection
of the plot to be zoomed into.
- 2.
- papco View Slice Calls up a widget with a plot window, for you to
add whatever you want for the time of the mouse click. Useful for drawing
line spectra for a given position in an energy spectrogram, etc.
- 3.
- papco Access Level Zero Calls a user-defined ``level-zero''
application for the given data type.
- 4.
- papco Write Paneldata Calls up a widget which allows the user to
write the information of several clicks into a file. Useful for making a file
of events - the same file can then be used as input for the event time
standard module.
- 5.
- papco Hair Cursor Draws a large hair-cursor over the entire draw
area and prints the x, y, and z-values to the draw window.
For the slice functions papco View Slice, papco Access Level Zero
and papco Write Paneldata templates are provided for the required
user-written procedures as outlined in Section 6.5.3.
This is a 16-bit integer where each bit is used to switch a slice type on or
off. This parameter needs to be set in your draw_plot_type procedure in
the file papcoadd_plot_type.pro. Since each bit position corresponds to
a slice type, you can add together various combinations of slices you want to
support.
This slice_type parameter is also set in your draw_plot_type
procedure in the in the PaPCo interface file
papcoadd_plot_type.pro. Only those slice types you set there will be
accessible - if your try to use a slice type in a panel from a module which
does not have that slice type enabled, NOTHING will happen. A message might
appear in the IDL window informing you of the function PaPCo is trying to
execute, and that it can't find it.
6.5.3 Using the Draw_Slice_plot_type template
The file plot_type_slice.pro contains all templates for ``papco View
Slice'', ``papco Access level Zero'' and ``papco Write Paneldata ''. These are
used as follows:
The procedure followed is similar to all the others:
- 1.
- Rename all occurrences of
plot_type in the file name and in the
file to the actual name of your plot_type.
- 2.
- Enable the slice type you intend to support by changing the value of
slice_type in your draw_plot_type routine in your
papcoadd_plot_type.pro.
- 3.
- Try out the functionality. Use PaPCo to produce a plot with a panel
with your plot data, select the required mouse action and click inside you
panel. A vertical line should be drawn through all the panels at the time
of the mouse click and the default panel should appear (see Figure
6.3)
Figure 6.3:
Default slice panel window
 |
There are three standard action buttons at the bottom of the slice window:
- Help
- : Calls up a help window for the slice - this must be written by
the module author.
- Print
- : Goes through the slice action again but sends whatever is
plotted in the slice window to the currently selected printer action.
- Close
- : Exits and closes the slice widget.
- 4.
- Once the interface between your module and the default slice works you
can go ahead and actually put a plot into the slice window. Follow the
documentation in the template (Section B.1.3). If you get
stuck, look at some of the other, previously written slices.
All this template does is provide the correct procedure name for your external
application:
- 1.
- Rename all occurrences of
plot_type in the file name and in the
file to the actual name of your plot_type.
- 2.
- Enable the slice type you intend to support by changing the value of
slice_type in your draw_plot_type routine in your
papcoadd_plot_type.pro.
- 3.
- Insert the correct call to your external application and set up any
parameters or common blocks you might need using the passed PaPCo time and
y-position. Follow the documentation in the template (Section
B.1.3).
6.5.5 Using the WriteSlice_plot_type template
PaPCo provides a standard widget for this, which by default allows the user
to write time and y-position of the mouse to a user-defined file. Provision is
made for the addition of further user-defined information, such as ephemeris
parameters, to be added in.
- 1.
- Rename all occurrences of
plot_type in the file name and in the
file to the actual name of your plot_type.
- 2.
- Enable the slice type you intend to support by changing the value of
slice_type in your draw_plot_type routine in your
papcoadd_plot_type.pro.
- 3.
- Try out the functionality. Use PaPCo to produce a plot with a panel
with your plot data, select the required mouse action and click inside you
panel. A vertical line should be drawn through all the panels at the time
of the mouse click and the default panel should appear (see Figure
6.4)
Figure 6.4:
Default WriteSlice panel window
 |
- 4.
- Once the interface between your module and the default slice works you
can go ahead and add your own parameters to the window. Follow the
documentation in the template (Section B.1.3). If you get
stuck, look at some of the other, previously written slices.
The Write Paneldata window is an interactive one since it allows the user to
define the file to which the panel data is written. This widget works thus:
- Default information section
- : The top part gives the time and
y-position of the last mouse click.
- User defined section
- : The 6 user strings set in the
WriteSlice_plot_type routine are displayed here.
- File choose section
- : Either enter a filename manually, or browse
for it. If it doesn't exist, it will be created. Once a valid file is
defined the Edit button is activated. Press this to edit the file. The
files are by default looked for and placed in you user's
papco_user/papco_product/event_time directory, as they can also be
used for the event time utility module (see Section 7.1).
- Comment section
- : This comment string is added to the end of each
line written to file.
- Action buttons
- :
- Add info to file
- : Add the user info to the file selected. The
file is appended. The format the info is written in is as string: time +
y-value + user data 1 + user data 2 user data 3 + comment
- Help
- : Brings up a description of the widget.
- Close
- : Closes the window.
Next: 6.6 Plot and Read
Up: 6. Including your own
Previous: 6.4 The papco_interface routines
Reiner Friedel
1999-02-03