HOW-TO Image services

This HOW-TO shows how to view FITS images in multiple formats from within the DBView web-service and from the awe-prompt using catalogs (SourceLists) for the source specification.

Visualizing and Navigating the Database with DBviewer

To visualize the data in table-views and tree-views, the DBviewer in this Astro-WISE portal offers HTML controls to enter data, send forms and instructions to the the server interacting with the database. Narrow the search by entering conditions to SQL-queries, set context to focus the search on projects by filling in input-fields of forms. Bookmark results, and query-forms as well for repeated searches. Use the Oracle-SQL as shown as basis to modify or build into new SQL-queries. Navigate by links between tableviews, treeviews of a single object and its dependencies,and back from the tree to a row in the table to search for similar objects. Refer to DBviewer’s own help-functions for more information.

Visualizing FITS Images

Directly From Dbview

In DBview, controls are present to view whole FITS images via the web-browser after being processed on-demand into png format by the Astro-WISE image-server. Large images are binned down to a manageable size. Simple controls allow inverting colors and basic adjustment of contrast and size. For SourceList data, overplotting of positions on these images is being developed.

Exporting FITS Images to VO Applets and Image Browsers

Next to providing downloaded FITS data to resident programs, the DB viewer supports features to interact with VO-table-aware astronomical programs imported as web-applets. This can be a useful feature for clients without suitable software installed or as a way to be sure to have the latest version available.

The Aladin Sky Atlas java-applet will read downloaded FITS image data or VO-XML source data. For some science-tables, there is an option to load FITS-data directly from links without exporting to local disk. The applet can access a large number external catalogs and do a number of operations, including interactive plotting.

The graphical table viewer-applet TOPCAT reads downloaded tabular data from the DBviewer in VO-XML format. TOPCAT has statistical and interactive (regression, 3-D) plotting abilities, and can access a few catalogs. The program needs a one-time configuration step of the java webstart manager on the client’s machine.

NOTE: Refer to DBviewer’s own help-functions for more information on downloading and interaction with external programs, see VO work-bench for additional web-client software.

FITS images from any table of the database can be loaded via the clients machine into astronomical Image Browsers. In the Dbviewer, activate the HTML-links to FITS files to download via the web browser dialog menu. NB: FITS-images may be large (>500 Mb), and in a compressed format.

Alternatively, FITS file downloads may be done from the awe-prompt rather than from the web-interface, using the object-method retrieve(), for example:

awe> bias = (BiasFrame.filename == '2000-04-21cal541_ccd57.fits')[0]
awe> bias.retrieve()

The FITS file is saved in the current working directory of the AWE session.

FITS Viewing Programs

  • FV software tool for viewing and editing any FITS format image or table
  • SAOImage DS9 astronomical image and data visualization application
  • SkyCat astronomical image and catalog browser

Visualizing FITS Cut-out Images

Working from the awe-prompt, SourceList and AssociateList objects can export FITS filenames and positional data. These are sent to the image-server’s cut-out service via an image-client script to provide either sub-image FITS files, or an HTML page and table with links to PNG representations of the sub-images. In addition, the HTML page enables access to the original FITS images and the sub-image FITS files, and downloading in FITS format. Magnified PNG representations can be viewed in private windows to be moved around the screen and juxtaposed for comparison. For full control over the image-client, the user can add to the data extra parameters to specify size of sub-images (per item or per series), designate pixel coordinates, add FITS headers, or determine the name of the output file. For more info on how to use the image-client see the code examples below.

awe-prompt: Python Code Examples to Access the Cut-out Services of Image-server

Importing the interface to the image-server:

awe> from import imgclient

Dedicated SourceList or AssociateList object methods

Object-Methods sourcelist.sources.make_image_dict(sids, mode=’sky’) or, mode=’sky’) return dictionaries to get cut-out FITS images from the image server.

  • sids/aids may contain one or a list of SID/AID indexes.
  • mode can specify sky (default) or grid coordinates.

Example to obtain cutouts of SourceList SID number 1..10 for SLID #54052:

awe> from astro.main.SourceList import SourceList
     # instantiate a sourcelist object by any query
awe> sourcelist = (SourceList.SLID == 54052)[0]
     # make the dictionary for a given list of SIDs
awe> imgdict=sourcelist.sources.make_image_dict([1,2,3,4,5,6,7,8,9,10],
...  mode='grid')

Send the dictionary to the image-server with an optional instruction for size:

# have dictionary checked
awe> ic = imgclient.imgclient(imgdict, wide_high=[150, 150])
     # receive zipped cut-out fitsfiles or:
awe> ic.getzipfile()
     # receive an HTML-page with image-links to png representations
awe> ic.getimg()
     # obtain the name of the zipfile that has been retrieved with .getzipfile()
awe> ic.zipfilename

Example to obtain cutouts of Associatelist ALID #7854:

awe> from astro.main.AssociateList import AssociateList
     # select or make an AssociateList object by any query
awe> AL = (AssociateList.ALID == 7854)[0]
     # check the number of associated Sourcelists
awe> len(AL.sourcelists)
     # make the dictionary for a given list of AIDs
awe> imgdict =[1,2],mode='grid')
awe> imgdict
 [{'PIX_Y': 61.8842964172363,   'PIX_X': 3229.7326660156305},
  {'PIX_Y': 50.037860870361293, 'PIX_X': 9802.1259765625}],
 [{'PIX_Y': 94.668701171875, 'PIX_X': 3188.1870117187505},
  {'PIX_Y': 83.101295471191392, 'PIX_X': 9760.25}]}

Send to image-server as shown above for SourceLists. When requested as HTML image-table, cutouts from images will be arranged column-wise. Current limits of of this representation is 16 x 60 columns.

Generating dictionaries with data and control parameters for cut-out services

To construct a dictionary for the image-server without the help of a function, the following calls and data-structures are available to program data input and output. Invoke the image-client and -services in the usual way:

awe> from import imgclient
     # check dictionary and convert into url
awe> x = imgclient.imgclient(dictionary,wide_high=[100,100])
     # retrieve  zipfile of FITS-image cut-out files or
awe> x.getzipfile()
     # retrieve  HTML-pages showing cut-outs and original images
awe> x.getimg()
     # obtain the name of the zipfile that has been retrieved with .getzipfile()
awe> x.zipfilename

The user-dictionary should contain filename-data items:

{filename1: [pdata], filename2: [pdata], etc}

The [pdata] list may contain simple lists with [RA, DEC] (and optionally width, height data) or dictionaries with additional parameters. The wide_high parameter is optional to set generic width and height for all sub-images. Special dictionary-keys are:

  • PIX_X, PIX_Y instead of RA,DEC to enter pixel-coordinates
  • width, height individual sub-FITS image dimensions in pixels (see wide_high parameter above)
  • FTAG for a user-defined tag added to the output-filenames
  • Additional items to be placed into the FITS-headers.

Examples of [pdata]

Lists with optional height and width parameters per individual sub-image:

[[11.5557568095, -29.3887976732],
 [11.4245138174, -29.3883174776, 200, 200],
 [11.5253142382, -29.3874586034, 300, 300]]

Dictionaries specifying position, size and additional items:

[{'RA': 11.5557568095, 'DEC': -29.3887976732, 'extra1': 123, 'extra2': 321},
 {'RA': 11.4245138174, 'DEC': -29.3883174776, 'width': 200, 'height': 200},
 {'RA': 11.5253142382, 'DEC': -29.3874586034, 'width': 300, 'height': 300,
  'extra1': 123, 'extra2': 321, 'extra3': 567, 'extra4': 8910}]

NOTE: Numeric values in [pdata] can also be in string format (e.g. 200 ==
'200' == "200").