Proba2/SWAP IDL Object Tutorial
Paul Higgins (ARG/TCD), Peter Gallagher (ARG/TCD)
Last updated: January 14th, 2009
IDL objects in SolarSoft allow one to easily and efficiently analyze extensive data sets with a few simple commands. An object is a dynamic data consruct, which includes a number of methods (functions and procedures) to operate. Objects use the -> operator to call their methods. The object is merely a means to dynamically manage data and settings. The object's methods do all of the work.
This IDL object may be used to search for, download, read into IDL, display, or make a movie of Proba2/SWAP image data. Like other objects, SWAP
Object uses sockets to retrieve data. Also, it is part of the SYNIMON family of objects (more information at http://solarmonitor.org/objects). As such, it inherits SYNIMON (SYNoptic IMage Object) and may take advantage of SYNIMON's useful methods. The object has been tested on IDL version 7.0.
At this time, the SWAP object points at a dummy archive located at http://solarmonitor.org/swap/. The data are created from modified EIT 171Å images, and have the (expected) field of view and header information of SWAP. The archive is populated with 1 minute data ranging from 1-Jan-2010 to 1-Feb-2010. Thus, when testing the SWAP object, dates in this range must be given. Keep in mind that there are about 1400 images for each day.
Swap is set to be launched in 2009.
If you do not already have the Proba2/SWAP branch in your SolarSoft tree, you must first run the following:
<< PLACE HOLDER - No SWAP branch yet... For now, download the object here: http://solarmonitor.org/objects/swap/swap__define.pro>>
IDL> ssw_upgrade, /swap, /spawn, /loud
Sample IDL Session
Start by creating the SWAP object.
IDL> swap = obj_new( 'swap' )
List an hour's worth of files.
IDL> flist = swap -> list( timerange = ['03-Jan-2010 05:00:00', '03-Jan-2010 06:00:00'] )
IDL> help, flist
< Expression > STRING = Array
Copy the files to the local directory.
IDL> swap -> copy, filelist = flist[[0,5,10,15,20]]
Read the files into the SWAP object.
IDL> swap -> read, filelist = flist[[0,5,10,15,20]]
Plot the first file in the series. (Figure 1.)
IDL> swap -> plot, filelist = flist
Figure 1: Simply ploting the data.
Use PLOTMAN to plot the file. (Figure 2.)
IDL> swap -> plotman, filelist = flist
Figure 2: Using the Plot Manager tool.
Create a movie of the files listed. (Figure 3.)
IDL> swap -> movie, filelist = flist[[0,5,10,15,20]]
Figure 3: Creating a movie of the data.
Clean up the object and reallocate all memory.
IDL> obj_destroy, swap
An alternative sample session could be as follows:
Initiate a new SWAP object.
IDL> swap = obj_new( 'swap' )
Set the time.
IDL> swap -> set, time = '10-Jan-2010 16:00'
This will find the SWAP image closest to the set time.
Now get the data.
IDL> image = swap -> getdata()
The SWAP object searches the remote archive and downloads the data using IDL sockets.
The data can then be plotted:
IDL> swap -> plot ;(Figure 4.)
IDL> swap -> plot, center = [ 500, -100 ], fov = 10 ;(Figure 6.)
IDL> swap -> plot, xrange = [ 200, 800 ], yrange = [ -400, 100 ] ;(Figure 5.)
Figure 4: Simple plot.
Figure 5: Zoom to a specific region.
Figure 6: Change the viewing angle and recenter.
Now check control parameters:
IDL> print, swap -> get( /time )
IDL> print, swap -> get( /center )
IDL> print, swap -> get( /obs )
Contouring and plotting multiple images in the same window is also built into the SWAP object.
IDL> swap -> plot, timerange=['05-Jan-10'], drange=[6,50], /limb, grid=30, fov=33 ;(Figure 7.)
Figure 7: Changing various plotting properties.
IDL> swap -> multiplot, timerange=['05-Jan-10 02:00:00','05-Jan-10 02:04:00'], fov=20, center=[-200,50], pmulti=[0,2,2], charsize=.8 ;(Figure 8.)
Figure 8: Plotting multiple data sets.
IDL> swap -> swap -> plot, /latest,fov=20,center=[-300,0]
IDL> swap -> plot, levels=10, smooth=10, /over ;(Figure 9.)
IDL> swap -> restoreplot
Figure 9: Contour the data.
Description: Returns a list of full-path file names from the specified time range.
Syntax: IDL> flist = swap -> list( timerange=timerange )
timerange: A string array of one or two elements, using the syntax, 'day-month-year', which specifies the time stamps of the desired data files.
Description: Copies the listed files to the local directory.
Syntax: IDL> swap -> copy, filelist=filelist
filelist: A string array contaning the full-path file names of the desired data files.
Description: Loads the specified files into the SWAP object.
Syntax: IDL> swap -> read, filelist=filelist
Keywords: filelist, timerange
Description: Plots the desired data file.
Syntax: IDL> swap -> plot, filelist=filelist
Keywords: filelist, timerange, (any plot_map keyword), /latest
plot_map keywords: xrange, yrange, contour, overlay, smooth_width, border, fov, grid_spacing, center, tail, log_scale, notitle, title, lcolor, window, noaxes, nolabels, xsize, ysize, new, levels, missing, dmin, dmax, top, quiet, square_scale, trans, positive_only, negative_only, dimensions, offset, bottom, ctyle, cthick, date_only, nodate, last_scale, composite, interlace, average, ncolors, drange, limb_plot, roll, rcenter, truncate, duration, bthick, bcolor, drotate, multi, noerase, clabel, margin, status, xshift, yshift
/latest: Plots SWAP's latest available data.
Description: Reads the latest available data into the SWAP object.
Syntax: IDL> swap -> latest
Description: Calls the PLOTMAN object to plot the desired data.
Syntax: IDL> swap -> plotman, filelist=filelist
Keywords: Same as PLOT.
Description: Calls the MOVIE_MAP widget, and animates the desired data files.
Syntax: IDL> swap -> movie, filelist=filelist
Keywords: filelist, timerange, rate, xsize, ysize, (most plot_map keywords).
Description: Sets the specified object property.
Syntax: IDL> swap -> set, timerange=timerange
Keywords: timerange, (any plot_map keyword).
Description: Retrieves the specified object property.
Syntax: IDL> property = swap -> get( /timerange )
Keywords: /timerange, /filelist, /filescopied, /filesread, /obs, /ut, /header, /(any plot_map keyword).
/filelist: Returns the full-path remote file names.
/filescopied: Returns the most recently copied local file names.
/filesread: Returns the local file names of the data currently stored in the Object.
/obs: Returns the FITS file id string.
/ut: Returns the FITS file's time stamp string.
/header: Returns a string array containing the entire FITS header.
Description: Retrieves an array containing all of the data contained in the SWAP object.
Syntax: IDL> data = swap -> getdata( filelist=filelist )
Keywords: timerange, filelist.
Description: Retrieves an array of all of the data contained in the SWAP object in the form of MAP structures.
Syntax: IDL> maparray = swap -> getmap( headers, filenames, filelist=filelist )
Outputs: headers, filenames
Keywords: timerange, filelist.
headers: An array of all of the headers of the data contained in the SWAP object.
filenames: An array of the file names of all of the data contained in the SWAP object.
Description: Restore plots to default settings.
Syntax: IDL> swap -> restoreplot
Description: Plots multiple images in a single window.
Syntax: IDL> swap -> multiplot, timerange=timerange
Keywords: pmulti, same as plot.
pmulti: An array with the same form as that which would be specified for !P.multi=[position,columns,rows].