CRISPEX

CRISPEX
CRISPEX (CRisp SPectral EXplorer) is a widget-based tool programmed in the Interactive
Data Language (IDL), which enables the easy browsing of the image and spectral data,
the determination of loop paths, extraction, and further analysis of space-time diagrams.
Crispex is being developed by Dr. Gregal Vissers at the Institute of Theroretical
Astrophysics at the University of Oslo (see Vissers & Rouppe van der Voort, 2012).
Download of the full package and detailed documentation can be found at http://
folk.uio.no/gregal/crispex/.
Crispex was initially created to analyse data from the CRISP instrument at the Swedish 1m Solar Telescope (SST). With the advent of NASA’s IRIS instrument, Crispex has been
expanded in order to read level 3 ‘fits’ data from IRIS (see the Technical Note 26 of the
IRIS documents in order to know how to produce level 3 data).
However, any kind of data can be analysed with Crispex as long as the correct header
information is given. Here we indicate how to open level 3 IRIS data with Crispex, we give
a brief explanation of the main features of Crispex, and we explain how to produce a
Crispex cube with data from a random instrument.
IRIS level 3 data
Crispex is usually called with a pair of files: an ‘image’ cube and a ‘spectral’ cube. These
two files contain exactly the same information, but are ordered differently. The image cube
has dimensions [x,y,λ,t] where ‘x’ and ‘y’ denote the spatial dimensions, ‘λ’ denotes the
spectral dimension and ‘t’ denotes the temporal dimension. The spectral cube has
dimensions [λ,t,x,y]. By providing these 2 cubes fast memory access to both spatial and
spectral information can be provided, which allows Crispex to run in basically any kind of
machine.
Crispex allows the following keywords:
CRISPEX, imcube, spcube, SJI=sji, REFCUBE=refcube, MASKCUBE=maskcube, $
!
SPECTFILE=spectfile, LINE_CENTER=line_center, DT=dt, EXTS=exts, $
!
MNSPEC=mnspec, SINGLE_CUBE=single_cube, $
!
SCALE_STOKES=scale_stokes,NO_WARP=no_warp, $
!
SCALE_CUBES=scale_cubes, XTITLE=xtitle, YTITLE=ytitle, $
!
WINDOW_LARGE=window_large, VERBOSE=verbose
A complete description of the keywords can be found in the Crispex website. In section 2
we will explain only the main keywords. For initialising Crispex:
!
!
!
IDL> imcube = 'path-to-an-IRIS-level3-image-cube.fits’
IDL> spcube = 'path-to-an-IRIS-level3-spectral-cube.fits’
IDL> crispex, imcube, spcube
Context SJI image data from the same dataset (from which the level 3 data was produced)
can also be opened with Crispex together with the image and spectral cubes. The current
version of Crispex only allows one SJI file to be opened. However, below we indicate how
to analyse multiple SJI files with Crispex.
!
!
IDL> sji = ‘path-to-a-level2-SJI-file-from-same-dataset.fits’
IDL> crispex,imcube,spcube,sji=sji
From the above command 4 windows appear:
the Control Panel, the Detailed Spectrum,
the Spectral T-Slice, and the Slit-Jaw Image
(SJI).
The Control Panel controls all windows. In this
example we have used a dense 64 step raster
from IRIS. Consequently, the 2D image from
the SG slit on the right hand side will have
spatial dimensions 64x 1092, where 1092 is the
number of pixels along the slit. The SJI image
is shown in its own window with vertical lines
overlaid, indicating the location of the rasters.
The level 3 data will have the SJI image coaligned with the SG images. Thus, by pointing
the mouse on an SG pixel will show the
corresponding pixel on the SJI image.
The Control
8 Tabs. The
Slit-Jaw Image
Panel contains
main actions of
Control Panel
Detailed Spectrum (scaled intensity vs wavelength)
Spectral T-slice (frame number x10 vs wavelength [Å])
each are:
Temporal - Allows the user to control the SG time step or SJI time step.
Spectral - Allows the user to compare spectral images by blinking, also allows the user to
construct a virtual slit with a given length and angle. This produces space-time slices
through the cube (modifies the T-slice window output).
Spatial - Allows the user to use sliders to finely move the slit location and magnification of
the SG image in the control panel.
Scaling - Allows the user to modify the contrast and bytescaling of all images (SG, SJI,...)
Diagnostics - Allows the user to change the number of spectral windows shown in
the T-slice and Detailed Spectrum windows.
Analysis - Allows the user to perform some analysis steps on the spectral cubes (therefore,
only on the SG images), studying space-time plots along a line or spline path and measure
relative distances in the image. See below for an explanation on how to draw and save
paths.
Overlays - Allows the user to overlay on the SG image previously drawn paths. It also
allows to overlay different spectral images using different colour tables, gammas, etc.
Useful for comparing the spectral signatures in each wing of the line for example.
Displays - Gives the user control over the various display windows of CRISPEX.
Below the Tabs panels one can find ‘play’, ‘pause’, ‘forward’, ‘backward’ and other such
buttons that allow to scroll the SG and SJI images in time. Two horizontal scrolls can be
seen below the ‘play’, ‘pause’, ‘forward’ and ‘backward’ buttons. The first scroll, ‘Frame
number’ denotes the time step of the raster sequence for this dataset. For the present
example, it shows the number of repeats of this 64-step raster study. Since the SJI image
will have its own cadence one can change the SG frame number for the SJI frame number
by clicking on ‘SJI’ in the Master time slot of the Temporal Tab.
The second scroll, ‘Main spectral position’, denotes the position along the spectral
dimension at which the SG image is plotted. The total number of spectral positions is
delimited by the sizes of the CCDs, the calibration procedure and the observing program
(the number of lines observed). The current spectral position set by the scroll will be
indicated in the Detailed Spectrum window by a vertical line.
Analysis - How to make and save paths
To draw paths first it is important to specify a correct output directory where to save all
paths. For this, go to the Preferences Tab in the upper row of the Control Panel, and then
to Input/Output Tab.
Spline paths can be constructed under the Analysis Tab by clicking on ‘Draw Path’. Then,
with the left click one can select points on the SG image. The points are linked by splines.
When the path is finished click on ‘Time slice along loop’, after which a time slice along the
path will be produced. One can save the resulting slab [x,y,λ,t] along the path by clicking
on the upper Analysis Tab and then on ‘Space-Time diagram options’. One then has the
option to save only the points of the path (‘save current path for later retrieval’, which
saves idl save files with extension .clsav) or to save the full slab (‘save space-time
diagram’, which saves idl save files with extension .csav). The former is useful especially
when dealing with long paths and many spectral positions. In this case saving the slab
may require some time. The best is then to first define all the paths of interest and then
save all the corresponding slabs by letting Crispex run in the background. For this, after
saving all the paths, click on the upper Analysis Tab > Space-time diagram options > Save
from selected path(s). A window will then appear where one can select all or some paths,
and decide whether to save at the current or all spectral positions, with or without
interpolation (interpolation is advised for more precision, although more calculating time is
required).
How to make your own Crispex cubes
A drawback of the current Crispex version when dealing with Iris data is that only one SJI
file can be opened. Further, no analysis on the SJI images can be performed, only on the
SG files. In order to circumvolve this issue it is useful to know how to produce your own
Crispex cubes in order to analyse the data you want. In this way, not only Iris data can be
analysed but any kind of data.
For creating Crispex cubes the main point is to generate a ‘La Palma’ header, which is the
original format used for data from the SST. Such headers can be produced via the routine
make_lp_header.pro included in the Hinode/EIS ssw package. Another point is to know
that the data in an image cube is organised as [x,y,λ,t] and in a spectral cube it is
organised as [λ,t,x,y].
A routine is written below which produces an image and a spectral cube, with extensions
‘.fcube’ (data will be of type float, although byte or integer type can also be produced),
given 1 or more image files. The routine is tuned for IRIS SJI files for a given OBSID, but
it can work with any group of fits files having the same dimensions (spatial and temporal).
In this case, the keyword ‘ofits’ should be set. The header of a fits file should have at least
the following keywords:
"
'instrume': instrument name
"
'date_obs': date of observation
"
'obs_id': Observation ID identifier
If more than 1 SJI file is given then the resulting cubes have the SJI files ordered in the
wavelength direction (see the routine header for the full description). If only one image file
is given as input then by typing:
"
IDL> mkcube, sji=‘my-image-cube.fits’
only an image cube will be produced with no spectral cube (and no wavelength
dimension). Let’s assume that the name of the output is ‘imcube.fcube’. In this case the
way to open it with crispex is:
"
IDL> crispex,‘imcube.fcube’,/single
Now assume that you have more than one image file as input, as for instance when all the
4 SJI files are present. Then pass in the sji keyword a string array pointing to the location
of your SJI files.
"
!
IDL> sjifiles= file_search(‘*SJI*.fits’)
IDL> mkcube,sji=sjifiles
In this case the output will be both an image and a spectral cube having in the wavelength
dimension all the SJI files, in the same order as the input. Assume that these files are
‘imcube.fcube’ and ‘spcube.fcube’. Then:
"
IDl> crispex,imcube,spcube
will open the SJI files in the Control Panel window, and different SJI filters can be viewed
by changing the spectral position.
The routine mkcube.pro is fine tuned for IRIS SJI files, but the idea is the same for any
kind of data.
-----------------------------------------------------------------------------------------------------------------------pro mkcube,dir=dir,sji=sji,filnm=filnm,ofits=ofits
;
;
;
;
;
;
;
;
;
;
;
Creates Crispex cube files (set to type float)
Tuned for iris sji files for a given OBSID, but works with any group
of fits files having same dimensions. The header should have at
least the following keywords:
'instrume': instrument name
'date_obs': date of observation
'obs_id': Observation ID identifier
If more than 1 sji file then the resulting cubes have the SJI
files ordered in the wavelength direction. In this case, an sp
cube is also created. If only 1 sji file then only one image
cube is created with no wavelength dimension
;
;
;
;
;
;
;
;
;
INPUT:
dir = /path/to/save/directory/
sji = full path to sji files
filnm = optional output name (filnm+'_im.fcube' & filnm+'_sp.fcube'
are created). Default output names:
'iris_'+instr+'_'+nline+'_'+d_obs+'_'+obsid+'_im.fcube' &
'iris_'+instr+'_'+nline+'_'+d_obs+'_'+obsid+'_sp.fcube'.
ofits: set this keyword to indicate that the fits files are
not Iris fits files
if ~keyword_set(sji) then sji = file_search(dir+'*SJI*.fits')
if n_elements(sji) eq 0 then begin
print,'no SJI files'
return
endif
nlp = n_elements(sji)
for i=0,nlp-1 do begin
sjifile = sji[i]
if ~keyword_set(ofits) then read_iris_l2,sjifile,index,data else
data = readfits(sjifile,header)
if i eq 0 then begin
siz = size(data)
dimx = siz[1]
dimy = siz[2]
dimt = siz[3]
imcube = fltarr(dimx,dimy,nlp,dimt)
lines = strarr(nlp)
if ~keyword_set(ofits) then begin
instr = (index.instrume)[0]
d_obs = strmid((index.date_obs)[0],0,10)
obsid = (index.obsid)[0]
endif else begin
instr = strcompress(sxpar(header,'instrume'),/remove_all)
d_obs = strcompress(sxpar(header,'date_obs'),/remove_all)
obsid = strcompress(sxpar(header,'obsid'),/remove_all)
endelse
if nlp gt 1 then spcube = fltarr(nlp,dimt,long(dimx)*long(dimy))
endif
if ~keyword_set(ofits) then lines[i] = strmid((index.tdesc1)[0],
4,4) else lines[i] = strmid(strcompress(sxpar(header,'tdesc1'),/
remove_all),4,4)
imcube[*,*,i,*] = data[*,*,0:dimt-1]
if i eq 0 then nline = lines[i] else nline = nline+'-'+lines[i]
endfor
if nlp gt 1 then begin
for i=0,dimt-1 do begin
for y = 0, dimy-1 do begin
for x = 0, dimx-1 do begin
p = reform(imcube[x,y,*,i])
j = long(x) + long(y)*long(dimx)
spcube[0:nlp-1, i, j] = p
endfor
endfor
print,string(13b)+' % finished: ',float(i)*100./
(dimt-1),format='(a,f4.0,$)'
endfor
endif
if keyword_set(filnm) then begin
filename = filnm
endif else begin
filename = 'iris_'+instr+'_'+nline+'_'+d_obs+'_'+obsid
endelse
openw, luw, dir+filename+'_im.fcube', /get_lun
h = make_lp_header(fltarr(dimx,dimy),nt=dimt*nlp)
w = assoc(luw,bytarr(512))
w[0] = byte(h)
w = assoc(luw,fltarr(dimx,dimy),512)
print,'writing image cube'
for i=0,dimt-1 do for j=0,nlp-1 do w[i*nlp+j]=reform(imcube[*,*,j,i])
free_lun,luw
if nlp gt 1 then begin
print,'writing sp sube'
openw, luw, dir+filename+'_sp.fcube', /get_lun
h = make_lp_header(fltarr(nlp,dimt), nt=long(dimx)*long(dimy))
w = assoc(luw, bytarr(512)) & w[0] = byte(h)
w = assoc(luw, fltarr(nlp, dimt), 512)
for j=0L,long(dimx)*long(dimy)-1 do w[j] = spcube[*,*,j]
free_lun,luw
endif
end