This page has infomation how to read data files.



How to Read Data

We prefer to distribute the mock SDSS-III data only in format of C binary because there are too many variants in the Fortran binary, all of which we couldn't follow and make corresponding files. Files downloadable in this page are all in the Little-Endian which can be readable on computers having such CPUs as AMD, Intel, HP, etc. For those who have CPUs made by SUN, Silicon Graphics, and, IBM, we will provide the data on a special request. To check "Endianness" of your computer, please download this program endian.c, compile it, and run the output command. Then, it will tell the Endianness of your computer. To know Endianness, please refer to the Wikipedia.

  • Directory files:
    Each subdirectory has 8 files as below;
    [astro]#ls -al

    -rw-r--r-- 1 kjhan Ph.D. 450879584 Dec 19 06:14 full_sdss3_00.dat
    -rw-r--r-- 1 kjhan Ph.D. 19603464 Dec 19 06:15 mass_sdss3_00.dat
    -rw-r--r-- 1 kjhan Ph.D. 19603464 Dec 19 06:14 vx_sdss3_00.dat
    -rw-r--r-- 1 kjhan Ph.D. 19603464 Dec 19 06:15 vy_sdss3_00.dat
    -rw-r--r-- 1 kjhan Ph.D. 19603464 Dec 19 06:15 vz_sdss3_00.dat
    -rw-r--r-- 1 kjhan Ph.D. 19603464 Dec 19 06:12 x_sdss3_00.dat
    -rw-r--r-- 1 kjhan Ph.D. 19603464 Dec 19 06:12 y_sdss3_00.dat
    -rw-r--r-- 1 kjhan Ph.D. 19603464 Dec 19 06:12 z_sdss3_00.dat

    where (x,y,z)_sdss3_00.dat has positions of mock LRGs in unit of Mpc/h, (vx,vy,vz)_sdss3_00.dat has velocities in unit of km/second, mass_sdss3_00.dat has the halo masses in unit of M_sun/h, and full_sdss3_00.dat contains all the above data plus several other auxillary informations, such as spin, velocity dispersion, q, s, directional cosine of structural axes, and angular momentum.


  • How to read files (except full_sdss3_00.dat) using C:
    ------------------------------------------------------------------------
    fread(&np,sizeof(int),1,fp);
    fread(array,sizeof(float),np,fp);
    ------------------------------------------------------------------------



  • How to read them using Fortran:
    ------------------------------------------------------------------------
    METHOD 1:

    Download sub.c and compile it using a proper C compiler with an option "-c".
    And, you can link sub.o to the fortran main program.
    A fortran caller can read the file as;
    c234567
                character*80 filename
                real array(MLARGE)
                integer np,length

                filename='x_sdss3_00.dat'
    C This is the length of filename.
    C It is needed due to the different definitions on the string between C and Fortran.

                length = 18

                call getnp(filename,np,length)
                call getdata(filename,array,length)
                stop
                end
    ------------------------------------------------------------------------

    METHOD 2:

    If you have a fortran compiler supporting 'form=binary', then try this

    c234567
                character*80 filename
                real array(MLARGE)
                integer np,length

                filename='x_sdss3_00.dat'
                open(1,file=filename,form='binary')

                read(1) np
                read(1)(array,i=1,np)
                stop
                end



    ------------------------------------------------------------------------
  • "full_sdss3_00.dat" can be accessed as (ACCESS LIMITED)
    ------------------------------------------------------------------------
    typedef struct All{
        float mass,x,y,z,vx,vy,vz;
        float spin,sigv,q,s;
    /* spin is the halo spin. Some halos can have negative values */
    /* sigv is the halo velocity dispersion */
    /* and q,s is the radius ratio of intermediat and minor to major */
        float angmom[3],v[3][3];
    /* angmom[3] is the angular momentum vector of the halo */
    /* v[3][0] directional cosine of the major, */
    /* v[3][1] directional cosine of the intermediate, and */
    /* v[3][2] directional cosine of the minor axis */
    }All;
    All *array;

    ......

    fread(&np,sizeof(int),1,fp);
    fread(array,sizeof(All),np,fp);
    ------------------------------------------------------------------------





  • Korea Insititute for Advanced Study, Hoegiro 87, Dongdaemun-gu, Seoul, 130-722, Korea
    Fax: 82-2-958-3770