In [1]:
from astropy.table import Table
from astropy import log
log.setLevel('WARNING')

Premiers exemples

In [2]:
table1 = Table([[0.0, 1.0, 2.0, 3.0], ["un", "deux", "trois", "quatre"]], names=("value", "name"))
print (table1)
print (table1["value"])
print (table1[0])
value  name 
----- ------
  0.0     un
  1.0   deux
  2.0  trois
  3.0 quatre
value
-----
  0.0
  1.0
  2.0
  3.0
value name
----- ----
  0.0   un

ajouter/supprimer des colonnes

In [3]:
from astropy.table import Column

newcol = Column([1.1, 3.3, 5., 0.], name="newcol")
table1.add_column(newcol)
table1.remove_column("name")
print (table1)
value newcol
----- ------
  0.0    1.1
  1.0    3.3
  2.0    5.0
  3.0    0.0

Aggregation des 2 tables

In [4]:
table2 = Table([[1,2,3,4], [1.1, None, None,0]], 
               names=("col1", "col2"))

matable = Table([table1["value"], table1["newcol"], table2["col1"], table2["col2"]])
print (matable)
value newcol col1 col2
----- ------ ---- ----
  0.0    1.1    1  1.1
  1.0    3.3    2 None
  2.0    5.0    3 None
  3.0    0.0    4    0

modification des valeurs

In [5]:
table1["value"] *=2
print (table1)
print (matable) # matable n'est pas modifiee

matable["value"] *=2
print (matable)
value newcol
----- ------
  0.0    1.1
  2.0    3.3
  4.0    5.0
  6.0    0.0
value newcol col1 col2
----- ------ ---- ----
  0.0    1.1    1  1.1
  1.0    3.3    2 None
  2.0    5.0    3 None
  3.0    0.0    4    0
value newcol col1 col2
----- ------ ---- ----
  0.0    1.1    1  1.1
  2.0    3.3    2 None
  4.0    5.0    3 None
  6.0    0.0    4    0

import des tables VizieR LSPM limite a 500 records

le format choisit dans l'exemple est VOTable, mais TSV, FITS sont aussi disponibles!

In [6]:
tab = Table.read("http://vizier.u-strasbg.fr/viz-bin/votable?-source=I/298/lspm_n&-out.max=500")
print (tab[0:5])
Downloading http://vizier.u-strasbg.fr/viz-bin/votable?-source=I/298/lspm_n&-out.max=500 [Done]
WARNING: W27: None:29:2: W27: COOSYS deprecated in VOTable 1.2 [astropy.io.votable.tree]
   LSPM     NLTT   USNO-B1     RAJ2000    DEJ2000       pm    Aflag Vemag   V-J 
                                 deg        deg     arcs / yr        mag    mag 
---------- ----- ------------ ---------- ---------- --------- ----- ------ -----
J0000+0003 58703 0900-0000025   0.075275   0.056054     0.253     S  15.02  3.27
J0000+0041 58724 0906-0000116   0.129708   0.685727     0.198     S  16.31  3.70
J0000+0313 58739 0932-0000102   0.168501   3.228500     0.352     S  17.43  3.72
J0000+0356 58690 0939-0000011   0.018693   3.946458     0.227     A  12.39  2.58
J0000+0409    -- 0941-0000118   0.211799   4.162965     0.170     T  11.71  1.78
WARNING: W49: None:68:23: W49: Empty cell illegal for integer fields. [astropy.io.votable.converters]
WARNING: W49: None:69:23: W49: Empty cell illegal for integer fields. [astropy.io.votable.converters]
WARNING: W49: None:73:23: W49: Empty cell illegal for integer fields. [astropy.io.votable.converters]
WARNING: W49: None:75:23: W49: Empty cell illegal for integer fields. [astropy.io.votable.converters]
WARNING: W49: None:77:23: W49: Empty cell illegal for integer fields. [astropy.io.votable.converters]
WARNING: W49: None:80:23: W49: Empty cell illegal for integer fields. [astropy.io.votable.converters]
WARNING: W49: None:81:23: W49: Empty cell illegal for integer fields. [astropy.io.votable.converters]
WARNING: W49: None:88:23: W49: Empty cell illegal for integer fields. [astropy.io.votable.converters]
WARNING: W49: None:90:23: W49: Empty cell illegal for integer fields. [astropy.io.votable.converters]
WARNING: W49: None:91:23: W49: Empty cell illegal for integer fields. (suppressing further warnings of this type...) [astropy.io.votable.converters]

Affichage des header

In [7]:
#tab["V-J"].info() -- devrait fonctionner!!!!
print (tab["V-J"].meta)
print (tab["V-J"].description)
OrderedDict([('width', 5), ('precision', '2'), ('values', {'null': nan})])
? Estimated V-J color (10)

Affichage dans une page web

In [8]:
tab.show_in_browser(jsviewer=True) 

ajouter des metadonnees

In [9]:
print (tab["V-J"].meta)

tab["V-J"].meta["madescription"]="color Vmag - Jmag"
print (tab["V-J"].meta)
OrderedDict([('width', 5), ('precision', '2'), ('values', {'null': nan})])
OrderedDict([('width', 5), ('precision', '2'), ('values', {'null': nan}), ('madescription', 'color Vmag - Jmag')])

Utiliser les UCD

exemple Gaia mag autour d'une position 0+0

In [10]:
from astropy.io.votable import parse
votable = parse("http://vizier.u-strasbg.fr/viz-bin/votable?-source=I/345/gaia2&-c=0+0")
Downloading http://vizier.u-strasbg.fr/viz-bin/votable?-source=I/345/gaia2&-c=0+0 [Done]
WARNING: W27: http://vizier.u-strasbg.fr/viz-bin/votable?-source=I/345/gaia2&-c=0+0:27:2: W27: COOSYS deprecated in VOTable 1.2 [astropy.io.votable.tree]
WARNING: W50: http://vizier.u-strasbg.fr/viz-bin/votable?-source=I/345/gaia2&-c=0+0:76:4: W50: Invalid unit string 'e-/s' [astropy.io.votable.tree]
WARNING: W50: http://vizier.u-strasbg.fr/viz-bin/votable?-source=I/345/gaia2&-c=0+0:79:4: W50: Invalid unit string 'e-/s' [astropy.io.votable.tree]
WARNING: W50: http://vizier.u-strasbg.fr/viz-bin/votable?-source=I/345/gaia2&-c=0+0:88:4: W50: Invalid unit string 'e-/s' [astropy.io.votable.tree]
WARNING: W50: http://vizier.u-strasbg.fr/viz-bin/votable?-source=I/345/gaia2&-c=0+0:92:4: W50: Invalid unit string 'e-/s' [astropy.io.votable.tree]
WARNING: W50: http://vizier.u-strasbg.fr/viz-bin/votable?-source=I/345/gaia2&-c=0+0:104:4: W50: Invalid unit string 'e-/s' [astropy.io.votable.tree]
WARNING: W50: http://vizier.u-strasbg.fr/viz-bin/votable?-source=I/345/gaia2&-c=0+0:108:4: W50: Invalid unit string 'e-/s' [astropy.io.votable.tree]
WARNING: W06: http://vizier.u-strasbg.fr/viz-bin/votable?-source=I/345/gaia2&-c=0+0:120:4: W06: Invalid UCD 'phot.color;em.opt.B;em.opt.R': Unknown word 'phot.color' [astropy.io.votable.tree]
WARNING: W03: http://vizier.u-strasbg.fr/viz-bin/votable?-source=I/345/gaia2&-c=0+0:140:4: W03: Implicitly generating an ID from a name 'E(BP-RP)' -> 'E_BP-RP_' [astropy.io.votable.xmlutil]
In [11]:
table = votable.get_first_table()
print (table)
    RA_ICRS     e_RA_ICRS     DE_ICRS     ... E_BP-RP_  Rad      Lum   
      deg          mas          deg       ...   mag     Rsun     Lsun  
--------------- --------- --------------- ... -------- ------ ---------
  0.02145651484    0.3235  -0.02379344308 ...       --     --        --
359.99991940236    0.2838  -0.03288657521 ...       --     --        --
359.99984304906    9.4457  -0.03302463598 ...       --     --        --
  0.00943770097    0.3457  -0.00089373642 ...       --     --        --
  0.03064536408    0.0475  -0.00627903258 ...   0.0053   0.77     0.433
359.98003807419    0.3504   0.00788634506 ...       --     --        --
359.98197003637    0.2322  -0.00428806972 ...       --     --        --
359.97755696462    0.8966   0.00208200929 ...       --     --        --
359.98956505150    0.0535   0.01222220565 ...   0.0230   0.65     0.216
359.98936001231    0.1096   0.02766082458 ...       --     --        --
In [12]:
for field in table.fields:
    print("column {:20s}: ucd={}".format(field.name, field.ucd))
column RA_ICRS             : ucd=pos.eq.ra;meta.main
column e_RA_ICRS           : ucd=stat.error;pos.eq.ra
column DE_ICRS             : ucd=pos.eq.dec;meta.main
column e_DE_ICRS           : ucd=stat.error;pos.eq.dec
column Source              : ucd=meta.id;meta.main
column Plx                 : ucd=pos.parallax
column e_Plx               : ucd=stat.error;pos.parallax
column pmRA                : ucd=pos.pm;pos.eq.ra
column e_pmRA              : ucd=stat.error;pos.pm;pos.eq.ra
column pmDE                : ucd=pos.pm;pos.eq.dec
column e_pmDE              : ucd=stat.error;pos.pm;pos.eq.dec
column Dup                 : ucd=meta.code.status
column FG                  : ucd=phot.flux;stat.mean;em.opt
column e_FG                : ucd=stat.error;phot.flux;stat.mean
column Gmag                : ucd=phot.mag;stat.mean;em.opt
column e_Gmag              : ucd=stat.error;phot.mag;stat.mean
column FBP                 : ucd=phot.flux;stat.mean;em.opt.B
column e_FBP               : ucd=stat.error;phot.flux;stat.mean
column BPmag               : ucd=phot.mag;stat.mean;em.opt.B
column e_BPmag             : ucd=stat.error;phot.mag;stat.mean
column FRP                 : ucd=phot.flux.density;em.opt.R
column e_FRP               : ucd=stat.error;phot.flux;stat.mean
column RPmag               : ucd=phot.mag;stat.mean;em.opt.R
column e_RPmag             : ucd=stat.error;phot.mag;stat.mean
column BP-RP               : ucd=phot.color;em.opt.B;em.opt.R
column RV                  : ucd=spect.dopplerVeloc.opt;pos.barycenter
column e_RV                : ucd=stat.error;spect.dopplerVeloc.opt;pos.barycenter
column Teff                : ucd=phys.temperature.effective
column AG                  : ucd=phys.absorption.gal
column E(BP-RP)            : ucd=phot.color.excess
column Rad                 : ucd=phys.size.radius
column Lum                 : ucd=phys.luminosity
In [13]:
def get_ucd(table, ucd):
    cols = []
    for field in table.fields:
        if field.ucd.find(ucd)>-1:
            cols.append(field)
    return cols
In [14]:
magcols = get_ucd(table,"phot.mag")
for rec in table.array:
    s = "({},{}):".format(rec["RA_ICRS"], rec["DE_ICRS"])
    for i in range(len(magcols)):
        s += " {}={} ({})".format(magcols[i].name, rec[i], magcols[i].ucd)
    print (s)
(0.02145651484,-0.02379344308): Gmag=0.02145651484 (phot.mag;stat.mean;em.opt) e_Gmag=0.3235 (stat.error;phot.mag;stat.mean) BPmag=-0.02379344308 (phot.mag;stat.mean;em.opt.B) e_BPmag=0.1677 (stat.error;phot.mag;stat.mean) RPmag=2449957888052139648 (phot.mag;stat.mean;em.opt.R) e_RPmag=0.2545 (stat.error;phot.mag;stat.mean)
(359.99991940236,-0.03288657521): Gmag=359.99991940236 (phot.mag;stat.mean;em.opt) e_Gmag=0.2838 (stat.error;phot.mag;stat.mean) BPmag=-0.03288657521 (phot.mag;stat.mean;em.opt.B) e_BPmag=0.1557 (stat.error;phot.mag;stat.mean) RPmag=2449958064145765376 (phot.mag;stat.mean;em.opt.R) e_RPmag=2.4592 (stat.error;phot.mag;stat.mean)
(359.99984304906,-0.03302463598): Gmag=359.99984304906 (phot.mag;stat.mean;em.opt) e_Gmag=9.4457 (stat.error;phot.mag;stat.mean) BPmag=-0.03302463598 (phot.mag;stat.mean;em.opt.B) e_BPmag=1.6573 (stat.error;phot.mag;stat.mean) RPmag=2449958064146999808 (phot.mag;stat.mean;em.opt.R) e_RPmag=-- (stat.error;phot.mag;stat.mean)
(0.00943770097,-0.00089373642): Gmag=0.00943770097 (phot.mag;stat.mean;em.opt) e_Gmag=0.3457 (stat.error;phot.mag;stat.mean) BPmag=-0.00089373642 (phot.mag;stat.mean;em.opt.B) e_BPmag=0.1782 (stat.error;phot.mag;stat.mean) RPmag=2546034966433885568 (phot.mag;stat.mean;em.opt.R) e_RPmag=1.5948 (stat.error;phot.mag;stat.mean)
(0.03064536408,-0.00627903258): Gmag=0.03064536408 (phot.mag;stat.mean;em.opt) e_Gmag=0.0475 (stat.error;phot.mag;stat.mean) BPmag=-0.00627903258 (phot.mag;stat.mean;em.opt.B) e_BPmag=0.025 (stat.error;phot.mag;stat.mean) RPmag=2546034936370507520 (phot.mag;stat.mean;em.opt.R) e_RPmag=0.979 (stat.error;phot.mag;stat.mean)
(359.98003807419,0.00788634506): Gmag=359.98003807419 (phot.mag;stat.mean;em.opt) e_Gmag=0.3504 (stat.error;phot.mag;stat.mean) BPmag=0.00788634506 (phot.mag;stat.mean;em.opt.B) e_BPmag=0.2044 (stat.error;phot.mag;stat.mean) RPmag=2642111838657303808 (phot.mag;stat.mean;em.opt.R) e_RPmag=0.6995 (stat.error;phot.mag;stat.mean)
(359.98197003637,-0.00428806972): Gmag=359.98197003637 (phot.mag;stat.mean;em.opt) e_Gmag=0.2322 (stat.error;phot.mag;stat.mean) BPmag=-0.00428806972 (phot.mag;stat.mean;em.opt.B) e_BPmag=0.1322 (stat.error;phot.mag;stat.mean) RPmag=2642111735577925376 (phot.mag;stat.mean;em.opt.R) e_RPmag=0.4072 (stat.error;phot.mag;stat.mean)
(359.97755696462,0.00208200929): Gmag=359.97755696462 (phot.mag;stat.mean;em.opt) e_Gmag=0.8966 (stat.error;phot.mag;stat.mean) BPmag=0.00208200929 (phot.mag;stat.mean;em.opt.B) e_BPmag=0.4538 (stat.error;phot.mag;stat.mean) RPmag=2642111838657299968 (phot.mag;stat.mean;em.opt.R) e_RPmag=3.9621 (stat.error;phot.mag;stat.mean)
(359.9895650515,0.01222220565): Gmag=359.9895650515 (phot.mag;stat.mean;em.opt) e_Gmag=0.0535 (stat.error;phot.mag;stat.mean) BPmag=0.01222220565 (phot.mag;stat.mean;em.opt.B) e_BPmag=0.0319 (stat.error;phot.mag;stat.mean) RPmag=2738188646457069696 (phot.mag;stat.mean;em.opt.R) e_RPmag=1.715 (stat.error;phot.mag;stat.mean)
(359.98936001231,0.02766082458): Gmag=359.98936001231 (phot.mag;stat.mean;em.opt) e_Gmag=0.1096 (stat.error;phot.mag;stat.mean) BPmag=0.02766082458 (phot.mag;stat.mean;em.opt.B) e_BPmag=0.063 (stat.error;phot.mag;stat.mean) RPmag=2738188646457069568 (phot.mag;stat.mean;em.opt.R) e_RPmag=0.352 (stat.error;phot.mag;stat.mean)

Faire une selection avec numpy

colonne "V-J" <2

In [15]:
import numpy as np
ind = np.where(tab["V-J"]<2)
print (tab[ind])
    LSPM     NLTT   USNO-B1     RAJ2000   ...     pm    Aflag Vemag   V-J 
                                  deg     ... arcs / yr        mag    mag 
----------- ----- ------------ ---------- ... --------- ----- ------ -----
 J0000+0409    -- 0941-0000118   0.211799 ...     0.170     T  11.71  1.78
 J0000+1659 58751 1069-0000132   0.200457 ...     0.313     T   8.80  1.85
 J0000+1758 58731 1079-0000209   0.152583 ...     0.365     T  10.60  1.98
 J0000+1906    -- 1091-0000108   0.120978 ...     0.163     S  18.90  0.04
 J0000+2002 58692 1100-0000025   0.022002 ...     0.288     T   9.48  1.46
 J0000+3411 58691 1241-0000033   0.017026 ...     0.236     T   8.50  1.25
 J0000+3531    -- 1255-0000040   0.035142 ...     0.182     T  12.59  1.60
 J0000+3545    -- 1257-0000228   0.222362 ...     0.167     T  10.00  1.96
 J0000+3902 58700 1290-0000077   0.063290 ...     0.227     T  10.71  1.45
 J0000+4312 58705 1332-0000149   0.079543 ...     0.212     T  11.65  1.73
        ...   ...          ...        ... ...       ...   ...    ...   ...
 J0009+2133   453 1115-0001945   2.481808 ...     0.210     S  12.42  1.95
J0009+2516E   403 1152-0002355   2.315609 ...     0.228     T   7.78  1.29
J0009+3108W   431 1211-0002346   2.397690 ...     0.539     S  16.26 -0.19
 J0009+3228    -- 1224-0003228   2.311559 ...     0.158     T   9.32  1.41
 J0009+4050   385 1308-0002882   2.265308 ...     0.214     T   6.94  1.63
 J0009+5908   389 1491-0004186   2.294539 ...     0.557     A   2.27  0.56
 J0010+0018    -- 0903-0001530   2.600948 ...     0.163     S  14.85  1.87
 J0010+1103   463 1010-0001431   2.549778 ...     0.172     S  11.56  1.98
 J0010+1657    -- 1069-0001891   2.543168 ...     0.160     S  18.14 -0.30
 J0010+2156    -- 1119-0002807   2.525599 ...     0.157     T   9.83  1.50
Length = 99 rows
/usr/lib64/python3.4/site-packages/astropy/table/column.py:928: RuntimeWarning: invalid value encountered in less
  return getattr(self.data, oper)(other)

modifier les unites

colonne "V-J" en mmag

In [16]:
from astropy import units as u

tab["V-J"].convert_unit_to(u.mmag)
print (tab)
   LSPM     NLTT   USNO-B1     RAJ2000   ...     pm    Aflag Vemag    V-J  
                                 deg     ... arcs / yr        mag     mmag 
---------- ----- ------------ ---------- ... --------- ----- ------ -------
J0000+0003 58703 0900-0000025   0.075275 ...     0.253     S  15.02 3270.00
J0000+0041 58724 0906-0000116   0.129708 ...     0.198     S  16.31 3700.00
J0000+0313 58739 0932-0000102   0.168501 ...     0.352     S  17.43 3720.00
J0000+0356 58690 0939-0000011   0.018693 ...     0.227     A  12.39 2580.00
J0000+0409    -- 0941-0000118   0.211799 ...     0.170     T  11.71 1780.00
J0000+0812    -- 0982-0000215   0.219538 ...     0.185     S  18.86 2980.00
J0000+0852 58753 0988-0000105   0.211180 ...     0.231     S  16.57 3790.00
J0000+1121 58688 1013-0000009   0.015681 ...     0.183     S  16.86 2270.00
J0000+1348 58687 1038-0000015   0.022462 ...     0.232     S  16.37 4040.00
J0000+1353    -- 1038-0000126   0.188751 ...     0.183     S  16.78 4270.00
       ...   ...          ...        ... ...       ...   ...    ...     ...
J0010+2018    -- 1103-0002124   2.631327 ...     0.175     S  18.44 4280.00
J0010+2026   493 1104-0002064   2.700953 ...     0.264     S  14.67 4020.00
J0010+2156    -- 1119-0002807   2.525599 ...     0.157     T   9.83 1500.00
J0010+2225   481 1124-0003100   2.621448 ...     0.302     S  17.28 2740.00
J0010+2400   497 1140-0002366   2.713439 ...     0.191     A  14.23 2880.00
J0010+3109   470 1211-0002546   2.577671 ...     0.261     S  15.97 4030.00
J0010+3531    -- 1255-0002815   2.604383 ...     0.152     S  16.73 4050.00
J0010+3646   488 1267-0002882   2.694083 ...     0.228     S  14.29 3620.00
J0010+3709   469 1271-0003151   2.581476 ...     0.194     S  16.10 3960.00
J0010+3904   475 1290-0003413   2.594105 ...     0.403     S  18.68 5320.00
Length = 500 rows
/usr/lib64/python3.4/site-packages/astropy/table/column.py:618: MaskedArrayFutureWarning: setting an item on a masked array which has a shared mask will not copy the mask and also change the original mask array in the future.
Check the NumPy 1.11 release notes for more information.
  new_unit, self.data, equivalencies=equivalencies)

Ajout de colonnes en Galactique

In [17]:
from astropy.coordinates import SkyCoord

pos = SkyCoord(tab["RAJ2000"], tab["DEJ2000"], frame='icrs')
print (pos.to_string('hmsdms')[:3])

gal = pos.transform_to('galactic')

#tab.remove_column("l")
#tab.remove_column("b")
tab.add_column(Column(gal.l, name="l"))
tab.add_column(Column(gal.b, name="b"))

print (tab[:3])
['00h00m18.066s +00d03m21.7944s', '00h00m31.1299s +00d41m08.6172s', '00h00m40.4402s +03d13m42.6s']
   LSPM     NLTT   USNO-B1    ...   V-J         l             b       
                              ...   mmag       deg           deg      
---------- ----- ------------ ... ------- ------------- --------------
J0000+0003 58703 0900-0000025 ... 3270.00 96.5209629243 -60.1670035914
J0000+0041 58724 0906-0000116 ... 3700.00 97.1124909892 -59.6089812288
J0000+0313 58739 0932-0000102 ... 3720.00  99.001127599  -57.265648543

Masque sur des colonnes

on met a null les valeurs de la colonnes Vemag <15

In [18]:
from astropy.table import MaskedColumn

b = MaskedColumn(tab["Vemag"], mask=tab["Vemag"]<15, name="Vemag")
tab.remove_column("Vemag")
tab.add_column(b)

print (tab[:10])
   LSPM     NLTT   USNO-B1     RAJ2000   ...       l             b        Vemag 
                                 deg     ...      deg           deg        mag  
---------- ----- ------------ ---------- ... ------------- -------------- ------
J0000+0003 58703 0900-0000025   0.075275 ... 96.5209629243 -60.1670035914  15.02
J0000+0041 58724 0906-0000116   0.129708 ... 97.1124909892 -59.6089812288  16.31
J0000+0313 58739 0932-0000102   0.168501 ...  99.001127599  -57.265648543  17.43
J0000+0356 58690 0939-0000011   0.018693 ... 99.2192525065 -56.5420234981     --
J0000+0409    -- 0941-0000118   0.211799 ... 99.6845915004 -56.4081323611     --
J0000+0812    -- 0982-0000215   0.219538 ... 102.043116098 -52.5966966396  18.86
J0000+0852 58753 0988-0000105   0.211180 ... 102.378684721 -51.9595456817  16.57
J0000+1121 58688 1013-0000009   0.015681 ... 103.307483848 -49.5410120877  16.86
J0000+1348 58687 1038-0000015   0.022462 ... 104.410371555 -47.2165500041  16.37
J0000+1353    -- 1038-0000126   0.188751 ... 104.675946125 -47.1775200567  16.78
/usr/lib64/python3.4/site-packages/astropy/table/column.py:928: RuntimeWarning: invalid value encountered in less
  return getattr(self.data, oper)(other)

mettre une valeur par defaut pour le valeurs nulles

In [19]:
tab["Vemag"].fill_value = 99.99
print (tab.filled()[:10])
   LSPM     NLTT    USNO-B1    ...       l             b        Vemag 
                               ...      deg           deg        mag  
---------- ------ ------------ ... ------------- -------------- ------
J0000+0003  58703 0900-0000025 ... 96.5209629243 -60.1670035914  15.02
J0000+0041  58724 0906-0000116 ... 97.1124909892 -59.6089812288  16.31
J0000+0313  58739 0932-0000102 ...  99.001127599  -57.265648543  17.43
J0000+0356  58690 0939-0000011 ... 99.2192525065 -56.5420234981  99.99
J0000+0409 999999 0941-0000118 ... 99.6845915004 -56.4081323611  99.99
J0000+0812 999999 0982-0000215 ... 102.043116098 -52.5966966396  18.86
J0000+0852  58753 0988-0000105 ... 102.378684721 -51.9595456817  16.57
J0000+1121  58688 1013-0000009 ... 103.307483848 -49.5410120877  16.86
J0000+1348  58687 1038-0000015 ... 104.410371555 -47.2165500041  16.37
J0000+1353 999999 1038-0000126 ... 104.675946125 -47.1775200567  16.78

sauvegarde du resultat au format CDS

In [20]:
tab.write("matable.ascii", format="ascii.fixed_width")
WARNING: AstropyDeprecationWarning: matable.ascii already exists. Automatically overwriting ASCII files is deprecated. Use the argument 'overwrite=True' in the future. [astropy.io.ascii.ui]

Retour aux valeurs d'origines

In [21]:
tab.mask = False
print (tab[:10])
   LSPM        NLTT      USNO-B1    ...       l             b        Vemag 
                                    ...      deg           deg        mag  
---------- ----------- ------------ ... ------------- -------------- ------
J0000+0003       58703 0900-0000025 ... 96.5209629243 -60.1670035914  15.02
J0000+0041       58724 0906-0000116 ... 97.1124909892 -59.6089812288  16.31
J0000+0313       58739 0932-0000102 ...  99.001127599  -57.265648543  17.43
J0000+0356       58690 0939-0000011 ... 99.2192525065 -56.5420234981  12.39
J0000+0409 -2147483648 0941-0000118 ... 99.6845915004 -56.4081323611  11.71
J0000+0812 -2147483648 0982-0000215 ... 102.043116098 -52.5966966396  18.86
J0000+0852       58753 0988-0000105 ... 102.378684721 -51.9595456817  16.57
J0000+1121       58688 1013-0000009 ... 103.307483848 -49.5410120877  16.86
J0000+1348       58687 1038-0000015 ... 104.410371555 -47.2165500041  16.37
J0000+1353 -2147483648 1038-0000126 ... 104.675946125 -47.1775200567  16.78
In [ ]: