| 
 
Converts S-Lang variables and data types to FITS BITPIX values.
 
Integer_Type fits_bitpix( [data] ) 
      
	This routine converts from a S-Lang variable or
	datatype to the
	FITS BITPIX value - as defined at
	http://fits.gsfc.nasa.gov/ -
	that should be used to store the value in a FITS image.
	If there is no corresponding BITPIX value then -1 is returned.
       
	One example of when this function is useful is when
	using the S-Lang XPA module to send image data to a ds9 session,
	as shown below in one of the examples.
       
chips> fits_bitpix(23)
32
chips> fits_bitpix(23.3)
-64
chips> x = typecast( [0:9], UChar_Type )
chips> fits_bitpix(x)
8
	  
	    The examples above show the BITPIX values one would
	    use to represent Integer_Type (23), Double_Type (23.3),
	    and an array of UChar_Type variables (x).
	   
chips> fits_bitpix(Integer_Type)
32
chips> fits_bitpix(Double_Type)
-64
chips> fits_bitpix(UChar_Type)
8
	  
	    Instead of the actual values, as used in the previous
	    example, here we explicitly specify the
	    S-Lang data type we wish to convert.
	   
# Create the image
chips> img = sin([1:256*256]*0.1)
chips> reshape( img, [256,256] )
chips> img
Double_Type[256,256]
chips> fits_bitpix(img)
-64
# Start ds9 and ensure the XPA access point is available
chips> require("xpa")
chips> system("ds9 &");
chips> while( xpaaccess("ds9") == 0 ) sleep(1);
# Create a new frame and tell ds9 to display the image
chips> xpaset( "ds9", "frame new")
1
chips> xpaset( "ds9", "cmap heat")
1
chips> xpaset( "ds9", "array [xdim=256,ydim=256,bitpix=-64]", img )
1
	  
	    In this example we use the S-Lang XPA module to
	    tell ds9 to display the two-dimensional image we
	    have just created. The fits_bitpix() routine is used to find
	    out what value to include in the command string we send
	    to ds9 via the xpaset() call.
	   
	    The S-Lang intrinsic function array_info() can be
	    combined with fits_bitpix() to allow a
	    function to be written that takes in an arbritrary
	    two-dimensional image and sends it to ds9.
	   
	    For more information on XPA try "ahelp xpa",
	    the
	    SAORD XPA documentation,
	    and - for details of the XPA interface within ds9 - the 
	    SAORD ds9 documentation.
	   
chips> fits_bitpix("a string")
-1
chips> fits_bitpix(Array_Type)
-1
chips> fits_bitpix(NULL)
-1
chips> fits_bitpix()
-1
	  
	    Here the return value is -1 because the input values 
	    do not have a corresponding BITPIX value.
	   |