#! /usr/bin/env isis-script % % This file is part of tg_find (finding zeroth order). % Copyright (C) 2006 Massachusetts Institute of Technology % % This software was developed by the MIT Center for Space Research under % contract SV3-73016 from the Smithsonian Institution. % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either < version number > of the % License, or (at your option) any later version. % % This program is distributed in the hope that it will be useful, but % WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU % General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; if not, write to the Free Software % Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA % %----------------------------------------------------------------------- % % File: tg_findzo % % Version: % % Authors: Bish Ishibashi % Date Created: 23 October 2006 % % % HISTORY: % This script is designed as a prototype. % % October 23, 2006: Semi-official introduction of the tool % % December 27, 2006: A small bug fix (non-CIAO part) % %========================= % % Purpose: This program is a s-lang wrapper for executing findzo.sl. % % Syntax: tg_findzo evt_file_name grating_type [guessing_mode, gx, gy] % % Input: % evtfile_name == Event L1.5 or 2 file. % grating_type == "h" (HEG), "m", or "l" (LEG). % guessing_mode == 1 = astrometry based % 2 = median filter based % 3 = dumb guess ([gx,gy]=[4096.5,4096.5]) % 4 = user specified guesses (sky gx and gy) % gx, gy == user-specified guess for source's sky position % % Example % by default, guessing_mode == 1: % % $> tg_findzo acisf0001N0001_evt1.fits m % % Or try something fancier. When using CFITSIO filtering, % do not specify the extention block name since it is set to % [EVENTS] by default (always true for Chandra Event files). % % $> tg_findzo acisf0001N0001_evt1.fits[energy=2000:8000] h 4 4090.2 4061.72 % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Version: commented out for now. % % private variable _version = [0, 9, 1 ] ; % major, minor, patch % % % Load the s-lang script findzo.sl first. The tool has to be % available somewhere in your ISIS path. % require("findzo"); % % Check for existence of CIAO environment; if present, load paramio % #if$ASCDS_INSTALL %+ paramio dependencies: add_to_isis_load_path( getenv("ASCDS_INSTALL") + "/share/slsh/local-packages" ); if ( ( _slang_version / 10000 ) >= 2 ) add_to_isis_module_path( getenv("ASCDS_INSTALL") + "/lib/slang/v2/modules" ) ; else add_to_isis_module_path( getenv("ASCDS_INSTALL") + "/lib/slang/modules" ) ; %- % % load paramio % require("paramio"); % % Parameter setting % private variable fp = paramopen(NULL, "rw", __argv); if (fp == NULL) verror("\n %% %S: No par file, or param specification error.\n", path_basename(__argv[0])); private variable infile, grttype, fltype, ix, iy, pl_device, verbose; infile = pget(fp, "infile"); grttype = pget(fp, "grttype"); fltype = pgeti(fp, "fltype"); ix = pgetf(fp, "ix_value"); iy = pgetf(fp, "iy_value"); pl_device = pget(fp, "pl_device"); verbose = pgeti(fp, "verbose"); % % pass on verbose and pl_device variables onto findzo.sl % set_findzo_verbose(verbose); set_findzo_plot_dev(pl_device); % % Run findzo % variable ox, oy; (ox,oy) = findzo(infile,grttype,fltype,ix,iy); % % Obtain output (x,y) values and dump them into a parameter file % pset(fp, "ox_value", ox); pset(fp, "oy_value", oy); paramclose(fp); % % If CIAO is not available do the following % #else #ifnexists atof private define atof (x) { () = sscanf (x, "%lf", &x); return x; } #endif #ifexists __argc #ifndef __INTERACTIVE__ switch (__argc) { case 3 : findzo(__argv[1],__argv[2]); exit(0); } { case 4 : findzo(__argv[1],__argv[2],atof(__argv[3])); exit(0); } { case 6: findzo(__argv[1],__argv[2],atof(__argv[3]),atof(__argv[4]),atof(__argv[5])); exit(0); } { findzo(); exit(0); } #endif % ifndef __INTERACTIVE__ #endif % ifexists __argc #endif % else