Table Of Contents

Previous topic

The LDAC Catalogue Format - Description and General Concepts

Next topic

LDAC - Advanced Catalogue Manipulations

This Page

LDAC - Conversion from and to the ASCII format

Note

The concrete examples on this page use the LDAC catalogue D1_r_sex.cat, the ASCII table D1_r_part.asc and the configuration file D1_r_asctoldac.conf.

A tar archive with the complete set of LDAC Tools example files is here

The most basic operations with an LDAC catalogue are conversions from and to ASCII tables. The description on this page, together with The LDAC Catalogue Format - Description and General Concepts, is sufficient for those who only want to transform an existing LDAC catalogue, but who do not want to use the format otherwise.

LDAC to ASCII conversion

To obtain an ASCII version of an LDAC table we use the program ldactoasc:

user$ ldactoasc

> SYNTAX: ldactoasc -i Catalog1 Catalog2 [-t <Table_name>] [-k keys] [options]

Options are:  -b (suppress printing of the banner)
              -r (Print the row number)
              -s (Print strings and arrays)
              -q (Quiet flag: defaulted to verbose!)


user$ ldactoasc -s -i D1_r_sex.cat -t LDAC_OBJECTS

#   1 NUMBER              Running object number
#   2 X_IMAGE             Object position along x                     [pixel]
#   3 Y_IMAGE             Object position along y                     [pixel]
#   4 A_IMAGE             Profile RMS along major axis                [pixel]
#   5 B_IMAGE             Profile RMS along minor axis                [pixel]
#   6 THETA_IMAGE         Position angle (CCW/x)                      [deg]
#   7 FLAGS               Extraction flags
#   8 FLUX_RADIUS         Fraction-of-light radii                     [pixel]
#   9 MAG_AUTO            Kron-like elliptical aperture magnitude     [mag]
#  10 MAGERR_AUTO         RMS error for AUTO magnitude                [mag]
#  11 FLUX_ISO            Isophotal flux                              [count]
#  12 FLUXERR_ISO         RMS error for isophotal flux                [count]
#  13 MAG_ISO             Isophotal magnitude                         [mag]
#  14 MAGERR_ISO          RMS error for isophotal magnitude           [mag]
#  15 MAG_APER            Fixed aperture magnitude vector             [mag]
#  19 MAGERR_APER         RMS error vector for fixed aperture mag.    [mag]
#  23 ALPHA_J2000         Right ascension of barycenter (J2000)       [deg]
#  24 DELTA_J2000         Declination of barycenter (J2000)           [deg]
#  25 A_WORLD             Profile RMS along major axis (world units)  [deg]
#  26 B_WORLD             Profile RMS along minor axis (world units)  [deg]
#  27 THETA_WORLD         Position angle (CCW/world-x)                [deg]
#  28 CLASS_STAR          S/G classifier output
#  29 IMAFLAGS_ISO        FLAG-image flags OR'ed over the iso. profile
#  30 NIMAFLAGS_ISO       Number of flagged pixels entering IMAFLAGS_ISO
1 1063.23 1.46569 1.88867 0.498216 ......
2 3805.27 1.40545 0.981680 0.479890 .....
.
.
100 2205.74 28.5372 1.49797 1.03572 .....

It is also possible to access only certain keys:

user$ ldactoasc -s -i D1_r_sex.cat -t LDAC_OBJECTS -k X_IMAGE Y_IMAGE MAG_APER

#   1 X_IMAGE             Object position along x                     [pixel]
#   2 Y_IMAGE             Object position along y                     [pixel]
#   3 MAG_APER            Fixed aperture magnitude vector             [mag]
1063.23 1.46569 27.5003 26.8671 26.7404 26.7300
3805.27 1.40545 27.8551 27.6437 27.6903 27.1868
4412.24 1.42108 28.1911 27.6672 27.6506 27.4137

user$ ldactoasc -s -i D1_r_sex.cat -t LDAC_OBJECTS -k X_IMAGE Y_IMAGE "MAG_APER(2)"

#   1 X_IMAGE             Object position along x                     [pixel]
#   2 Y_IMAGE             Object position along y                     [pixel]
#   3 MAG_APER            Fixed aperture magnitude vector             [mag]
1063.23 1.46569 26.8671
3805.27 1.40545 27.6437
4412.24 1.42108 27.6672

Note

  1. When dealing with vector or string keytypes, the ‘-s’ option to ldactoasc must be used!
  2. To access certain elements of a vector the syntax is as ‘-k “MAG_APER(2)“’ for the second element of MAG_APER. Note that you need to protect the expression ‘MAG_APER(2)’ from the shell by surrounding it with double quotes (parentheses are special shell characters!).

ASCII to LDAC conversion

To bring an ASCII catalogue to the LDAC format we use the asctoldac tool:

user$ less D1_r_part.asc

1 Object_1 1063.230000 1.465690 2.394140
2 Object_2 3805.270000 1.405450 1.444970
3 Object_3 4412.240000 1.421080 1.970170
4 Object_4 2058.430000 1.742440 1.875930

.
.

user$ asctoldac -i D1_r_part.asc -o D1_r_part_ldac.cat -t OBJECTS -c D1_r_asctoldac.conf

   ASCII table to Binary FITS table conversion Version: 0.6 (Aug 24 2010)
100 row(s) converted

user$ ldacdesc -i D1_r_part_ldac.cat

> Reading catalog(s)
------------------Catalog information----------------
Filename:..............D1_r_part_ldac.cat
Number of segments:....3

****** Table #1
       Extension type:.........(Primary HDU)
       Extension name:.........

****** Table #2
       Extension type:.........BINTABLE
       Extension name:.........OBJECTS
       Number of dimensions:...2
       Number of elements:.....100
       Number of data fields...6
       Body size:..............8200 bytes

****** Table #3
       Extension type:.........BINTABLE
       Extension name:.........FIELDS
       Number of dimensions:...2
       Number of elements:.....1
       Number of data fields...4
       Body size:..............28 bytes

> All done

asctoldac takes a configuration files specifying how to transfer individual ASCII columns to the LDAC format. See the file D1_r_asctoldac.conf for further documentation.

Note

  1. It is currently not possible to create vector keys with asctoldac
  2. Traditionally object tables get the tablename OBJECTS in an LDAC catalogue. It always has an associated FIELDS table with it. See LDAC - Special LDAC Table Names for further information.