How to Use sotsp_rasterize.pro

TECHNICAL NOTE: The examples in this section may rely on the user having a valid SSWIDL installation (as shown in this section) with the most recent SOT software tree installed (as shown in this section).

The sotsp_rasterize.pro program performs a couple of useful functions. First, the routine will identify duplicate and/or missing scan columns from either a single or repeating a SOT-SP Level 2 scan, and second, in the case of a repeating scan, the routine will indicate how a three-dimensional array of physical quantities can be created from the flattened two-dimensional Level 2 data array provided by read_sotsp.pro. Each function is discussed in turn below. The source code for sotsp_rasterize.pro can be found at this link.

How to Identify Missing Scan Columns in SOT-SP Level 2 Data

When data from particular slit positions are unable to be processed, they are removed from the processing pipeline that generates the Level 2 data products, resulting in Level 2 data files that contain only valid slit positions. As a consequence, images of the Level 2 physical quantities may appear to have discontinuous jumps due to the absence of those particular scan columns that were unable to be processed. Additionally, there may be duplicate (redundant) scan columns.

To determine which slit positions are valid and where they are located in the scan sequence, the sotsp_rasterize.pro routine can be used. This routine takes as input the scan_info structure read in from the read_sotsp.pro routine and returns an array that can be used to index the corresponding data array. Using the single-scan example from the previous section, sotsp_rasterize.pro can be utilized as follows:

scanid='20140316_002851'  ;  164"x123" fast map of AR12002
sotsp_getdata,scanid,level=2  ;  downloads both level 2 and 2.1 data files
flist=file_search(scanid+'/'+scanid+'.fits')  ;  gets name of level 2 fits file
read_sotsp,flist[0],index,data,scan_info=scan_info,/xycoord
tv,bytscl(data[*,*,0],min=0,max=2e3)
slitmap=sotsp_rasterize(scan_info)

On output, the slitmap array contains a mapping from the valid slit positions to the columns in the image arrays read in by read_sotsp.pro. To reform the data arrays, one can then do:

slitmap_dims=n_elements(slitmap)
new_dims=size(data,/dim)
new_dims[0]=slitmap_dims  ;  sets the correct size of the new data array
data_new=make_array(dim=new_dims,type=size(data,/type))
for ii=0,slitmap_dims[0]-1 do if slitmap[ii] ge 0 then data_new[ii,*,*]=data[slitmap[ii],*,*]
tv,bytscl(data_new[*,*,0],min=0,max=2e3)

SOT Level 2 scan of
AR12002 (field strength)

At this stage, all 512 slit positions of the scan will now be represented in the data_new variable, in comparison with the 506 slit positions in the original data array. The sotsp_rasterize.pro routine works by analyzing the set of slit positions that were present in the original data array and inferring the locations of the six slit positions for which data are missing. (The commanded program run by SOT-SP originally called for 512 slit positions.) As a result of the missing slit positions being present in the data_new array, each of the images in the data_new array will now have a constant spatial scale across the scan. The missing scan columns contain zeroes. In the accompanying image, one of the scan columns with missing data is about halfway across the scan and goes through the sunspot; the others are in the quieter-Sun region to the west of the active region.

How to Reconstruct the Raster from a SOT-SP Repeating Scan

As shown in the previous section, the Level 2 data files for SOT-SP repeating scans are in the form of flattened "film strips". In this example, the sotsp_rasterize.pro routine is used to infer the structure of the raster and place each individual scan in a three-dimensional array. As before, this routine takes as input the scan_info structure read in from the read_sotsp.pro routine and returns an array that can be used to index the corresponding data array. Using the repeating-scan example from the previous section, sotsp_rasterize.pro can be utilized as follows:

scanid='20131018_100537'  ;  15.4"x82" repeating maps of quiet Sun
sotsp_getdata,scanid,level=2
flist=file_search(scanid+'/'+scanid+'.fits')  ;  gets name of level 2 fits file
read_sotsp,flist[0],index,data,scan_info=scan_info,/xycoord
slitmap=sotsp_rasterize(scan_info)

On output, the slitmap array contains a mapping from the valid slit positions to the columns in the image arrays read in by read_sotsp.pro. Unlike the single-scan example above, however, slitmap will be a two-dimensional array. To reform the data arrays, one can then do:

slitmap_dims=size(slitmap,/dim)
data_dims=size(data,/dim)
new_dims=[slitmap_dims[0],data_dims[1],slitmap_dims[1],data_dims[2]]  ;  [x,y,t,var]
data_new=make_array(dim=new_dims,type=size(data,/type))
for jj=0,slitmap_dims[1]-1 do for ii=0,slitmap_dims[0]-1 do $  ;  loop over all rows/columns
  if slitmap[ii,jj] ge 0 then data_new[ii,*,jj,*]=data[slitmap[ii,jj],*,*]

At this stage, the data_new array will have 96×512×8×38 elements, where the dimensions represent (in order) the number of slit positions in the raster, the number of pixels along the slit, the number of repeats, and the number of available variables. In the process of reconstructing the raster, sotsp_rasterize.pro determined the locations of the slit positions with missing data, which are zeroed-out in the data_new array. Many of these are in the final scan, which was interrupted before it got very far. The following will open a widget that displays a short movie (all eight frames of it!) of Stokes \(V\) from this repeating scan:

xinteranimate,set=new_dims[0:2],/showload
for ii=0,slitmap_dims[1]-1 do xinteranimate,frame=ii,image=bytscl(data_new[*,*,ii,33],min=-1,max=1)
xinteranimate,/keep_pixmaps  ;  plays the animation in a widget