Using visibility objects in the RHESSI software Last update: 2009-03-07 7:47 AM
This memo assumes that you understand the command-line level of the IDL RHESSI software. It describes the development version of the software, which is available as an add-on to the normal software. You can use this development, beta-test version by typing
hsi_dev_add
before you start any of the commands described below, that is, right after a fresh start of an IDL session.
1. A first example: making images using visibilites
To make images based on visibilities, specify one of the two visibility-based imaging algorithms available, mem_njit or vis_fwdfit. Thus
o = hsi_image()
; set the image time interval
o->set, im_time_interval = '2002/02/20 ' + ['11:05', '11:15']
o->set, im_energy_band = [10,20]
o->set, image_algorithm = 'njit'
o->plot
plots an image of the 20th February 2002 flare using the MEM NJIT image algorithm.
o->set, image_alg = 'vis_fwdfit'
o->plot
plots an image of the same flare using the visibility forward fit agorithm.
In the background, these two algorithms turn off the annular sector engine used by e.g. clean and pixon, switch on the visibility engine, create visibilities from the level-0 files, and apply one of the two visibility algorithms to generate the image.
These methods can also be applied to create image cubes:
o = hsi_image( im_time_int = '2002/02/20 ' + ['11:06', '11:08', '11:10'], $
im_energy_band = [6,12,25], image_alg = 'vis_fwdfit', pixel_size = 1 )
o->panel_display
Interesting in the creation of these visibilities is the fact that they can be reused instead of the telemetry level-0 data.
2. Saving bags of visibilities into files
A bag of visibility is a data structure that contains visibility items for several energy and time intervals. Storing bags of visibilities in a FITS file is straigtforward, you just need to set a filename in the vis_out parameter:
o->set, vis_out = 'yourvisfile.fits'
now the file will be written as soon as a new getdata() command is issued (thus reprocessing the whole bag of visibilities).
If you dont want to save visibilities into a file, just leave the filename blank.
To use an existing visibility file, set the parameter vis_input_fits instead of specifying image parameters:
o = hsi_image( vis_input_fits = 'yourvisfile.fits' )
o->set, image_alg = 'njit'
o->panel_display
You need to set the imaging algorithm you want to use. You can set any imaging algorithm, including the algorithms that do not use visibilities such as clean and pixon. However, if you set an algorithm that is not visibility-based, the image generator will switch to the annular sector method and access the telemetry packets again (nevertheless reusing the control and info parameters read in the visibility file, see below).
The visibility FITS file stores also the values of the control and info parameters. Although these parameters are in principle not necessary to generate images based on visibilities, they are needed by the software for consistency. As a side effect,the software can reuse these values to generate images using other algorithms (getting back to the telemetry files).
3. Acessing visibilities
Time/energy interval selection
Visibility bags can be retrieved as follows:
vis = o->getdata( class = 'hsi_visibility' )
help, vis, /str
** Structure <85a090c>, 11 tags, length=64, data length=64, refs=2:
ISC INT 3
HARM INT 1
ERANGE FLOAT Array[2]
TRANGE DOUBLE Array[2]
U FLOAT 0.0424057
V FLOAT 0.00205242
OBSVIS COMPLEX ( 2817.70, 739.822)
TOTFLUX FLOAT 6687.36
SIGAMP FLOAT 521.994
CHI2 FLOAT 1.11308
XYOFFSET FLOAT Array[2]
IDL>
In case visibilty bags cover several time/energy intervals, the command above will retrieve only those items associated with the first time and first energy interval. Items in other intervals are retrieved using the indices tb_index and eb_index:
vis = o->getdata( obj = 'hsi_visibility', tb_index = 0, eb_index = 1 )
You can also get all visibilities at once, in a single bag. For this you need to change the mode used to get them. Let us first acces the visibility object to aviod having to write the "obj" keyword:
o2 = o->get( class= 'hsi_visibility' )
o2->set, vis_get_mode = 1
all_vis = o2->getdata()
In the former example, vis_get_mode was set to 0 (the default). To get all visibilities for a specific time interval, use vis_get_mode = 2:
o2->set, vis_get_mode = 2
all_vis = o2->getdata( tb_index = 1)
To get all visibilities for a specific energy interval, use vis_get_mode = 3:
o2->set, vis_get_mode = 3
all_vis = o2->getdata( eb_index = 1)
Detetctor selection
Detector selection works exactly as for the annular sectors:
vis = o->getdata( this_a2d = [0,0,1,1,0,1,0,0,0] )
retrieves data from the 3rd, 4th and 6th sub-collimators.
vis = o->getdata( this_a2d = [0,0,1,1,0,1,0,0,0], paout = paout, /sortpa )
retrieves data from the 3rd, 4th and 6th sub-collimators,
Editing
Editing functions are turned on by default, thus removing bad visibility points according to the value in the chi2 tag of the visibility structure. By default, negative chi2 values are removed.
To turn off editing functions, set vis_edit to zero:
o->set, vis_edit = 0
You can customize a limit for the chi2:
o->set, vis_ch2lim = 5
vis = o->GetData( )
will remove both negative chi2 and values with chi2 > 5.
The editing functions are equivalent to those of the function hsi_vis_edit.
Combination
To combine visibilities, set vis_combine to a nonzero value:
o->set, vis_combine = 1
This will convert visibilities with negative chi2 value to their conjugate value. More options will be added soon.
The combination functions are equivalent to those of the function hsi_vis_combine.
Sorting
vis = o->getdata(paout = paout, /sortpa )
This sorts visibilities according to incresead position angle of grids. paout is an optional output of the position angle (deg) of the selected visibilities.
---
andre.csillaghy@fhnw.ch