;; This tutorial illustrates how to use the XRT SolarSoft ;; analysis software inside the IDL environment. ;; Assume that the XRT ssw/ and sswdb/ trees have been ;; installed locally through SolarSoft. ;; Every XRT program header includes documentation explaining its ;; usage. ;;================================================================ ;; 1) Set up environmental variables. ;; This is for the location of your SSW XRT tree: setenv, 'SSW_XRT=/usr/local/ssw/hinode/xrt/' ;; This is for the location of the XRT response files and codes: setenv, 'SSW_XRT_RESPONSE='+get_logenv('$SSW_XRT')+'/idl/response/' ;; This is for the location of your XRT data archive: ;; (Assumes the canonical structure for the Hinode data tree.) setenv, 'XRT_DATA=/Volumes/MWeber1/PARIS_WORKSHOP2007/DATA/hinode/xrt/level0/' ;;================================================================ ;; 2) Obtaining XRT data. ;; Roughly speaking, there are two approaches for retrieving data ;; from ESA Hinode SDC Europe: ;; A) website; ;; B) XRT Catalog installed in your SSWDB. ;; .......................................................... ;; A) The ESA SDC website is sophisticated, and so we won't go ;; into details here. You may access the SDC here: ;; http://sdc.uio.no/sdc/ ;; You may search and select for Hinode data on a variety of ;; factors, and retrieve the data as a tarball. The data you ;; obtain will be in the canonical Hinode data archive directory ;; structure, which makes it easy to include into your local data ;; setup. ;; The website provides a sophisticated way to search and select ;; for data, so we encourage end-users to try it out. ;; .......................................................... ;; B) If you have installed the XRT SSWDB package, then you ;; may access the XRT Catalog from within IDL to select and retrieve ;; data from the ESA SDC site. ;; Set environmentals to point to ESA SDC: hinode_server_select, /oslo ;; Select a time range and retrieve the Catalog metadata ;; and URL filepaths: t0 = '2006-Dec-09 11:30:00' t1 = '2006-Dec-09 17:00:00' xrt_cat, t0, t1, cat, urls, /url help, cat, urls help, cat, /st hprint, urls[0:9] ;; You can also use a search array on some of the metadata ;; to further refine your search: ;; (Don't worry, you will see in the next section how to ;; select data for the case where you just download all ;; the data within a time range.) search = ['naxis1=512','naxis2=512','xcen=-470~-420','ycen=-125~-120', $ 'ec_fw1_=be_thin','ec_fw2_=open','ec_imty_=norm*' ] xrt_cat, t0, t1, cat, urls, /url, search=search, /fold help, cat, urls ;; Now retrieve data. ;; (Just grabbing 10 files to illustrate this...) mk_dir, 'tutorial_data' sock_copy, urls[0:9], out_dir='tutorial_data' ;; (Note that this method puts all the data files into ;; a flat directory structure, i.e., NOT in the canonical ;; Hinode data directory structure.) ;;================================================================ ;; 3) Selecting data and reading it into SSW-IDL. ;; In this section, we assume you have downloaded the data to a ;; local location, and you are now ready to select some data to ;; read into SSW-IDL. ;; There are a few different scenarios an end-user might find ;; themselves in: ;; A) The data are located in a canonical Hinode directory ;; structure, ordered by year, month, day, and hour. ;; (This case is the result of obtaining the data using the ;; ESA SDC website. Or you may have obtained the data some ;; other way, but have moved it into a local Hinode archive ;; structure. ;; B) The data were pre-selected when they were downloaded, and ;; are all located in a single, flat directory. (This case ;; is the result of using the SEARCH and /URL keywords with ;; . See the previous section.) ;; C) A full dataset for the time-range is located within a single ;; flat directory, and no pre-selection has been performed. ;; (This case is the result when is used with /URL ;; to retrieve data without the SEARCH keyword, or if you ;; otherwise obtain an entire data-set for a time-period.) ;; In all of these cases, the objective is to form a string array ;; with the names of the data files you want. This array is the ;; input to , which is then used to read the files. ;; This provides the INDEX and DATA variables for the data. ;; .......................................................... ;; A) The data are located in a canonical Hinode directory ;; structure, ordered by year, month, day, and hour. ;; The XRT Team recommends that you keep all of your Hinode data ;; in a canonical archive directory structure. Software tools ;; like can then be used to more readily access the data. ;; The environmental variable $XRT_DATA should point to the ;; .../hinode/xrt/level0/ directory. ;; The program may be used to examine the data ;; within a time range: t0 = '2006-Dec-09 11:30:00' t1 = '2006-Dec-09 17:00:00' xrt_cat, t0, t1, cat, files help, cat Here is a way to see a short summary of your images: hprint, xrt_title(cat[0:9]) ;; Use the CAT metadata to select your data: ss = where((cat.naxis1 eq 512) and (cat.naxis2 eq 512) and $ (cat.ec_fw1_ eq 'Be_thin') and (cat.ec_fw2_ eq 'Open') $ (cat.ec_imty_ eq 'normal')) help, ss ;; Read in the data: read_xrt, files[ss], index, data ;; .......................................................... ;; B) The data were pre-selected when they were downloaded, and ;; are all located in a single, flat directory. ;; In this case, it is not necessary to select the data--- you ;; just want to make a filelist. Here is a quick way. ;; Given the data is in the directory "tutorial_data/": files = find_files('XRT*.fits*', 'tutorial_data') ;; Read in the data: read_xrt, files, index, data ;; .......................................................... ;; C) A full dataset for the time-range is located within a single ;; flat directory, and no pre-selection has been performed. ;; In this case, you could use to select which data you ;; want, but it cannot help you make a filelist if you do not ;; keep the data in the Hinode archive structure. Here is what to ;; if you just have the unselected data within a single directory: ;; Make a filelist of the directory: ;; (Given the data is in the directory "tutorial_data/".) files = find_files('XRT*.fits*', 'tutorial_data') ;; Read the metadata from the data files: read_xrt, files, index ;; Select data with INDEX: ss = where((index.naxis1 eq 512) and (index.naxis2 eq 512) and $ (index.ec_fw1_ eq 'Be_Thin') and (index.ec_fw1_ eq 'Open') $ (index.ec_imty_ eq 'normal') ) ;; Now read in the data: read_xrt, files[ss], index, data ;; NOTE: expects that you will only be reading in data of ;; a single array size (e.g., 512x512). The code will abort if you ;; ask for a mixture of data array sizes. You may force ;; to read multiple data array sizes into a single data-cube ;; (/FORCE), BUT some images will be padded with zeroes around ;; the margin to fill them out. ;;================================================================ ;; 4) Calibrating the data. ;; The main calibration routine for XRT data is . As ;; calibration subroutines are proven and polished, they are adapted ;; into . This means that handles most of the ;; calibrations, but there may be a few submodules that need to be ;; run separately. ;; The FITS files you obtained from the data server are ;; uncalibrated data, i.e., we call them "Level-0" data. ;; They become "Level-1" data fter they have been scientifically ;; calibrated. The end-user is responsible for running the ;; calibration software on their data, so we have tried to keep it ;; relatively straightforward. ;; Run the calibration software: ;; (If you want to see more runtime information, try ;; adding the /VERBOSE switch.) xrt_prep, index, data, ind1, dat1, /norm, /float help, ind1, dat1 hprint, ind1[0].history ;; NOTE: You should only run on data ONCE. ;; Over-calibrated data is not calibrated data. help, index[0].data_lev, ind1[0].data_lev ;; There are various "blemishes" that may appear on the data. ;; High-energy particle hits appear as snow-like noise. ;; Over-exposured images may show saturation "bleeds", which ;; look like stalagmites reaching north from a flaring region. ;; Both of these effects may be cosmetically fixed to make a ;; cleaner image for presentation, but you should note the ;; location of the corrected pixels so that you do not use those ;; pixels for quantitative analysis. sat_map = 1 spike_map = 1 xrt_prep, index, data, ind1, dat1, /norm, /float, $ sat_map=sat_map, despike=2, spike_map=spike_map help, dat1, sat_map, spike_map ;; (This dataset is not a great example of saturation or ;; particle spikes, but there you go.) ;; Since 2007-July-24, formed during a CCD bakeout, there have ;; been strange contamination spots on the CCD. The XRT Team is ;; performing calibration analysis. Currently, there is a ;; routine to perform a simple cosmetic fix. As with spiked ;; and saturated pixels, this cosmetic correction should be ;; performed on images that will be presented, but corrected ;; pixels should not be used for science. ;; The routine is smart about when the spots appeared, so it ;; is safe to run this routine on any XRT data. Pre-spot data ;; will be left untouched. t_spots0 = '2007-sep-11 05:00:00' t_spots1 = '2007-sep-11 06:00:00' xrt_cat, t_spots0, t_spots1, cat_spots, files_spots ss = where(cat.naxis1 eq 512) read_xrt, files_spots[ss[0:20]], ind_spots, dat_spots xrt_prep, ind_spots, dat_spots, ind1_spots, dat1_spots, /norm, /float xrt_tup_contam, ind1_spots, dat1_spots, ind2_spots, dat2_spots, $ spotmaps=spotmaps loadct, 3 wdef,2,512 tvscl,xrtdisp(dat1_spots[*,*,0],/log) & xyouts,250,10,'Before',/dev,charsize=2 wdef,4,512 tvscl,xrtdisp(dat2_spots[*,*,0],/log) & xyouts,250,10,'After',/dev,charsize=2 ;; The XRT images contain some pointing jitter due to small ;; spacecraft motions, as well as orbital thermal changes that ;; slightly change the geometry of XRT with respect to the ;; spacecraft. The jitter database is in SSWDB, and is currently ;; maintained up to within the last couple of months. More recent ;; data does not have jitter calibration available. xrt_jitter, ind1, offsets dat2 = image_translate(dat1, offsets) ;;================================================================ ;; 4) Displaying the data. ;; XRT data is best viewed with log- or power-scaling, and with ;; other visual tweaks. Instead of requiring end-users to keep up ;; with the latest in display tricks, we recommend that the routine ;; be used. This enables you to transparently get a good image. loadct, 3 wdef, 0, 512 tvscl, xrtdisp(dat1[*,*,0],/log) ;; Here is an easy way to view your data-cube as a movie in IDL. xstepper, xrtdisp(dat1,/log) ;;================================================================ ;; 5) Doing temperature analysis with multiple filter sets. ;; There is code available to estimate DEMs (Differential Emission ;; Measures) using multifilter data sets. ;; First, get our example dataset. files = ['XRT20061119_075931.4.fits', $ 'XRT20061119_080414.3.fits', $ 'XRT20061119_080442.4.fits', $ 'XRT20061119_082410.7.fits', $ 'XRT20061119_083412.0.fits', $ 'XRT20061119_085810.3.fits'] files[0] = '/Volumes/MWeber1/PARIS_WORKSHOP2007/DATA/hinode/xrt/level0/2006/11/19//H0700/' + files[0] files[1:5] = '/Volumes/MWeber1/PARIS_WORKSHOP2007/DATA/hinode/xrt/level0/2006/11/19//H0800/' + files[1:5] read_xrt, files, ind0, dat0 ;; Do calibrations. ;; (Skip spot correction, since this is pre-spot data.) sat_map = 1 despike_map = 1 xrt_prep, ind0, dat0, ind1, dat1, /norm, /float, $ sat_map=sat_map, despike=2, spike_map=spike_map, /verbose xrt_jitter, ind1, offsets dat2 = image_translate(dat1, offsets) ind2 = ind1 ;; Take a look. print, xrt_title(ind2) aa = xrtdisp(rebin(dat2, 512, 512, 6), /log) xstepper, aa print, xrt_title(ind2) ;; Now pick a pixel to analyze: wdef, 0, 512 tvscl, xrtdisp(dat2[768:1279,768:1279,1],/log) x0 = 1124 & y0 = 959 plots, [-10,10]+x0-768, [y0,y0]-768, /dev plots, [x0,x0]-768, [-10,10]+y0-768, /dev print, sat_map[x0,y0,*] print, spike_map[x0,y0,*] ;; Now prepare the inputs for this point on the data-cube. obs_values = dat2[x0, y0, *] obs_index = ind2 ;; Run the DEM solver. xrt_dem_iterative, obs_index, obs_values, logT_out, dem_out ;; Check the results. help, logT_out, dem_out plot, logT_out, dem_out, psym=10, xtit='log T', charsize=2, $ ytit='DEM [cm^-5 K^-1]', /ytype, yr=[1e20,1e23]