1
C===========================================================================
2
C Copyright (C) 1995 European Southern Observatory (ESO)
4
C This program is free software; you can redistribute it and/or
5
C modify it under the terms of the GNU General Public License as
6
C published by the Free Software Foundation; either version 2 of
7
C the License, or (at your option) any later version.
9
C This program is distributed in the hope that it will be useful,
10
C but WITHOUT ANY WARRANTY; without even the implied warranty of
11
C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
C GNU General Public License for more details.
14
C You should have received a copy of the GNU General Public
15
C License along with this program; if not, write to the Free
16
C Software Foundation, Inc., 675 Massachusetss Ave, Cambridge,
19
C Corresponding concerning ESO-MIDAS should be addressed as follows:
20
C Internet e-mail: midas@eso.org
21
C Postal address: European Southern Observatory
22
C Data Management Division
23
C Karl-Schwarzschild-Strasse 2
24
C D 85748 Garching bei Muenchen
26
C===========================================================================
28
C+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
29
C.IDENT: subroutine CMPSUB version 1.1 870315
30
C A. Kruszewski Obs. de Geneve
31
C undersampled case version 2.0 880826
32
C A. Kruszewski Warsaw U. Obs.
33
C.PURPOSE: Subtracts stellar components in a subframe copied from image frame.
37
C A real*4 array input image array
38
C JAPY integer*4 array pointers to imege lines
39
C IBUF integer*4 limits of image buffer
40
C I integer*4 x-coordinate of object
41
C J integer*4 y-coordinate of object
42
C L0 integer*4 offset to catalog objects
43
C L1 integer*4 last object in catalog
44
C LW integer*4 last object written to file
45
C L integer*4 identification number of object
46
C M integer*4 actuall number of objects
47
C LSTP integer*4 array manage linked lists of pointers
48
C NREG integer*4 number of regional linked lists
49
C LHED integer*4 half edge size of subarray
50
C TRSH real*4 limiting threshold
51
C APSF real*4 array one-dimensional point spread function
52
C FPSF real*4 array two-dimensional point spread function
53
C IPSF integer*4 array pointers to two-dimensional p.s.f.
54
C LPXL integer*4 number of 2-d pixels
55
C LSBP integer*4 number of subpixels
56
C NCAT integer*4 array integer parameters array
57
C PMTR real*4 array real parameters array
58
C PRCT real*4 array catalog of one-dimensional profiles
59
C NP integer*4 dimension of catalog buffer
60
C NPAS integer*4 actuall iteration number
61
C HCUT real*4 saturation level
63
C AS real*4 array data subarray after subtraction
64
C JAPYS integer*4 array pointers to subarray lines
65
C IBUFS integer*4 array limits of data in subarray
66
C----------------------------------------------------------------------
67
SUBROUTINE CMPSUB (A, JAPY, IBUF, I, J, L0, L1, LW,
68
& L, M, NREG, LSTP, LHED, TRSH, APSF, FPSF,
69
& IPSF, LPXL, LSBP, NCAT, PMTR, PRCT, NPAS,
70
& AS, JAPYS, IBUFS, HCUT, MAS )
73
INCLUDE 'MID_REL_INCL:INVENT.INC/NOLIST'
76
INTEGER JAPY(1) , IBUF(4), NCAT(NIPAR,MAXCNT)
77
INTEGER JAPYS(2*MAXSUB+1), IBUFS(4)
78
INTEGER LSTP(0:4, 0:NREG)
80
INTEGER MAS((-MAXSUB):MAXSUB,(-MAXSUB):MAXSUB)
81
INTEGER I, IPSF(1), J, L, L0, L1, LHED
82
INTEGER LPXL, LSBP, LW
97
INTEGER LK, LN, LZ, LD
104
REAL AS((2*MAXSUB+1)**2)
105
REAL A(1), APSF(0:MAXSUB)
110
REAL PRCT( 0:MAXSUB, MAXCNT), PMTR(NRPAR,MAXCNT)
111
REAL PMT(NRPAR), PCT(0:MAXSUB)
122
IF ( LPXL .GT. 0 .OR. LSBP .GT. 0 ) THEN
129
LHED = MIN( MAXSUB , LHED )
130
SCALE = 9.0 / ( 1.0 + 8.0*APSF(1) )
133
C ****** Prepare subarrays.
135
IL1 = MAX( I-LHED , IBUF(1) )
136
IL2 = MIN( I+LHED , IBUF(3) )
137
JL1 = MAX( J-LHED , IBUF(2) )
138
JL2 = MIN( J+LHED , IBUF(4) )
148
JAPYS(ITMP) = (ITMP-1) * MXS + MAXSUB + 1
154
JOFS = JAPYS(JL-J-JOFFS)
156
AS(JOFS+IL-I) = A(JOF+IL)
160
C *** Start subtracting contributions from close components.
164
CALL GETLST( L , L0 , L1 , MDIS , NREG ,
165
& LSTP , NCAT , PMTR , PRCT , K ,
166
& NCT , PMT , PCT , DONE )
167
IF ( .NOT. DONE ) GOTO 30
169
C *** Ignore the L-th object.
171
IF ( K .EQ. L ) GOTO 32
173
C *** Look for close neighbour.
174
C *** Check first if K-th object is in buffer.
176
c IF ( K .LE. L0 .OR. K .GT. L1 ) THEN
177
c READ( ISF , REC=K ) NCT , PMT , PCT
181
NCT(KK) = NCAT(KK,LK)
184
PMT(KK) = PMTR(KK,LK)
186
KK2 = MIN( NCT(5) , MAXSUB )
188
PCT(KK) = PRCT(KK,LK)
191
IF ( PMT(2) .LE. TRSH ) THEN
193
C *** Too faint objects are not considered.
203
IF ( ABS(IDIF) .LE. LD .AND. ABS(JDIF) .LE. LD ) THEN
208
CALL STARSA( IOPC , AS , JAPYS , IBUFS , I ,
209
& J , LPXL , LSBP , NCT , PMT ,
210
& PCT , APSF , FPSF , NPAS , SCALE ,
212
IF ( CINT1 .GT. CINT ) THEN
221
C *** Write down the number of the brightest stellar component
222
C *** if it contribute more than 10 % to the central pixel.
225
IF ( CINT .GT. 0.1*PMTR(2,LZ) ) THEN
231
C *** Restore values of saturated points.
234
JOFS = JAPYS(JL-J-JOFFS)
236
IF ( MAS(IL-I,JL-J) .EQ. -1 ) THEN