mips_simulator mips_simulator On this page: Setting up mips_simulator Running mips_simulator Examples Input/output for mips_simulator Steps of Procedure One purpose of mips_simulator is to create a test image FITS file with the proper header information, so that the file can be run through the rest of the DAT. It can also be used as a tool to practice using AORs or to verify what they are requesting. You can make an AOR using SPOT (SIRTF Planning Observations Tool), then give it and a fits file of something similar to what will be observed to mips_simulator to see what a likely output will be. Setting up mips_simulator Software requirements: You'll need perl (standard on most linux distributions), PDL and perl-pgplot (for the visualizer only), and the perl interface to CFITSIO, version 1.00. For Redhat 7.x: You can download pgplot, perl-pgplot and PDL here: PGPLOT - pgplot-5.2.2-2.i386.rpm PERL-PGPLOT - perl-pgplot-2.18-1.i386.rpm PDL - PDL-2.3.2-1.i386.rpm For Redhat 8.x: You can download pgplot, perl-pgplot and PDL here: PGPLOT - pgplot-5.2.2-3.8.0.i386.rpm PERL-PGPLOT - perl-pgplot-2.18-11.8.0.i386.rpm PDL - perl-PDL-2.3.4-2.i386.rpm Or Redhat 8.x RPMs can also be found at Tim's RPM shack: http://caliente.as.arizona.edu/~tim/RPMS/. If you are a root user, you can install these by typing: rpm -Uvh name.rpm They should be installed in the order listed above. CFitsIO For Redhat 8.x (and Redhat 9.x) : You will need to download the following three files: cfitsio-2460-1.i386.rpm perl-Astro-FITS-CFITSIO-1.01-1.8.0.i386.rpm perl-Astro-FITS-Header-2.6.2-1.8.0.i386.rpm They can also be found at Tim's RPM shack:http://caliente.as.arizona.edu/~tim/RPMS/8.0-custom/RPMS/ If you are a root user, you can install these by typing: rpm -Uvh name.rpm For Redhat 7.x : The cfitsio module for Redhat 7 is a bit more challenging. You can download it here: Astro-FITS-CFITSIO-1.00.tar.gz or from its source at http://hea-www.harvard.edu/~rpete/cfitsio/. You can put this file anywhere convenient. gunzip Astro-FITS-CFITSIO-1.00.tar.gz tar -xf Astro-FITS-CFITSIO-1.00.tar You will also need the include file: cfitsio_include.tar - Untar this in /usr/local/include It also uses the library libcfitsio.a, which was compiled on a redhat 7.2 system. The source is http://heasarc.gsfc.nasa.gov/docs/software/fitsio/fitsio.html if you wish to compile it yourself. It is already included in the DAT package in Pipeline/DAT/lib/CFitsIO. In your Astro-FITS-CFITSIO-1.00 directory, 1. change the paths in the Makefile.PL: "'LIBS' => ['-L/home/username/Pipeline/DAT/lib/CFitsIO -lcfitsio -lm']," "'INC' => '-I/usr/local/include/cfitsio/'," 2.perl Makefile.PL OPTIMIZE=-O 3. make 4. make test 5. If you want, compare the output of the testprog/testprog*.pl scripts to cfitsio's testprog.c. There is a small shell script - runtests - included to make this easier. 6. make install (you need to be root) All of this written up in the is in the INSTALL file in Astro-FITS-CFITSIO-1.00. Scripts No compiling is required. You should be able to execute the scripts however you're most comfortable, e.g., typing the path directly, setting up an alias, putting the directory in your path, or soft-linking the executables to a directory in your path. For example, if you are running bash, set an alias in your .bashrc file: alias mips_simulator='/home/username/Pipeline/DAT/mips_sim/mips_simulator' or in .cshrc alias mips_simulator '/Pipeline/DAT/mips_sim/mips_simulator' for csh. As of DAT Version-2, the image extraction routine in the simulator is a c++ program that replaces the old perl version. If you would like to use the old version, use the -f option. The main difference is that the new version puts in the tangent plane projection, so that mips_enhancer can take it out correctly. You can also add distortion with the new version. Running mips_simulator Options for Running mips_simulator You should now be able to run mips_simulator from the directory Pipeline/DAT/mips_sim. Try this out by running it without any arguments to get a list of command line options: mips_simulator This should produce the following output on your screen: Usage: mips_simulator [options] FITS_file[.fits] AOR_file[.aor] -a 24, --array=24 : only output 24 micron array data -a 70, --array=70 : only output 70 micron array data -a 160, --array=160 : only output 160 micron array data -c, --cosmicray : add cosmic rays to raw data -d, --diagnostic : output extra diagnostic information -f, --fallback : fall back to perl image extractor (original version -DAT1-81 and before- does not do tangent plane projection) -h, --help : display this help and exit -l, --list : list offsets (implies -q) -n, --no extract : no image extraction (useful with -l) -o, --output : Specify the base name of the output file. If not specified via this option, the base name will be the input FITS file name (minus the .fits). Either way, I'll append .(array).fits to the name. -p, --photnoise : add photon (and read) noise to raw data -q, --quiet : suppress informative output -r, --raw : create raw data - The output contains dark current and stimflashes (on the Ge:Ga arrays) and is put in separate files with a .raw extension. -s, --show : show AOR visualization -t, --no tangent : do not do tangent plane projection. This should produce output very similar to that produced using the -f option. -v, --version : output version information and exit -w, --oldwcs : output old-style WCS keywords CDELTn and CROTA2 -x, --x offset=OFFSET : add offset (arcsec) in the x (R.A.) direction -y, --y offset=OFFSET : add offset (arcsec) in the y (DEC) direction -z, --distortion : simulate distortion Examples for mips_simulator This is from the EXAMPLE file in /Pipeline/DAT/mips_sim. To better see the visulization mode, use the file starfield.fits with the AOR phot24.aor. Shift-left mouse click to download these. Use the visualization mode (without extracting data) to check the DCE positions: mips_simulator -n -s starfield.fits phot24.aor If you're familiar with PGPLOT, you'll recognize the plotting options presented to you. For example, if you're running Xwindows, you can usually choose "/xserve" to plot the visualization to your screen. The different arrays are color coded: 24 micron is blue, 70 is green, and 160 is red. Things look good, so we'll extract the data, using -a 24 to indicate we only want 24um data and using -o to put the output into test.24.fits: mips_simulator -a 24 -o test starfield.fits phot24.aor We could simulate a second pointing offset by a few arcseconds by using the -x and -y options. This also has distortion because of the -z: mips_simulator -a 24 -o test2 -x 5 -y 7 -z starfield.fits phot24.aor The file lmc_mips70_sim.fits and the AOR phot70.aor can both be found in the mips_sim directory. You can use them to test the program as well. Since it is 70 micron data, simply use -a 70 instead of -a 24. mips_simulator -a 70 -o test3 lmc_mips70_sim.fits phot70.aor mips_simulator Input and Output Input The input is a FITS file and an AOR file. The FITS file should be a simple (no extensions) 2-dimensional FITS file. It should contain WCS parameters CRVALn (RA and DEC in decimal degrees), CRPIXn, and CDELTn or CD matrix (which are expected to indicate the pixel scale in decimal degrees). Your intended target should be in the center of the image. One example of this is the file "lmc_mips70_sim.fits". The AOR file can be any MIPS Photometry (24 micron, 70 micron fine and wide scale, 160 micron), MIPS Scan Map AOR, and a "crude" output of SED mode (data is all 1's). These can be created using SPOT (SIRTF Planning Observations Tool). Output The default output files will use the input file name and output all three arrays, such that you get a .24, .70, and .160 file as output. If you use the -o and -a parameters, the name of the output file is "what ever's after -o"."24/70/160 after -a".fits. For example mips_simulator -a 70 -o test lmc_mips70_sim.fits phot70.aor Produces "test.70.fits". Each output DCE can be taken as an ideal, noiseless observation. Stimflash DCEs are included in the sequence, although no stimflashes have actually been added to the data. As of DAT Version-2, the mips_simulator will also add a tangent plane projection automatically and will add a distortion if asked. To turn off the tangent plane projection, use the -t option. To turn on the distortion use the -z option. Positions For each DCE in the sequence, the script computes the position of a fiducial point, currently the center of the 24um array. If the requested AOR is a scan, the script computes all the positions itself, using the stimcycle length specified in the instrument parameters file. If the AOR is photometry, the positions for one cycle of each supported mode are listed in a separate .pos file. The .pos files contain a list of desired point-source positions, in pixels, relative to the center of the array. This format might seem a little odd, because of course the script has to move the array in the opposite sense to get the source to land where desired, but it makes it easy to translate the descriptions in the observer's manual into a photometry capability for the script. The script assumes that photometry is done in two halves, so it splits the list of positions in two and assumes that the first position in each list half is a stimflash (for Ge:Ga arrays only). It will add any stimflash backgrounds that it needs, so don't list them in the .pos files. Put another way, the .pos files contain the positions of one complete stimcycle on each half of the array. Note that if you want a custom list of positions (e.g., for some specialized IER), you may be able to simply modify a .pos file to trick the simulator into doing what you want. Try using the -n, -l, and -s options to examine what the simulator is doing without extracting any data, until the .pos file does what you want. Steps of Procedure mips_simulator works by first parsing the command line used to invoke it. It then reads in a list of instrument parameters - items that don't change often (e.g., array format, pixel sizes) should be listed there (set_instrument_parameters.pl). It then parses the AOR file and uses the AOR parameters and the instrument parameters to compute a sequence of DCE positions for the AOR described in the AOR file. It will only use the first AOR in the file, but it'll tell you which AOR that is (and put that information in the output image headers, too). For each position and for each array, the script extracts a DCE from the input FITS file using the proper pixel size for each of the MIPS arrays. To do this, it computes the area of the input image covered by each MIPS pixel. It takes the array FOV offset from the instrument parameters file, so it knows where the Ge:Ga arrays are relative to the Si:As array. Each output pixel is the sum of the input pixels covered by the area of the output pixel, weighted by the area of the coverage. Thus, input pixels fully covered by the output pixel receive full weight, while an input pixel on the edge of the area covered by the output pixel receives only partial weight. Any area outside the input image receives zero weight, so if (for example) your scan map extends off the edge of your input image, the area outside the input image will be set to zero. The results are placed in a set of FITS files with extensions, one for each array. Raw data can be simulated with the -r option. The output contains dark current and stimflashes (on the Ge:Ga arrays) and is put in separate files with a .raw extension. This output can be run through mips_sloper. Stimflash DCEs are included in the sequence, although no stimflashes have actually been added to the data. Things mips_simulator Does Not Do Target types other than "FIXED SINGLE." Other fixed target types (e.g. cluster, raster) can be emulated using the --xoffset and --yoffset command-line options. Those of you who want moving targets are on your own, sorry. AOT types other than "MIPS Photometry" and "MIPS Scan Map." Correctly emulate photometry cycle numbers > 7. Cycles > 7 are simulated, but the extra spacecraft offset is not included. Correctly emulate 160um large-field photometry cycle numbers > 1. The simulator uses more spacecraft offsets than required. Use the coordinates in the AOR file. For now, the simulator assumes your target is in the center of your FITS image. Simulate the proper orientation of the FOV on the sky. It always assumes that axis 1 is RA, axis 2 is DEC, and that the scan mirror axis is along axis 2. Thus, scan legs are always oriented along axis 2. Guarantee that forward/reverse scans move sources across the array in the right direction.