;example program that reads SphinX FITS file, ;calculates lightcurve from raw event lists ;Then the program uses sphinx_select.pro to filter out good solar events ;and overplots in green cleaned lightcurve ;It also is shown here how to obtain from event list headers the reference (base) ;times necessary for UT plots P_init = !P !P.background=255 !P.color=0 !P.charsize=1.5 ;---- specify the FITS file name to read ---- ;---- this file should be in working directory ;or path needs to be specified f = 'SPHINX_090704_044307_095331_evn_D1_L1.fts' ;f = 'SPHINX_090704_095336_160304_evn_D1_L1.fts' ;stop ;---- read SphinX FITS file ---- ; read events extension events_raw = mrdfits(f, 1, hdr_events_raw) ; read exposureure extension exposure_raw = mrdfits(f, 2, hdr_exposure_raw) ;---- prepare time ----- ;time bin centers TIME_RAW= (exposure_raw.tstop + exposure_raw.tstart)/2. ;get reference time components from event extensionn header MJDREF = fxpar(hdr_events_raw, 'MJDREF') TIMEZERO = fxpar(hdr_events_raw, 'TIMEZERO') ;---- prepare reference time ---- ;RefTime is in seconds from 1979-01-01T00:00:00.000 RefTime = mjd2any(MJDREF + TIMEZERO) ;---- calculate raw lightcurve from event list ----- sphinx_lightcurve, events_raw, exposure_raw, lc_raw ;---- determine exposures for raw lightcurve ----- exp_raw = (exposure_raw.tstop - exposure_raw.tstart)*(exposure_raw.fracexp) rate_raw = lc_raw/exp_raw ;--- call clear_utplot just to remove previous ;utplot settings if there were any clear_utplot ;---- define utbase for utplot ---- utbase = anytim(RefTime, /ccsds) ;---- define time range for utplot --- ;here timerange starts one hour befor the first event registration ;and ends one hour after the last event registration t_start = anytim(RefTime + min(time_raw) - 3600., /ccsds) t_end = anytim(RefTime + max(time_raw) + 3600., /ccsds) timerange = [t_start, t_end] ;---- make ut plot ---- window, 0, xs=600, ys=400 erase utplot, time_raw, rate_raw, utbase, ytitle='counts/s', $ title=f, timerange = timerange, /xs, col=0 ;---- Filter event list ---- ;---- with this call sphinx_select should filter out only events of solar origin sphinx_select, events_raw, hdr_events_raw, $ events_filtered, exposure_filtered, min_GTI_event_num = 5 ;, light_curve = lcx ;, /show_event_selection_plots ;---- prepare time for filtered events ----- time_filtered = (exposure_filtered.tstop + exposure_filtered.tstart)/2. ;time bin centers ;---- calculate lightcurve from filtered event list ----- sphinx_lightcurve, events_filtered, exposure_filtered, lc_filtered ;---- determine exposureures for filtered lightcurve ----- exp_filtered = (exposure_filtered.tstop - exposure_filtered.tstart)*exposure_filtered.fracexp ;---- calculate filtered rate ---------------------------- rate_filtered = lc_filtered/exp_filtered ;---- oplot filtered light curve in green ----- tvlct, 0, 255, 0, 128 outplot, time_filtered, rate_filtered, ps=3, col=128 ;--- restore initial plot settings --- loadct, 0 !P = P_init END