/* Copyright (c) 1993 Association of Universities for Research * in Astronomy. All rights reserved. Produced under National * Aeronautics and Space Administration Contract No. NAS5-26555. */ /* GETRADEC * * PURPOSE: * Extract a subimage from a plate by specifying the central position * RA,DEC and the size of the section NX,NY in pixels. * * CALLING SEQUENCE: * retval=getradec(h,object,ra,dec,nx,ny,image) * * INPUTS: * h (* Header) header structure * object (* char) name of object * ra,dec (double) center of image * nx,ny (int) size of image * * OUTPUTS: * image (short [ny][nx]) image section * h the header is updated to reflect the position of section * retval return value=0 if successful, -1 if failed because * image center was off edge of plate * * PROCEDURE: * The plate is assumed to be stored in compressed 500x500 blocks * (or 500x499 for the last row). The required blocks are decompressed * one at a time and stored into image. The header is updated to * include the current values of target RA, Dec, etc. If part * of the image is off the edge of the plate, zeros are returned. * A warning is printed if the entire image is off the plate and * -1 is returned. * * MODIFICATION HISTORY * Created by R. White, 5 August 1991 */ #include #include "header.h" extern void xypos(); extern void conrddms(); extern void getxy(); extern int getradec(h,object,ra,dec,nx,ny,image) Header *h; char *object; double ra,dec; int nx,ny; short image[]; { float mag, colour; float x,y; int rah,ram, decd,decm; float ras, decs; char decsign; /* * calculate center position in pixels */ mag = 0.0; colour = 0.0; xypos(h,ra,dec,mag,colour,&x,&y); if ( (x < 0) || (x>13999) || (y < 0) || (y > 13998) ) { fprintf(stderr, "warning: RA, Dec position lies off edge of plate %s\n", h->plate_name); conrddms(ra,dec, &rah,&ram,&ras, &decsign,&decd,&decm,&decs); fprintf(stderr, "X %f Y %f RA %2d %2d %6.3f Dec %c%2d %2d %5.2f\n", x, y, rah, ram, ras, decsign, decd, decm, decs); return(-1); } /* * extract image section */ getxy(h,object,x,y,nx,ny,image); return(0); }