Sophie

Sophie

distrib > Mageia > 5 > i586 > by-pkgid > 37ce2601040f8edc2329d4714238376a > files > 833

eso-midas-doc-13SEPpl1.2-3.mga5.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!--Converted with LaTeX2HTML 98.1p1 release (March 2nd, 1998)
originally by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds
* revised and updated by:  Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
  Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>Special Functions</TITLE>
<META NAME="description" CONTENT="Special Functions">
<META NAME="keywords" CONTENT="vol1">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<LINK REL="STYLESHEET" HREF="vol1.css">
<LINK REL="next" HREF="node45.html">
<LINK REL="previous" HREF="node43.html">
<LINK REL="up" HREF="node38.html">
<LINK REL="next" HREF="node45.html">
</HEAD>
<BODY >
<!--Navigation Panel-->
<A NAME="tex2html1037"
 HREF="node45.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
 SRC="icons.gif/next_motif.gif"></A> 
<A NAME="tex2html1033"
 HREF="node38.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
 SRC="icons.gif/up_motif.gif"></A> 
<A NAME="tex2html1027"
 HREF="node43.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
 SRC="icons.gif/previous_motif.gif"></A> 
<A NAME="tex2html1035"
 HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
 SRC="icons.gif/contents_motif.gif"></A> 
<A NAME="tex2html1036"
 HREF="node216.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index"
 SRC="icons.gif/index_motif.gif"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html1038"
 HREF="node45.html">Interrupting Procedures</A>
<B> Up:</B> <A NAME="tex2html1034"
 HREF="node38.html">MIDAS Command Language</A>
<B> Previous:</B> <A NAME="tex2html1028"
 HREF="node43.html">Conditional Statements, Branching</A>
<BR>
<BR>
<!--End of Navigation Panel-->

<H2><A NAME="SECTION00666000000000000000">&#160;</A><A NAME="2265">&#160;</A>
<BR>
Special Functions
</H2>

<P>
Special functions may be used with the command <TT>COMPUTE/KEYWORD</TT>.
The currently supported functions are listed in the following tables 
(on the next pages). Note, that <I>arg1, arg2</I>
may either be the name of a keyword, the contents of which are used, or
a constant. Character constants have to be enclosed in double quotes to
distinguish them from a keyword name.
On-line help for these functions is available via <TT>HELP COMPUTE/KEYWORD</TT>.

<P>
<BR>
<DIV ALIGN="CENTER"><A NAME="2320">&#160;</A>
<TABLE>
<CAPTION><STRONG>Table 3.2:</STRONG>
Special Functions available for operations on keywords</CAPTION>
<TR><TD>
  <DIV ALIGN="CENTER">
<TABLE CELLPADDING=3 BORDER="1" ALIGN="CENTER">
<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1><B> Command</B></TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1><B> Description</B></TD>
</TR>
<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1><TT>M$ABS(<I> arg1</I>)      </TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1>returns the absolute value of 
integer/real/double
<I> arg1</I> as integer/real/double</TD>
</TR>
<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1><TT>M$EXIST(<I> arg1</I>)    </TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1>returns 1 or 0, if
file <I> arg1</I> exists or not</TD>
</TR>
<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1><TT>M$EXISTD(<I> arg1</I>,<I> arg2</I>)
</TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1>returns 1 or 0, if
descriptor <I> arg2</I> of frame
<I> arg1</I> exists or not</TD>
</TR>
<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1><TT>M$EXISTK(<I> arg1</I>)   </TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1>returns 1 or 0, if 
keyword <I> arg1</I> exists or not</TD>
</TR>
<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1><TT>M$EXISTC(<I> arg1</I>,<I> arg2</I>) 
</TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1>returns the number of the column 
specified in <I> arg2</I> of the table 
<I> arg1</I>;
returns -2 or -1, if table <I> arg1</I> or
column <I> arg2</I> doesn't exist</TD>
</TR>
<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1><TT>M$FILTYP(<I> arg1</I>,<I> arg2</I>)
</TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1>returns a type_no for file in <I> arg1</I>,
if the file name does not include a file type,
the type definition in <I> arg2</I> is appended
to the file name</TD>
</TR>
<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1><TT>M$INDEX(<I> arg1</I>,<I> arg2</I>)
</TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1>returns index of string <I> arg2</I> in
string <I> arg1</I> as integer value (same as
function INDEX of FORTRAN&nbsp;77, i.e. first
position is 1 (not 0))</TD>
</TR>
<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1><TT>M$INDEXB(<I> arg1</I>,<I> arg2</I>)
</TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1>same as <TT> M$INDEX</TT> but search is done 
backwards, starting at the end of the string</TD>
</TR>
<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1><TT>M$LEN(<I> arg1</I>)	</TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1>returns length of string <I> arg1</I>
until the first blank or end of string,
e.g. for argument "abcd" result=4 
and for "abc de" result=3</TD>
</TR>
<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1><TT>M$STRLEN(<I> arg1</I>) 	</TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1>returns `true' string length of <I> arg1</I>
e.g. for argument "abcd" result=4
for "abc de" result=6; if the string contains
only blanks, 0 will be returned</TD>
</TR>
<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1><TT>M$NINT(<I> arg1</I>)     </TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1>returns nearest integer of real/double 
<I> arg1</I></TD>
</TR>
<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1><TT>M$SYMBOL(<I> arg1</I>)   </TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1>returns the translation of Unix environment 
variable <I> arg1</I> (or DCL symbol in VMS) 
as a character string</TD>
</TR>
<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1><TT>M$LOWER(<I> arg1</I>)   </TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1>returns character string <I> arg1</I> in lower
case</TD>
</TR>
<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1><TT>M$UPPER(<I> arg1</I>)   </TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1>returns character string <I> arg1</I> in upper
case</TD>
</TR>
<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1><TT>M$TSTNO(<I> arg1</I>)    </TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1>returns 1 or 0, if string
<I> arg1</I> is a number or not</TD>
</TR>
<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1><TT>M$TIME()               </TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1>returns current date and time as string of
30&nbsp;characters (as given by the host system)</TD>
</TR>
<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1><TT>M$TIME(1)              </TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1>returns current date and time as string in
the form</TD>
</TR>
<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1>&nbsp;</TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1><TT> yyyy-mm-dd</TT></TD>
</TR>
<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1><TT>M$SECS()               </TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1>returns the current time as no. of seconds
elapsed since 1st Jan. 1970 (as an integer)</TD>
</TR>
<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1><TT>M$AGL(<I> arg1</I>)       </TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1>returns contents of AGL definition file 
<TT> agldevices.dat</TT> related to <I> arg1</I>
as an ASCII string</TD>
</TR>
<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1><TT>M$LN(arg1)		</TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1>returns natural logarithm of real/double 
<I> arg1</I></TD>
</TR>
<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1><TT>M$LOG(arg1)		</TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1>returns base-10 logarithm of real/double 
<I> arg1</I></TD>
</TR>
<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1><TT>M$EXP(arg1)            </TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1>returns exponential of real/double <I> arg1</I>
(base e)</TD>
</TR>
</TABLE></DIV>  
  <A NAME="special-functions-available-for-operations-on-keywords">&#160;</A></TD></TR>
</TABLE>
</DIV>
<BR>
<P>
<BR>
<DIV ALIGN="CENTER"><A NAME="2339">&#160;</A>
<TABLE>
<CAPTION><STRONG>Table 3.3:</STRONG>
Special Functions available for operations on keywords - cont.</CAPTION>
<TR><TD>
  <DIV ALIGN="CENTER">
<TABLE CELLPADDING=3 BORDER="1" ALIGN="CENTER">
<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1><B> Command</B></TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1><B> Description</B></TD>
</TR>
<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1><TT>M$SIN(arg1)            </TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1>returns sine of real/double angle <I> arg1</I>
(angle in degrees)</TD>
</TR>
<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1><TT>M$COS(arg1)            </TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1>returns cosine of real/double angle <I> arg1</I>
(angle in degrees)</TD>
</TR>
<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1><TT>M$TAN(arg1)            </TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1>returns tangent of real/double angle
<I> arg1</I> (angle in degrees)</TD>
</TR>
<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1><TT>M$ASIN(arg1)           </TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1>returns arcsine of real/double <I> arg1</I>
in degrees</TD>
</TR>
<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1><TT>M$ACOS(arg1)           </TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1>returns arccosine of real/double <I> arg1</I>
in degrees</TD>
</TR>
<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1><TT>M$ATAN(arg1)           </TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1>returns arctangent of real/double <I> arg1</I>
in degrees</TD>
</TR>
<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1><TT>M$SQRT(arg1)           </TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1>returns square root of real/double 
<I> arg1</I></TD>
</TR>
<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1><TT>M$VALUE(imag[x,y,z])   </TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1>returns a pixel of image <I> imag</I> 
as real value</TD>
</TR>
<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1><TT>M$VALUE(imag,dscr)     </TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1>returns an element of descr <I> dscr</I> of
frame <I> imag</I>
according to the descriptor type</TD>
</TR>
<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1><TT>M$VALUE(tbl,col,row)   </TT></TD>
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=1>returns a single element of table <I> tbl</I>
in column <I> col</I> and row <I> row</I>
according to the column type</TD>
</TR>
</TABLE></DIV>  
  <A NAME="special-functions-available-for-operations-on-keywords">&#160;</A></TD></TR>
</TABLE>
</DIV>
<BR>&nbsp;&nbsp;
<BR>
&nbsp;&nbsp;
<BR>
&nbsp;&nbsp;
<BR>
&nbsp;&nbsp;
<BR>
Note, that the <TT>M$VALUE</TT> function is different from all other functions:
<BR>
Firstly it has a variable no. of arguments and secondly,
because its operands are not keyword names (or constants) but the real names
of images and tables.
<BR>
&nbsp;&nbsp;
<BR>
As an example we want to to display the header of a FITS file stored on disk
(without converting the data), the FITS file name may be entered with or 
without the file extension <TT>.mt</TT>; 
if not given we append the type inside the procedure:<BLOCKQUOTE>
<TT>!+ <BR>
  ! Example 16, MIDAS procedure exa16.prg <BR>
  !+ <BR>
DEFINE/PARAM P1 ? ? "Enter FITS file name:" <BR>
  !  <BR>
DEFINE/LOCAL INA/C/1/80 " " all 
                    </TT>! that fills all elements of INA with blanks<TT> <BR>
DEFINE/LOCAL K/I/1/2 0,0 <BR>
  !  <BR>
K = M$INDEX(P1,".mt") </TT>! test, if type of FITS file entered<TT> <BR>
IF K .LT. 2 THEN <BR>
WRITE/KEYW INA </TT><IMG
 WIDTH="17" HEIGHT="44" ALIGN="MIDDLE" BORDER="0"
 SRC="img162.gif"
 ALT="$\{$"><TT>P1</TT><IMG
 WIDTH="16" HEIGHT="44" ALIGN="MIDDLE" BORDER="0"
 SRC="img163.gif"
 ALT="$\}$"><TT>.mt 
                        </TT>! if not, append type<TT> <BR>
ELSE <BR>
WRITE/KEYW INA </TT><IMG
 WIDTH="17" HEIGHT="44" ALIGN="MIDDLE" BORDER="0"
 SRC="img164.gif"
 ALT="$\{$"><TT>P1</TT><IMG
 WIDTH="16" HEIGHT="44" ALIGN="MIDDLE" BORDER="0"
 SRC="img165.gif"
 ALT="$\}$">! if yes, no need to append type<TT> <BR>
ENDIF <BR>
INTAPE/FITS 1 midd </TT><IMG
 WIDTH="17" HEIGHT="44" ALIGN="MIDDLE" BORDER="0"
 SRC="img166.gif"
 ALT="$\{$"><TT>ina</TT><IMG
 WIDTH="16" HEIGHT="44" ALIGN="MIDDLE" BORDER="0"
 SRC="img167.gif"
 ALT="$\}$"><TT> fnn | $more  <BR>
  !   </TT>but if we want to save the no. of axes of the FITS file<TT>
<BR>
  !   </TT>we do not use the keyword name INA but it's contents<TT>
<BR>
K = M$VALUE(</TT><IMG
 WIDTH="17" HEIGHT="44" ALIGN="MIDDLE" BORDER="0"
 SRC="img168.gif"
 ALT="$\{$"><TT>ina</TT><IMG
 WIDTH="16" HEIGHT="44" ALIGN="MIDDLE" BORDER="0"
 SRC="img169.gif"
 ALT="$\}$"><TT>,naxis) <BR>
WRITE/OUT we have </TT><IMG
 WIDTH="17" HEIGHT="44" ALIGN="MIDDLE" BORDER="0"
 SRC="img170.gif"
 ALT="$\{$"><TT>K</TT><IMG
 WIDTH="16" HEIGHT="44" ALIGN="MIDDLE" BORDER="0"
 SRC="img171.gif"
 ALT="$\}$"><TT> axes</TT></BLOCKQUOTE>The MIDAS commands <TT>@@ exa16 test</TT> as well as <TT>@@ exa16 test.mt</TT>
will both display the header of the FITS file <TT>test.mt</TT>.
Note, that this procedure will display the header in a user friendly way, i.e.
one screen at a time (and only work for Unix).
<BR>
One of the MIDAS verification procedures, <TT>verify3.prg</TT>
 shows the usage of all currently available
functions. Enter <TT>@ vericopy</TT> to copy this procedure into your current
directory (also the usage of <TT>verify3</TT> will be shown then).

<P>
<HR>
<!--Navigation Panel-->
<A NAME="tex2html1037"
 HREF="node45.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
 SRC="icons.gif/next_motif.gif"></A> 
<A NAME="tex2html1033"
 HREF="node38.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
 SRC="icons.gif/up_motif.gif"></A> 
<A NAME="tex2html1027"
 HREF="node43.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
 SRC="icons.gif/previous_motif.gif"></A> 
<A NAME="tex2html1035"
 HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
 SRC="icons.gif/contents_motif.gif"></A> 
<A NAME="tex2html1036"
 HREF="node216.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index"
 SRC="icons.gif/index_motif.gif"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html1038"
 HREF="node45.html">Interrupting Procedures</A>
<B> Up:</B> <A NAME="tex2html1034"
 HREF="node38.html">MIDAS Command Language</A>
<B> Previous:</B> <A NAME="tex2html1028"
 HREF="node43.html">Conditional Statements, Branching</A>
<!--End of Navigation Panel-->
<ADDRESS>
<I>Petra Nass</I>
<BR><I>1999-06-09</I>
</ADDRESS>
</BODY>
</HTML>