/************************************************************************** An INTEGRAL/JEMX specific function library Function JEMXLIBpredmod will read the redestribution table in the JEMX IMOD group Call: pixel index Returns: pixel indices and fractions in regular array 2004-09-02 Version 1.0 Niels J. Westergaard Danish Space Research Institute Juliane Maries Vej 30, DK 2100 Copenhagen, Denmark Telephone +45 35325830, Fax +45 35362475, Email njw@dsri.dk NOTE: Memory for list_idx (11 long) must be assigned before calling this Memory for fraction (11 float) must be assigned before calling this The use of variable length columns implies that the data must be read row by row Remark: When creating a shadowgram in the regular grid there are two options: 1) first create a shadowgram in raw position and then transform the shadowgram - this operates on 65536 pixels 2) create the regular shadowgram directly from the raw positions event by event - this takes as many calls of this function as there are events In conclusion: When there are fewer than 65536 events it is less CPU consuming to use option (2) above - provided the random access is as fast as moving through the table from top to bottom. ************************************************************************/ #include int JEMXLIBpredmodGetRegPixels( dal_element ptr, /* Pointer to element JMXi-PRED-MOD */ long rawPixelIndex, /* RAWY * 256 + RAWX */ int *number, /* Number of regular pixels involved */ long *list_idx, /* Indices of regular pixels involved */ float *fraction, /* Fraction of raw pixel in reg. pixel*/ int chatter int status ) { long numValues = 0; startBin = rawPixelIndex + 1; endBin = rawPixelIndex + 1; daltype = DAL_INT; status = DALtableGetColBins( ptr, "NUMBER", 0, &daltype, startBin, endBin, &numValues, number, status); if( status != ISDC_OK ) { printf("##4## status = %d\n", status); return(status); } daltype = DAL_LONG; status = DALtableGetColBins( iptr, "LIST_IDX", 0, &daltype, startBin, endBin, &numValues, list_idx, status); if( status != ISDC_OK ) { printf("##4## status = %d\n", status); return(status); } if( numValues != (long) *number ) { printf("Warning ##3## numValues = %ld, number = %d\n", numValues, *number); } daltype = DAL_FLOAT; status = DALtableGetColBins( iptr, "FRACTION", 0, &daltype, startBin, endBin, &numValues, fraction, status); if( status != ISDC_OK ) { printf("##4## status = %d\n", status); return(status); } if( numValues != (long) *number ) { printf("Warning ##3## numValues = %ld, number = %d\n", numValues, *number); } return( status ); }