Local Data Storage#

A ATK.Models.DataSet of any kind can be stored as a local FITS file. These files can then be read to recreate the original DataSet.


Automatic Local Data Storage#

To store any returned data, query() can be provided with a path:

from ATK import query

target = 2552928187080872832
galex_query = query("vizier", targets=target, survey="galex", path="example_data.fits.gz")

This will automatically save the returned DataSet to path, and running the script again will read this local file instead of running query() again.


Note

The following situations will automatically trigger the query() to run again, overwriting the local file with the updated DataSet:

  • Changes to query parameters

  • Changes to the working version of ATK

  • If an exception was encountered during data retrieval prior to file creation (i.e. exception is True)



Manual Local Data Storage#

A DataSet can also be stored manually by calling its store() method:

from ATK import query

target = 2552928187080872832
galex_query = query("vizier", targets=target, survey="galex")
galex_query.store("example_data.fits.gz")

The original DataSet can be read from the file and re-created with read():

from ATK import read

data = read("example_data.fits.gz")
data.show()
<Record DataSet>

.kind:      Record
.targets:   2552928187080872832 | 12.297° 5.377° (icrs, 2016-01-01T00:00:00.000, 3.0″)
.exception: False
.data:
      <galex (II/335/galex_ais) Record>
            survey:     galex
            catalogue:  II/335/galex_ais
            correction: full
            search_pos: 12.294° 5.384° (icrs, 2006-08-01T00:00:00.000)
            table:
                  (astropy.Table)
                        RAJ2000:  [12.293] °
                        DEJ2000:  [5.384] °
                        Name:     [GALEX J004910.4+052300]
                        objid:    [6380239640935270574]
                        phID:     [6380239640934219776]
                        Cat:      [AIS]
                        RAfdeg:   [12.328] °
                        DEfdeg:   [5.431] °
                        FUVexp:   [216.0] s
                        NUVexp:   [216.0] s
                        GLON:     [121.884] °
                        GLAT:     [-57.484] °
                        tile:     [50265]
                        img:      [801]
                        sv:       [25]
                        r.fov:    [0.058] °
                        Obs:      [1]
                        b:        [1]
                        E(B-V):   [0.026000000536441803] mag
                        Sp?:      [0]
                        chkf:     [0]
                        FUVmag:   [nan] mag
                        e_FUVmag: [nan] mag
                        NUVmag:   [18.189] mag
                        e_NUVmag: [0.03700000047683716] mag
                        FUV.a:    [nan] mag
                        e_FUV.a:  [nan] mag
                        NUV.a:    [-1.891] mag
                        e_NUV.a:  [0.03700000047683716] mag
                        FUV.4:    [nan] mag
                        e_FUV.4:  [nan] mag
                        NUV.4:    [-1.785] mag
                        e_NUV.4:  [0.039] mag
                        FUV.6:    [nan] mag
                        e_FUV.6:  [nan] mag
                        NUV.6:    [-1.892] mag
                        e_NUV.6:  [0.038] mag
                        Fafl:     [0]
                        Nafl:     [2]
                        Fexf:     [0]
                        Nexf:     [0]
                        Fflux:    [nan] µJy
                        e_Fflux:  [nan] µJy
                        Nflux:    [192.502] µJy
                        e_Nflux:  [6.567] µJy
                        FXpos:    [nan] pix
                        FYpos:    [nan] pix
                        NXpos:    [1998.98] pix
                        NYpos:    [1809.01] pix
                        Fima:     [nan] pix
                        Nima:     [3.711] pix
                        Fr:       [nan] °
                        Nr:       [0.002] °
                        nS/G:     [0.984000027179718]
                        fS/G:     [0.0]
                        nell:     [0.04500000178813934]
                        fell:     [nan]
                        nPA:      [-19.420000076293945] °
                        e_nPA:    [-23.059999465942383] °
                        fPA:      [nan] °
                        e_fPA:    [nan] °
                        Fnr:      [13.0] pix
                        F3r:      [85.0] pix
                        Nar:      [3.5]
                        Narms:    [0.001] °
                        Nbrms:    [0.001] °
                        Far:      [nan]
                        Farms:    [nan] °
                        Fbrms:    [nan] °
                        NUVw:     [161.3000030517578] s
                        FUVw:     [207.1999969482422] s
                        Prob:     [nan]
                        Sep:      [nan] ″
                        Nerr:     [0.4699999988079071] ″
                        Ferr:     [nan] ″
                        Ierr:     [nan] ″
                        Nperr:    [0.05000000074505806] ″
                        Fperr:    [nan] ″
                        CV:       [C]
                        G:        [0]
                        N:        [1]
                        primid:   [6380239640935270400]
                        groupid:  [6380239640935270574]
                        Gd:       [0]
                        Nd:       [1]
                        primidd:  [6380239640935270400]
                        groupidd: [6380239640935270574]
                        groupTot: [6380239640935270574]
                        OName:    [N]
                        Size:     [nan] pix



Available Methods: .add(), .apply(), .from_target(), .merge(), .open(), .plot(), .save(), .show(), .split(), .store()


File Compression#

FITS files generated by any of the methods outlined above are automatically compressed based on the provided extension. For example, to compress with gzip:

galex_query = query("vizier", targets=target, survey="galex", path="example_data.fits.gz")

Or:

galex_query.store("example_data.fits.gz")



Download this Tutorial

Total running time of the script: (0 minutes 1.749 seconds)

Gallery generated by Sphinx-Gallery