subroutine attcalc * get input events * get instrument, mode and ccdid from events file * add X/Y columns to event table if they don't already exist * obtain CCF, set state * get refpointlabel (source of reference point information) * get RA\_PNT, DEC\_PNT and PA\_PNT from atthkset (atthkgen output file) if no file, use NOM values * set central reference point (nominalra, nominaldec) * get attitudelabel (source of attitude information) * if attitudelabel=fixed, get fixedra, fixeddec, fixedposangle * if attitudelabel=ahf or om, set attitudeFromAhf (AHF or OM) * loop through events if event time has changed (i.e. is frame different) then if (attitudelabel .ne. fixed) then call OAL_getAttitude (AHF/OM attitude information) identify if special case (e.g. dec=0, +90, -90) transform from spherical to parallel coords repeat above for a point 1 degree more north along the local meridian (the `help point'), to get the angle with the nominal meridian endif call getBoresightMatrix and apply boresight correction endif apply corrected attitude information to event DETX/DETY to get X/Y * end loop through events * add WCS parameters to events file * (calculation of and) adding of keywords to event file * add history to events file end subroutine attcalc