Next: 6.1.2 Example 2: The Up: User Examples Previous: User Examples

6.1.1 Example 1: Processing a Spectrum for Each Orbit

Imagine you have a really bright source that varies hourly (okay, okay, I did say imagine) and you wish to generate spectra on timescales less than the daily totals that are stored in the Good-Sum (GSM) SDB file but longer than the 2-minute sums stored in the daily difference (DIF) SDB files. Can it be done? Absolutely!!

Given a bright source like Cygnus X-1, a Galactic X-ray nova, or (oh, please, please, please!) a Galactic supernova. it can be practical to generate spectra on time-scales as short as a single orbit.

Our first goal is to create an SDB file summed by orbit, rather than by day, as is normally performed by DAY_SUMMER. Another important issue is that for part of the observation we wish to consider ( Viewing Period 15), the OSSE detectors were set at x2 gain. Therefore we need to keep this data distinguished from the x1 gain observations by separating the instrument command states.

To setup for running SPECANAL, we first need to specify the special commands for the DAY_SUMMER which will be in the file CYGX-1_15_ORBIT.DSM:

; %NameList% DAYSUM_STRUC % Structure created  5-Sep-1995 16:53:00.00
OUTFILE = "CYGX-1_15_DSM.SDB"
GOOD_SUMFILE = "CYGX-1_15_GSM.SDB"
PROD_DIR = "$PROD:"
ORBIT =        1
START_TIME = "91/332 12:55:30"
STOP_TIME = "91/346 16:33:40"
BYCMDSTATE =        1
/END ; of setup element definition

The flags ORBIT and BYCMDSTATE are set to 1 to generate separate SDRs (still separated by detector) for each orbit and instrument command state. The names of both the Day-Summed (DSM) and Good- Summed (GSM) files are specified.

We also need to inform FFIT_PREP how to total the spectra and link in the response matrices. This is done in the file CYGX-1_15_ORBIT.FP:

; %NameList% FIT_PREP_STRUC % Structure created  5-Sep-1995 16:54:24.00
SDBFILE(0) = "CYGX-1_15_GSM.SDB",
BYDET =        1
DAILY =        1
DAYFILE = "CYGX-1_15_DAY.SDB"
OUTFILE = "CYGX-1_15_TOT.SDB"
/END ; of setup element definition

where DAILY=1 specifies to generate the *DAY.SDB file which contains links to the response matrices in the OUTFILE. Note we still want the SDRs separated by detector (BYDET=1).

At this point, we have two possible methods for invoking SPECANAL. One way is to directly call the routine and use keywords to specifiy the new parameter files:

Igore> specanal,target='CYG X-1',vp=15.0,$
Igore>     fileroot='cygx-1_15_orbit',$
Igore>     daysum_config='CYGX-1_15_ORBIT.DSM',$
Igore>     fitprep_config='CYGX-1_15_ORBIT.FP',$
Igore>     /nobln,/noplotanal,$
Igore>     que='sys$ossep'

where we have also used the NOBLN and NOPLOTANAL keywords to skip running the PLOTANAL and BOTTOMLINE routines (why waste CPU time and disk space when we'll be generating our own products which replace them).

Alternatively we can use an analysis setup file which we will name CYGX-1_15_ORBIT.ANL:

; %NameList% SPECANAL_STRUC % Structure created  5-Sep-1995 17:05:47.00
CFG_FILE = "OGRE$DAT:nominal_cfg.anl"
TARGET = "{NAME: 'CYG X-1', RA:  299.590, DEC:   35.202, SRCID: 120 }"
VP =       15.0000
START_TIME = "91/332 12:55:30"
STOP_TIME = "91/346 16:33:40"
OUT_DIR = "ODT5:[BRIDGMAN.GUIDE_SAMPLES.OPTIONS]"
FILEROOT = "CYGX-1_15_orbit"
LOGFILE = "CYGX-1_15_ORBIT.LOG"
BQD_CONFIG = "IGR:[DAT]NOM_CFG.BQD;1"
BQD_DIR = "ODT5:[BRIDGMAN.GUIDE_SAMPLES.OPTIONS]"
DAYSUM_DIR = "ODT5:[BRIDGMAN.GUIDE_SAMPLES.OPTIONS]"
DAYSUM_OUT = "CYGX-1_15_DSM.SDB"
DAYSUM_GOOD = "CYGX-1_15_GSM.SDB"
DAYSUM_CONFIG = "ODT5:[BRIDGMAN.GUIDE_SAMPLES.OPTIONS]CYGX-1_15_ORBIT.DSM"
FITPREP_OUT = "CYGX-1_15_ORBIT_TOT.SDB"
FITPREP_DIR = "ODT5:[BRIDGMAN.GUIDE_SAMPLES.OPTIONS]"
FITPREP_CONFIG = "ODT5:[BRIDGMAN.GUIDE_SAMPLES.OPTIONS]CYGX-1_15_ORBIT.FP"
NOPLOTANAL =        1
PLOTANAL_DIR = "ODT5:[BRIDGMAN.GUIDE_SAMPLES.OPTIONS]"
PLOTANAL_CONFIG = "IGR:[DAT]NOM_CFG.PA;1"
NOBLN =        1
BLN_OUT = "CYGX-1_15_ORBIT_BLN.SDB"
BLN_DIR = "ODT5:[BRIDGMAN.GUIDE_SAMPLES.OPTIONS]"
BLN_CONFIG = "IGR:[DAT]NOM_CFG.BLN;3"
/END ; of setup element definition

where keywords DAYSUM_CONFIG and FITPREP_CONFIG point to the respective parameters files and the keywords NOPLOTANAL and NOBLN are set to 1, indicating that we don't wish to generate this output. We start the job executing with a command like:

Igore> specanal,'CYGX-1_15_ORBIT.ANL',que='sys$ossep'

Once we have the *DAY.SDB file, we can generate multiple model fits. For this particular example, we create a relativistic thermal bremsstrahlung model file RTBREM.MOD using BUILDMODEL. Then we generate the fits for each orbit using an IGORE program like the one below. Figure 6.1 is a sample of one of the fits.

  figure371
Figure 6.1: The Spectrum of Cygnus X-1 integrated over one orbit.

Igore> sdr_load,'CYGX-1_15_DAY.SDB',sdr
Igore> startmodel=0
Igore> ; get orbit numbers
Igore> orbit=getfld('hdr.orbit',sdr)
Igore> orbits=uniquevals(orbit)    ; find the number of unique orbit entries
Igore> detid=getfld('hdr.detid',sdr)
Igore> print,'Records found: ',n_elements(orbit)
Igore> ; loop through each unique orbit
Igore> norbits=n_elements(orbits)
Igore> print,'Orbits to process: ',norbits
Igore> for i=startmodel,norbits-1 do begin
Igore>    dets=where(orbit eq orbits(i))   ; collect detectors for each orbit
Igore>    print,'Processing Orbit: ',orbits(i),'/Dets:',detid(dets)
Igore>    ; generate appropriate fit
Igore>    orbitnum='00000'+strtrim(string(orbits(i)),2)
Igore>    outlen=4
Igore>    num=strmid(orbitnum,strlen(orbitnum)-4,4)
Igore>    x=fitit(file='setup_fitit.txt',$    ; minimal setup file defined to 
Igore>                                        ; suppress prompt
Igore>         sdr=sdr(dets),fitmodel='cygfit_'+num+'.mdl',$
Igore>         title='Cygnus X-1 VP 15/Orbit '+num)
Igore> endfor

For the above example, we have created a small setup file with default parameters to supress the setup file prompt that FITIT generates. The contents of SETUP_FITIT.TXT are listed below:

modelfile="rtbrem.mod"
plot_nchan=30
/end

Note that if you wish to use the SDR keyword in FITIT, do not specify an SDBFILE parameter in the namelist or they will conflict with each other. Now that we have the data, what can we do with it? For starters, we might wish to examine how the model fits vary with time (do temperature and amplitude have a well-defined relationship with each other?) Below is a simple IGORE program to read the model files generated above and plot the amplitude vs. temperature (Figure 6.2).

  figure379
Figure 6.2: Amplitude vs. Temperature for Cygnus X-1 assuming a Relativistic Thermal Bremsstrahlung model (variation plotted over 75 orbits).

Igore> modfiles=findfile('cygfit_*.mdl')
Igore> npts=n_elements(modfiles)
Igore> a=fltarr(npts) & da=fltarr(npts)
Igore> kt=fltarr(npts) & dkt=fltarr(npts)
Igore> ; now loop through the model files
Igore> for j=0,npts-1 do begin
Igore>         print,'Reading file: ',modfiles(j)
Igore>         ms=model_read(modfiles(j))
Igore>         a(j)=ms.p(0) ; get amplitude
Igore>         da(j)=ms.dp(0)
Igore>         kt(j)=ms.p(2) ; get temperature
Igore>         dkt(j)=ms.dp(2)
Igore> endfor
Igore> ; now generate the apppropriate plots
Igore> binplot,a-da,2.0*da,kT,dkT,/ii,$
Igore>         xtitle='Amplitude',ytitle='kT (MeV)',title='Cygnus X-1, VP 15',$
Igore>         subtitle='Relativistic Thermal Bremsstrahlung Model'

Note the differences in specifying the X and Y parameters in the call to BINPLOT.


Next: 6.1.2 Example 2: The Up: User Examples Previous: User Examples