dd Software
dd Software
Go to HETG at XRCF
IDL S/W Introduction
(updated 6/9/98)
The S/W described here was created during the design, construction,
testing, and flight activation of the HETG. The S/W is organized in
directories with general themes or purposes and a general chronology.
A large portion of the S/W is made available at the IDL command line
through setup of path and commons via a startup procedure, e.g.
ddidl_start.pro (most recent version is in ~dd/idl/marx/).
Some changes are needed to run the s/w elsewhere, for example,
the sao_start.pro below is used on the ASC/SAO system.
This page is rather large and spread out - the browser FIND
can be used to search for items.
A snapshot of the full software directories is available at:
DD IDL Software Directories.
IDL S/W by Purpose
and Directory
Support Procedures
- useful
- The routines here are generally useful...
- Printing and Ploting
- pre_print.pro
- post_print.pro
-
Pre_print switches from 'X' display to .ps output; post_print
closes the .ps file and send it to the printer. There are
several pre_prints for different page formats and orientations:
IDL> pre_print_landscape [or: _portrait, _sqr, _2to3 ]
IDL> plot, [0.,1.,4.,9.]
IDL> post_print
- dd_load_ct.pro
-
Load a useful color table for energy color coding (red to blue)
- Statistical routines
- g_rand.pro
- g_poiss.pro
- Return samples from Gaussian (center=0, sigma=1) and Poisson distributions.
IDL> print, g_rand()
IDL> print, mu = 9.5
IDL> print, g_poiss(mu)
- Fitting routines
- rdb Files, table data, ...
These routines read and write tables of data. The interp_pruned_x function
is useful for reducing the size of lookup tables.
- rdb_read.pro
- rdb_param.pro
- rdb_write.pro
- Read an rdb format file into an IDL structure.
IDL>
-
interp_prune_x.pro
- Return the indices of a set of lookup arrays so that
linear interpolation using this reduced set of indices is accurate to
some percentage or absolute value of the original values.
IDL> meg = rdb_read(!DDHETGCAL+"/cip/hetgmegD1996-11-01greffN0002.rdb')
IDL> xs_needed = interp_prune_x(meg.energy, [[meg.op1],[meg.oz]], [0.01,0.01])
- 1D Histogram routines
These routines work with histogram files in rdb format.
-
hist_from_events.pro
-
This routine reads a variety of event file types and
creates a 1D histogram of selected event data (uses
lin_hist), currently specific to spatial binning.
The recognized file types are:
- HSI second floor files: [blah,blah]/hsi[runid]iN.fits
- "MARX Level 1 IDL save files" as created by xrcf_sim, '/ml1.idlsav
IDL> !p.multi = [0,2,1]
IDL> hist_from_events, '/nfs/spectra/d6/970116/hsi109002i2.fits', 'hist_temp.rdb', $
IDL> /PLOT, reg_size=0.25, AXIS=90.0
IDL> hist_play, 'hist_temp.rdb', /LOG, /NORM, /CENTER, /GAUSS, $
IDL> XRANGE=[-0.25,0.25], YRANGE=[0.0001,0.5]
-
hist_play.pro
-
This routine reads and plays with the histogram data: i) creates
plot of histogram, ii) fits the histogram using GAUSSFIT or
df_fit.
IDL> hist_file = '/nfs/spectra/d6/p1d/p1d109070_hist.rdb'
IDL> hist_play, hist_file
-
hist_write_template.pro
- This is a demonstration piece of commented code that can be copied into
a procedure and modified in order to write a histogram file.
Because the histogram files are rdb files this is simply
some boiler plate using rdb_write - it has not been packaged into
a routine to allow flexibility.
-
lin_hist.pro,
log_hist.pro
-
These routines bin data and return arrays of bin centers
and bin counts. lin_hist requires a bin size and log_hist
requires a bin ratio (bin i+1 / bin i, e.g. 1.1)
IDL> lin_hist, values, bin_size, bin_centers_out, bin_counts_out
IDL> bin_ratio = 1.0 + 1.0/hist_E_over_dE
IDL> log_hist, values, bin_ratio, bin_centers_out, bin_counts_out
- Indices, Tags, etc.
- index_of_tag_name.pro
- Function to return the index of the tag name in a structure - this
allows the s/w to select the tag desired.
IDL> order = 'p1'
IDL> index = index_of_tag_name('O'+order, meg)
IDL> plot, meg.energy, meg.(index)
- Subassembly Data Utilities
- gs_common.pro
- gs_load_all.pro, gs_load.pro
-
Load the subassembly grating status spread sheet, summary LR,
and summary X-GEF data into gs_common variables.
- gs_list.pro
-
List information on the gratings.
IDL> gs_list [list all gratings]
IDL> gs_list, where(STRPOS(gs_data.NoFly,'uum') GE 0)
- irt_useful
-
- The routines here are useful when used with the IRT package.
HETGS Design and Performance Evaluation
- ebrt
- Ray-trace faceted grating instrument
Compute error budget (copy of Mac budget
equations that is correlated w/Raytrace)
- Error Budget Evaluation
- eb_reset.pro
- eb_update.pro
- eb_vse.pro
-
make_flight_preds.pro
-
This IDL script file sets up (eb_reset) and runs (eb_vse, which
calls eb_update)
the error budget calculation s/w for several sets
of parameters for the HEG, MEG, and LEG. Output rdb tables
of E/dE are written.
IDL> @make_flight_preds
- Error Budget - Ray-trace
-
ebrt.pro
-
The error budget parameters (eb_*) are used to set the parameters
of a simplified grating ray-trace. In this way the error budget can
be directly compared to ray-trace (and insight gained!)
See using ebrt.pro
- cash
-
- sim
- Complete ray-trace of the Source-HRMA-HETG-ACIS.
[Predecessor to "csim" and MARX.]
- effics
- Efficiencies of Chandra elements.
Simulated HETG results from source spectra.
- hess
-
- hrma_spot
- Convert encircled energy plot into 1-D projected
"line spread function".
- dither
-
Sub-assembly S/W
- lr
- These routines read, analyze, and plot the data from
Laser Reflection testing.
- Basic LR Analysis
- LR Commons
- lr_datcom.pro
- lr_analcom.pro
- lr_contcom.pro
-
These commons store the LR data, analyzed results, and contour
plot related results and are used by many of the LR routines to
share data and parameters.
- lrps_common.pro
-
This common stores the variables for the period specification analysis.
- labxray
- These routines are used to model lab source spectra, grating
efficiencies, membrane transmission, etc. Many of the parameters are
stored in common (labx_common.pro) and available and modifyable at
the command line.
- labxray common variables
- labx_common.pro
- Many routines in labxray take their parameters from labx_common.
With labx_common variables (all starting with "lx_") at the command
line the user/programs can easily change them.
IDL> @labx_common
- Rectangular and Tilted-Grating Efficiency Calculation
- labx_grat_effic.pro
- A simple rectangular grating single-sided efficiency is calculated. The
labx_common parameters used are:
IDL> lx_gp = 2000. [period A]
IDL> lx_gm = 2 [order]
IDL> lx_gmat = 'Au'
IDL> lx_gthk = 5500. [thickness A]
IDL> lx_gline = 1000. [linewidth A]
IDL> lx_gpoly = 1.0 [polyimide thickness um]
IDL> lx_gplating = 1.0 [plating thickness factor; 1.0 is 200A Au/ 50 A Cr]
The efficiency is calculated with the function:
IDL> effics = labx_grat_effic(energies)
- grat_effic.pro, grat_effic_wl.pro
- plot labx_grat_effic vs. energy; "_wl" includes
indication of lab line energies:
IDL> grat_effic
IDL> grat_effic_wl
- tilt_path.pro
- This routine calculates the "path shape function" - that is the
projection of the physical grating bar at a given tilt angle. This path shape
function can also be calculated from a multi-vertex model with the routine
jfit_to_tilt.pro (in jfit below.)
IDL> lx_gshape = [0.2,0.8,0.,0.,0.]
IDL> lx_gtilt = 5.0 [degrees]
IDL> tilt_path
- tilt_effic.pro
-
IDL> effics = tilt_effic(energies)
- grat_tilt.pro
- plot tilt_effic vs. energy, includes
indication of lab line energies:
IDL> grat_tilt
- tilt_plot.pro, tilt_plots.pro
- plot the first-order efficiency vs tilt angle:
IDL> tilt_plot, 1.486
IDL> tilt_plots, 2.293
X-Ray Source Spectrum Modeling
- labx_tubespec.pro
- This is the main spectrum calculator routine; it calculates
the spectrum (lines and continuum) from an EIPS-type source. The variable
lx_lines_off can be set to 1 to have continuum only (useful for fitting
a spectrum). The keyword /XRCF selects a ton of kludgy code that
hand modifies the line shapes, intensities, etc. to better agree
with the XRCF EIPS spectra. The main XRCF source spectrum calculator
is xss_sim
(in cmdb below) which parses a cmdb line and calls
labx_tubespec as needed to create the XRCF observed spectrum.
- labx_target.pro
- labx_tubeinuum.pro
- labx_tubelines.pro
- labx_linetoc.pro
- pella_s.pro
- pella_rprime.pro
- pella_tau.pro
- These routines are used by labx_tubespec to create
the EIPS spectrum...
lookups
This directory is the repository for lookup tables used
by the various software.
fits
At the ASC's urging long ago, a FITS format for the X-GEF
data (PSPC, SSD, and SMD) was adopted. This directory has
routines useful and related to the X-GEF FITS files.
jfit
These routines call and interface with John Davis's efficiency model and
fitting routines for X-GEF testing.
- jfit common variables
- jfit_common.pro
- Many routines in jfit put/take their parameters to/from
jfit_common.
IDL> @jfit_common
- X-GEF Results Fitting
- Other Interfaces
- jfit_to_tilt.pro
- Convert jfit parameters in jfit_common into labx_common
parameters and path shape function to allow tilt_effic to evaluate
the jfit model efficiency.
IDL> jfit_poly = 1.0
IDL> (etc. to fill jfit paramters)
IDL> jfit_to_tilt
IDL> lx_gm = 1 ; select order
IDL> effics = tilt_effic(energies)
xrtf
- X-GEF PSPC Basic S/W
- pspc_read_events.pro
- pspc_dither.pro
- pspc_calib.pro
- pspc_picture.pro
- pspc_[x,y,e]hist.pro
-
Routines to read, calibrate, select, and display X-GEF PSPC
"images". It is useful to run xgef_analysis (below) with
no keyword options in oder to set up the mapping from
a useful PSPC file name (e.g., 'PSPC[]HEG7#31') to
the date-time coded file name. Files can then be
manipulated and displayed. Example:
IDL> pspc_directory = 'caliber/d9/970721'
IDL> xgef_analysis
IDL> pspc_read_events, 'PSPC[]HEG7#38'
IDL> pspc_dither
IDL> pspc_calib
IDL> pspc_picture
IDL> pspc_selected = where( ABS(pspc_dx) LT 5.0 )
IDL> pspc_picture
IDL> pspc_xhist
IDL> pspc_yhist
IDL> pspc_ehist
- X-GEF Simulation S/W
- xrtf.pro
-
This procedure simulates the X-GEF setup for a PSPC measurement.
The various parameters are kept in commons and can be set from
a FITS data file with the fits_fill_ps prodecure. Parameters
of the form "xr_" control the coarse simulation properties
(e.g., xr_nr is number of rays simulated.)
IDL> pspc_directory = 'caliber/d9/970721'
IDL> xgef_analysis
IDL> fits_fill_ps, 'PSPC[]HEG7#38'
IDL> xrtf
IDL> xr_nr = 10000
IDL> xrtf
- X-GEF Optic S/W
- dh_play.pro
-
Procedure to simulate the 1D focussing optic in X-GEF
and do a quasi ray-trace of it. (The "dh_" prefix
refers to Don Humphries, Mechanical Engineer, who designed
and had fabricated the piezo-bent-optic assembly.)
xgef_anc
Ancillary files used to record X-GEF calibration parameters
and "analysis driver" files to support analysis of the various
X-GEF test procedures.
xgef_test
The highest-level directory for software that carries out X-GEF analysis.
- X-GEF Documentation
- X-GEF Routine Analysis s/w
-
xgef_analysis.pro
-
Main X-GEF analysis s/w - top level routine. Summary of use:
IDL> pspc_above_dir = '/nfs'
IDL> pspc_directory = 'caliber/d9/980106'
IDL> xgef_analysis, /SUMMARY, /PSPC_CAL
IDL> xgef_analysis, /SMD, /SSD, /PSPC_ANAL, /PSPC_FITS,/AMP, /TILT
IDL> xgef_analysis, /LOGIT
- test_dirs.pro
- xgef_read_dirs.pro
-
XGEF_valid_dirs.txt
-
The file XGEF_valid_dirs.txt (located in the
directory !DDGSDIR) lists the directories of all valid
X-GEF tests. The function test_dirs() returns an array
valid directories as read by xgef_read_dirs.pro.
IDL> dir_array = test_dirs()
-
gs_xgef_fill.pro
-
gs_xgef_effic.pro
-
These two routines are used to fill the "gs_xgef" variables
in common, which can then be written to the GratingStatus.xgef.txt
file.
gs_xgef_fill.pro reads a FITS file in the directories
given by the XGEF_valid_dirs.txt file to determine which facets
were tested - and enters this directory into
gs_xgef_dir.
gs_xgef_effic.pro loads the averaged results of the grating
region subtests into the gs_xgef_[thk, line, 1keV, 4keV, 8keV] arrays.
IDL> gs_load_all ; load current data files
IDL> old_dirs = gs_xgef_dir ; save current directories
IDL> gs_xgef_fill ; update directories
Now update all lines which have changed:
IDL> changed = where(old_dirs NE gs_xgef_dir)
IDL> for ic = 0, n_elements(changed)-1 do gs_xgef_effic, changed(il), changed(il)
IDL> gs_xgef_write, /LAZY ; save the results
- X-GEF Diagnostic s/w
- ssd_ref_hist.pro
- ssd_ref_plot.pro
-
Routines to make plot of SSD-derived reference grating efficiency
vs time.
IDL> ssd_ref_hist, 'HX220' [or 'MX078']
IDL> pre_print_landscape
IDL> ssd_ref_plot
IDL> post_print
xgef_verif
- X-GEF Verification Simulation
- xgef_sim.pro
-
Procedure to simulate a set of X-GEF measurements in order to
test/verify the analysis software.
meta
Procedures in this directory generally make use of LR and X-GEF
data together for grating counting, selection, etc. The "GratingStatus"
spread sheet data, LR data, and X-GEF data are all available through
the gs_common variables as described
briefly in a memo (1/23/96).
- Subassembly Grating Information
- gs_load_all.pro
-
- gs_list.pro
-
- gs_lr_update.pro
- Go through all the gratings and find the most recent
LR data file for each grating and update gs_lr data that
has changed.
IDL> gs_lr_update
- Flight Grating Slection and Plots
- Vacuum Storage Grating Analysis
- vsg_info.pro
-
Procedure capturing vacuum storage grating analysis - contains
multiple internal sections for various purposes...
XRCF and Cal Product Related
cmdb
- General CMBD Interface
- cmdb_load.pro
- cmdb_list.pro
- cmdb_mini_list.pro
-
Procedure to fill cmdb_common variables from a CMDB file.
IDL> cmdb_file = 'tot_req_run.cmdb'
IDL> cmdb_load
IDL> cmdb_list
IDL> cmdb_mini_list, where( STRPOS(cmdb_fields(*,c_X_ray_target_line),'Cr') GE 0 )
- CMDB - XRCF support
- cmdb_make_locs.pro
-
Procedure to create locations (.loc) files for use with
HXDS "3D" and "dF" scans.
IDL> cmdb_make_locs, array_of_lines, /MAKE
- XSS Source Spectra
- xss_sim.pro
- Procedure to simulate the source spectrum based on a line of the CMDB.
For EIPS sources it makes extensive use of the labxray routine
labx_tubespec.pro.
IDL> xss_sim, cmdb_line_number [, /NO_BND, /NO_PLOT, ITER=1 ]
xrcf
- General XRCF
- xrcf_params.pro
-
Procedure to return useful values of xrcf parameters. The
values are returned through (optional, as desired) keywords.
IDL> xrcf_params, HC=hc, FOCAL_LEN=focal_len
IDL> xrcf_params, NAMES=names, PERIODS=periods, ANGLES=angles, ROWLANDS=rowlands
IDL> xrcf_params, HSI_PIXEL=hsi_pixel, HSI_ANGLE=hsi_angle, TOGA_RC=toga_rc
- xrcf_hsi_read.pro
-
Procedure to read the MST HSI fits file (hsi[runid]iN.fits) and
return a structure with Y, Z, and PHA. The /FAC converts the
Y and Z to facility Y and Z in microns w.r.t. HSI aim point.
/PBLURR blurrs the positions by +/- 0.5 pixel to remove aliassing
in future binning steps.
IDL> hsi = xrcf_hsi_read('/nfs/spectra/d6/970116/hsi109001i2.fits',/FAC,/PB)
IDL> plot, hsi.y, hsi.z, PSYM=3
- xrcf_loc_file_read.pro
-
Procedure to return the X, Y, Z values in a locations file.
IDL> xrcf_loc_file_read, 'E-HXS-3D-32.008', Xloc, Yloc, Zloc
- HSI Analysis and Source Spectra
- hsi_source_spectra.pro
- Extract a measured spectrum from an HSI measurement. Also compare
the spectrum with source-model prediction.
- hsi_do_source_spectra.pro
- Execute hsi_source_spectra for all relevant HSI TRW IDs, create
web page of results, etc.
- ACIS XRCF Analysis
- psu_view.pro
-
Procedure to read in the PSU-created FITS file for a given TRW ID
and create useful plots and "Level 1" output product.
View the data:
IDL> psu_view, 'H-IAS-MC-3.013'
Create IDL-save and FITS file outputs (no plots):
IDL> psu_view, 'H-IAS-MC-3.013', /SAVE, /FITS_OUT, /NO_PLOT
Process many files of similar kind:
IDL> psu_view, 'H-HAS-EA-*', /SAVE, /FITS_OUT, /NO_PLOT, /PROC
- asca_of_flight.pro
-
Function to convert an array of flight grades into ASCA grades.
- hrc_view.pro
-
Procedure to read in the ASC-created FITS level 1 files for a given ASC TRW-ID
code (or combined TRW ID)
and create useful plots and "Level 1" output product in IDL save format.
IDL> hrc_view, '*ghhi*'
IDL> hrc_view, '*ghhi*',/PROCESS,/SAVE
marx
- Generally useful for MARX output
- xye_image.pro
-
Procedure to create an intensity-color coded image with intensity
representing number of counts and color representing average energy
in bin. See xye_image.pro header comments for calling options.
Heavilly based on Dave H routine mk_color_image.pro!
IDL> xye_image, X, Y, E, MARX_DIR = 'dir_specification'
- mk_color_image.pro,
make_image.pro
-
DaveH's routines that are the heart of xye_image.pro.
- MARX XRCF simulation
- xrcf_sim.pro
-
Simulate an XRCF measurement using MARX.
IDL> xrcf_sim, 'E-HXS-3D-32.008'
- sim_all_acis.pro
- sim_all_hrc.pro
-
Find and simulate all ACIS(HRC)-Grating measurements using xrcf_sim/MARX;
also create web table and web pages for the measurements.
IDL> sim_all_acis, /SIM, /FORM, /TABLE
IDL> sim_all_hrc, /SIM, /FORM, /TABLE
Aeff_calc
These routines are used for predicting flight effective areas
for HETGS/LETGS configurations.
- Effective Area Calculations (e.g., for PIMMS)
- main_hetg_m.pro, main_letg_m.pro
-
- ACIS-S Chip Gap Locations
- hetgs_gaps.pro
- Creates .tex tables of HETG/HETG gap
locations in energy:
IDL> hetgs_gaps
lrf
OAC and GTO Software
marx
- MARX Flight simulation
- flight_sim.pro
-
Simulate flight measurements using MARX.
IDL> flight_sim, 'O-HAS-Capella-3.001'
obscat
MIT Accessibility