[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Author Index][Subject Index]

Re: Coding of floating values in MIDAS BDF files in VAX/VMS and AXP/VMS



Bernard Debray wrote : 
>
> One user of MIDAS at our institution has the following problems.
> Many years ago (1992), she saved tenths of MIDAS BDF image files using
> BACKUP from a VAX/VMS machine. 
>   Now she needs to reuse these images and she downloaded them from tape,
> but on an AXP/VMS machine (the VAX/VMS  machine is no longer available
> so we cannot write them to FITS files on VAX).
> 
>   So when she tries to access her BDF files from within MIDAS (96NOV on
> AXP/VMS), for example with command READ/DESC, she gets the following
> error message :
>
> Warning: data is VAX Float instead of Gfloat...
> frame: WD_MRK691_1_202  (data = R4)
> NAXIS:                    1
> NPIX:                   571
> START:               0.26897961173593E+32
> STEP:                 2048.0000000000
> IDENT:           WD_MRK691_1_202
> CUNIT:           none given
> LHCUTS:            -7.046526       162.8535      -7.046526     162.8535
>
> so the values in START and STEP are totally meaningless.
>
>   Some people explained me that this could be due to the difference of
> formats of floating values between VAX machines and other architectures
> ; I fould also a note about that in the MIDAS documentation 
> (http://www.eso.org/projects/esomidas/doc/user/98NOV/vola/node209.html).
>
>   But there are two strange points :
> 1) the data of the image are also real numbers and they are not affected
> (when one assigns likely values to descriptors START and STEP, the
> correct spectrum is displayed), and so look the LHCUTS ;
>
> 2) the message is "VAX Float instead of Gfloat" ;  now, I have looked
> inside the MIDAS code where such messages are issued and in routine
> MID_ACCFRM in MIDFCT.C, one can see that this message is normally
> displayed for single precision floating numbers (R*4) whereas there is a
> dedicated mesage for double precision floating numbers (R*8). Now, the
> START and STEP descriptors are double precision numbers, not single.
>
> I have tried to build a program inside MIDAS which reads the image and
> writes it back again to disk after a correction applied to the START and
> STEP values using a routine converting VAX float to IEEE float found on
> the INFO-VAX Discussion List (<INFO-VAX@LISTSERV.UGA.EDU>), but that did
> not give back likely values (known from log book in this case, but these
> are not known for all the BDF images).

>  I have also tried to find the binary values of the descriptor directly
> from a dump of the BDF file but did not manage to get anything out of
> it.
>  I have seen in the MIDAS code, that the values of the double precision
> descriptors are read and written using a heap of routines which
> transform the value of the numbers. 
>
>   So my questions are : 
> - does there exist a program somewhere which can convert a BDF image
> file from VAX format to AXP (IEEE) format ?
> - how are the values of the START and STEP descriptors written into BDF
> files ?
> - which are the low-level routines which allow to read and write these
> values to and from the BDF file ? (This would allow to apply the
> conversion routine above to the binary value read) 
>
> Thanks in advance for any help. Best regards,
>                            Bernard Debray
>                            Observatoire de Besancon
>                            debray@obs-besancon.fr

The problem described above is caused by the fact that the default representation
of a double presicion variable on VAX/VMS is d-float, while on AXP/VMS it is
g-float! This causes the 
Warning: data is VAX Float instead of Gfloat...
issued by MIDAS when it checks the BDF file header.
To solve the problem on an AXP machine one should install a MIDAS version compiled 
in d-float to do the convertion of these files to FITS files. 
It is recommended NOT to use this d-float version for anything else, because on AXP the d-float is emulated, 
i.e. for each calculation the d-float double precision 
variable is converted into g-float (which has a few bits more for its exponent and 
less in the mantissa) and back. Hence the result is not exactly the same as on a 
VAX. Moreover the convertion to g-float and back to d-float also needs more time.
(See also the explanation given in help FORTRAN and help CC

In order to compile MIDAS on AXP/VMS with d-float, the best thing to do is to install a conversion version
under a different MIDASHOME directory (MIDASD for ex., see the VMS installation notes)
I.e. extract the tar file under this midasd directory and copy [...LIB]LIBNAG.OLB if you don't have NAG.

One must modify the compiler options defined in [...install.vms]selecmake.com
Add an extra AXP_D option to the menu or modify one of the entrences, so that :

$ DECC:= CC/decc/STANDARD=VAXC/EXTERN=COMMON/NODEBUG/NOLIST/float=d_float/WARNING=DISABLE=MISSINGRETURN
$ DECFOR := fortran/align=al/nodeb/nolist/float=d_float/warn=(align,arg,nodecla,gen,uncall,unin,nounus,usa)

First define MID_DISK, MIDASHOME and MIDVERS, which should be executed each time a user wants to use this 
version (one could put it into a midversd.com file ) 
for ex:

$ assign $5$dkb200: mid_disk:
$ midashome :== midasd
$ midvers :== 96nov
$@ mid_disk:['midashome'.'midvers'.install.vms]libdef
$@ mid_disk:['midashome'.'midvers'.monit]midlogs
$inm*idas :== @ mid_disk:['midashome'.'midvers'.monit]start
$setmidas :== @ mid_disk:['midashome'.'midvers'.monit]setmidas

Then do the compilation: i.e.

$ set def mid_install

$ @configmidas



                MIDAS CONFIG MENU:
        ========================================
        1 - List of MIDAS packages available.
        2 - Select internal data format.
        3 - Select display.
        4 - Select only MIDAS core.
        5 - Select all MIDAS packages.
        6 - Select MIDAS core & packages of your choice.
        7 - Install MIDAS.
        8 - Clean MIDAS.
        9 - Help.
        q - Quit.

Select: 2


        INTERNAL DATA REPRESENTATION FOR MIDAS ON ALPHA:
        ================================================
        1 - g_float
        2 - ieee_float
        q - Quit.

Select:the entry you modified or the exta entry you added to the menu

Then select 7 in the main menu and run the compilation.

If you have VMS related MIDAS problems you can always address them to me, as I'm doing the porting
of MIDAS to VMS in collaboration with ESO.

Dr. Jean-Pierre De Cuyper

Royal Observatory Belgium
Ringlaan 3
B1180 Ukkel  Belgium

Tel.: 32 2 373 02 22
Fax.: 32 2 373 04 59