ChangeLog for omdetect
=========================
Version 5.0.7 - 2005-08-09 (CB)
--------------------------------
        Made a small modification to omdetectdetection_mod.f90 to make
	the number of pixels above the background to be a minimum of 2
	for those pixels to be checked for a possible source (fixes SPR 3492).
	Also made minor modification to grism detection module to fix zeroth
	order sources lying close to first order sources being missed.
        Removed some test statements to reduce execution time. Updated
	documentation. Removed some redundant code.
Version 5.0.6 - 2005-06-10 (CB)
--------------------------------
        Additional line of code added to subroutine mergeextendedsources
	in omdetect_mod.f90 to fix SPR 3477 (extended sources being 
	misclassified)..

Version 5.0.5 - 2005-06-09 (CB)
--------------------------------
        Reduced image size in test harness and increased parameter nsigma to 
	prevent test-harness failure due to timing-out (fixes SPR 3475)

Version 5.0.4 - 2005-06-08 (CB)
--------------------------------
        Added a call to subroutine aperturephotometry in suboutine
        fastdetection to make the fast-mode source-list files
	similar to those produced by earlier versions (fixes SPR 3466)

Version 5.0.3 - 2005-05-24 (CB)
--------------------------------
        Further small mod to  fix SPR 3459.

Version 5.0.2 - 2005-05-24 (CB)
--------------------------------
        Added check to prevent an array-bound error when a source is detected close
	to edge (fixes SPR 3459).

Version 5.0.1 - 2005-05-23 (CB)
--------------------------------
        Ammended Makefile in config directory to fix SPR 3456.
	
Version 5.0 - 2005-05-20 (CB)
--------------------------------
        Incorporates many improvements - better detection of faint-
	sources, sources with close neighbours and extended sources.
	Better classification of sources and additional flags set.
	A background image is produced which can be viewed.
	

Version 4.19.5 - 2004-03-02 (CB)
--------------------------------
        Made a minor modification to subroutine imagedetection to fix
	a failure when the parameter detectextended=false (couldn't raise 
	an SPR because netscape not working here).
	
Version 4.19.4 - 2004-02-27 (CB)
--------------------------------
	A small modification has been made to the grism-detection routine,
	so that the actual source-detection routine is run 3 times with
	decreasing image threshold values. This reduces the risk of
	bright detected spectra being contaminated by scattered light
	which prevents omgrism from constructing spectra for them
	(fixes SPR 3261).
	
	
Version 4.19.3 - 2004-02-19 (CB)
--------------------------------
	Ammended omdetectdetection_mod.f90 to carry out another search
	for point-sources after main search, using smaller radii to 
	compute counts, which enables more fainter sources to be detected and
	also more sources that are in close proximity to another one
	(fixes SPR 3252).
	
	
Version 4.19.2 - 2004-01-06 (CB)
--------------------------------
	Ammended module omdetectdetection_mod to fix compilation failure 
	on TRU 64 at MPE (fixes SPR 3192). Ammended parameter constant
	in omdetectdetection_mod and added check in omdetect_mod for fast
	mode data to check that a source has been detected by point-source
	detection algorithm- if not extended-source detection made to find
	possible source.
	
Version 4.19.1 - 2003-12-12 (CB)
--------------------------------
	Module matrix_mod deleted to fix build problem 
	on Darwin 6.8 (fixes SPR 3174)
	
Version 4.19 - 2003-12-11 (CB)
--------------------------------
	Some source-detection parameters adjusted.
	
	
Version 4.18 - 2003-12-09 (CB)
--------------------------------
	Some paremeters for grism source-detection tweaked.
	
	
Version 4.17 - 2003-12-05 (CB)
--------------------------------
	Improved detection alogorithim added for grism spectra.
Version 4.16 - 2003-11-21 (CB)
--------------------------------
	DEPEND file ammended for ssclib 3.0
	
Version 4.15 - 2003-11-19 (CB)
--------------------------------
        A couple of minor changes for ssclib version 3.0.
	
Version 4.14 - 2003-11-12 (CB)
--------------------------------
        Added check for zero detected sources to prevent array problem.
Version 4.13 - 2003-10-10 (CB)
--------------------------------
        Added optional parameter "background" to enable the user
	to fix the global background value for source-detection.
	Module omdetectdetection moved into mssllib, since it 
	is now also needed by omgsource.
	
Version 4.12 - 2003-08-13 (CB)
--------------------------------
	Documentation correction for SPR 3088. 
Version 4.11 - 2003-07-16 (CB)
--------------------------------
	+ (src/omdetection_mod.f90) A parameter adjustment to extended
	source detection routine for grism data.
	
Version 4.10 - 2003-07-14 (CB)
--------------------------------
	+ (src/omdetection_mod.f90) A couple of minor modifications made
	to reduce executiuon time.
	
Version 4.9 - 2003-07-11 (CB)
--------------------------------
	+ (src/omdetecttest_mod.f90) Parameter adjustment for grism data..
	
Version 4.8 - 2003-06-17 (VNY)
--------------------------------
	+ (test/testomdetecttest) some lines in the testomdetect script are 
	uncommented to ensure the correct finishing of the test
	
Version 4.7 - 2003-06-03 (CB)
--------------------------------
        + (src/omdetecttest_mod.f90) Minor mod to fix build problem.
	
Version 4.6 - 2003-05-07 (CB)
--------------------------------
        + (src/omdetect_mod.f90) Added OmConstants_mod to list
	of modules to fix build problem.
	
	
Version 4.5 - 2003-05-01 (CB)
--------------------------------
        Minor modification made to enable it to be used in the omgrism chain.
	
Version 4.4 - 2003-04-29 (CB)
--------------------------------
        A couple of minor modifications made to rectify problem reported 
	on xmmsas-20030427-0057.
	
Version 4.3 - 2003-03-15 (CB)
--------------------------------
        Now uses modules in mssllib to perform photometry, smooth image,
	create source-list file and compute magnitudes, as will omsource shortly.
	
Version 4.2 - 2003-14-02 (CB)
--------------------------------
        Uploaded into development track.
	
Version 4.1.11 - 2003-14-02 (CB)
--------------------------------
        Corrected 0.5 pixel error in positions & reduced size of centroiding
	box to reduce contamination by nearby sources (fixes SPRs 3071 &
	3077). Made small improvements to source-detection routine (to fix
	SPR 3078). Point-source detection algorithm now searches for
	sources in order of decreasing pixel value. Faint sources now less
	likely to be missed.
	
Version 4.1.10 - 2003-01-08 (CB)
--------------------------------
	+ (src/omdetect_mod.f90) Modified to obtain ccdframe time
	 and deadfraction from wdx file if not present in image header,
	so that omdetect is backwards compatible with old images.
	added optional parameter wdxset to config file to get information.
	

Version 4.1.9 - 2002-12-20 (CB)
--------------------------------
	Remove write statement in omdetectbackground_mod.f90

Version 4.1.8 - 2002-12-18 (CB)
--------------------------------
	Documentation correction.

	
Version 4.1.7 - 2002-12-03 (CB)
--------------------------------
	Test harness ammended to fix test failure.
Version 4.1.6 - 2002-12-03 (CB)
--------------------------------
	Ammended program to fix SPRs 3039 & 3035.
Version 4.1.5 - 2002-11-01 (CB)
--------------------------------
	Ammended program to fix SPRs 3018 & 3019.
Version 4.1.4 - 2002-11-01 (CB)
--------------------------------
	Blundered in making minor code modification.. 

Version 4.1.3 - 2002-11-01 (CB)
--------------------------------
	Minor ammendment to code that validates extended source. 

Version 4.1.2 - 2002-10-29 (CB)
--------------------------------
	Test harness modified to cure failure. 

Version 4.1.1 - 2002-10-24 (CB)
--------------------------------
	+ (src/omdetectdetection_mod.f90) Modified to deal better with
	sources surrounded by strong mod-8 patterns.

Version 4.1 - 2002-10-15 (CB)
--------------------------------
	+ (src/omdetectphotometry_mod.f90) modified to do extended
	photometry more accurately. New columns in source-list added.
	Source detection algorithm improved. Program tidied up.


Version 3.5.7 - 2002-07-11 (CB)
--------------------------------
        Code tidied up. Number of connected pixels in a source
        limited to maximum of 10000 to prevent program crashing
	(fixes SPR 2851) 
        New source detection routine (in module sourcedetection)
        added to detect point sources that the original source
        detection code misses in extended source regions. Memory
        requirements reduced. Two minor bugs fixed. 


Version 3.5.5   2002-03-26 (CB)
--------------------------------
	Some write statements removed.

Version 3.5.4   2002-03-14 (CB)
--------------------------------
	Documentation corrected.
	
Version 3.5.3   2002-01-28 (CB)
	+ (src/omdetectphotometry_mod.f90) Code for getting the background
	mode from a histogram of sky values replaced with a more reliable 
	method and pixels in the vicinity of sources excluded (fixes SPR
	2780). In doing this the magnitudes are more reliable (fixes SPR
	2731). Background map found to be okay (SPR 2764).
	
	

Version 3.5.2   2002-01-28 (CB)
	+ (src/omdetectphotometry_mod.f90) Removed some write statements.
	Test harness ammended to prevent occasional failure when in fact
	program is working satisfactorily.

Version 3.5.1   2002-01-28 (CB)
	+ (src/omdetectphotometry_mod.f90) Modification made to trap a
	problem that occurred (SPR 2682) analysing a strange image that 
	caused the source detection algorithm to go hay-wire, resulting 
	in a crash- One initially detected source was subsequently
	analysed and split into about 80 sources (normally no more than
	3), causing an array bound crash. If this problem now occurs 
	omdetect will add the keyword "SRC_DET" to the source list file
	header, mentioning the problem- warning message also output 
	(Fixes SPR 2682).
	
Version 3.5 2002-08-02 (CB) 
___________
	DEPEND file ammended for SSCLIB

Version 3.4 2001-15-12 (CB) Minor improvements to source
        detection made - code for smoothing images modified so that a rectangle
	instead of a box can be made. Documentation ammended (SPR 2653)   

======================
Version 3.3 - 2001-11-22 (JBa)
------------
        + (doc/omdetect_description.tex): fixed documentation



Version 3.2.5   2001-11-02 (VNY)
	+ (test/createtest.f90, test/checkoutput.f90) calculation of exp
	and division operations are made more robusts
	
Version 3.2.4   2001-10-30 (CB)
	+ (test/checkoutput.f90) Array subscripting error rectified. 
	
Version 3.2.3   2001-10-23 (VNY)
	+ (src/omdetect_mod.f90) A protection against negative values
	was introduced before calculation of log and lnFactrl 
Version 3.2.2   2001-09-20 (CB)
	+ (src/omdetectsourceparams_mod.f90) Negative
	background-subtracted pixel values reset to zero to prevet
	crashing (fixes SPR 2605).
	
Version 3.2.1   2001-09-20 (CB)
	+ (src/omdetectsourceparams_mod.f90) Sources were being rejected
	if the source semi-minor axis squared, computed from the moments, 
	was negative (usually a the source is close to another one). A minor
	modification has been made to overcome this (fixes SPR 2602). 
        Test harness modified to conduct a test for the fast-chain. 	
Version 3.2   2001-09-20 (VNY)
	+ (src/omdetect_mod.f90) A bug in the sourcePars array indexation has been fixed. 
Version 3.1   2001-09-17 (VNY)
	+ (src/omdetect_mod.f90) Correction of X and Y positions 
	was introduced for the cases when the source is near 
	the edge of the field of view (only for the FAST mode).
	
Version 3.0.5   2001-08-20 (CB)
	+ (test/createtest.f90) The dimensions of the quality array
	set equal to those of the image (instead of 1, 1 as in 
	previous versions)- fixes SPR 2539. Some compiler warning messages
        eradicated.                     

	
Version 3.0.4   2001-08-07 (VNY, CB)
	+ (src/omdetect_mod.f90)    A code in the COMPUTEMODE routine
	which  causes underestimation of the background median value
        has been removed. The parameter TOLERANCE has been set to 1 pixel
	for the IMAGING mode and to the maximum of two sources semi major
	axis for the FAST mode chain (within the code eliminating 
        multiple sources). omMode variable has been introduced to
	differentiate FAST and IMAGING modes. In order to improve the
	program's detection ability, negative values appearing after 
	background substraction have been zeroed (in the detection routine)
        + (config/omdetect.par) Default value for contrast parameter set
	to 0.001 to improve source detection in regions contaminated by
	scattered light (fixes SPR 2515). Bug in background computation
	fixed (also SPR 2515).


                       	
Version 3.0.3   2001-07-28 (CB)
        + (src/omdetect_mod.f90) The photometry aperture radius is now
	fixed at 12 pixels, instead of being obtained from a call to get
	CAL_getApertureRadius (fixes SPR 2495). 


Version 3.0.2   2001-07-24 (CB)
        + (src/omdetect_mod.f90) In the first call to subroutine
	"smoothImage", the smoothing parameter has been changed back to
	its original value of 3 (it had been changed for the fast-chain
	but further tests have shown that the value 3 works okay for the fast-chain)  (fixes SPR 2490). 

Version 3.0.1   2001-07-24 (CB)
        + (src/omdetect_mod.f90) Array bounds for quality image array changed to
	start at 0 instead of 1 (fixes SPR 2482) 
	
	
Version 3.0   2001-07-20 (CB/VNY) Module "omdetectphotometry_mod.f90" added
        to do aperture photometry on the sources (SPR 2091). Quality flag for each
	source now set by omdetect (SPR 2092). Extra columns (source aperture radius,
	x and y positions) output by omdetect so that ommag can correctly
	convert the source counts to instrumental magnitudes. The extended
	flag for each source now set by comparing the gaussian-fit
	parameters with those fitted to the point-spread function. The
	confusion flag for each source set according to the distance to
	its nearest neighbour source. Boxscale parameter now should be 
	given in arcsecs (SPR 2094). Program split-up into more modules to
	make it easier to read and maintain. Some minor changes made to
	make it run faster. Program now works with filter "MAGNIFIER" (SPR 2192) 
        Algorithm for searching for overlapping sources modified. Some
	momory leaks rectified. The improvement in the photometry is
	quantified in the tex file.

	
Version 2.24.2 2001-05-01 (CB)
	Limiting plate count rate ammended so that the limiting counts per pixel is
	multiplied by the photometry aperture area (fixes SPR
	2090). Aperture radius obtained from CAL routine. Parameter
	"device" deleted and all pgplot code. Program also tidied up.
	
Version 2.24.1 2001-02-06 (CB)
	Removed old versions of omdetect.
	
Version 2.24   2001-01-11 (CB)
        + (src/omdetect_mod.f90) Program checks that mediam background >
	0.0 before calculating background limitomng count rate (fixes bug
	- SPR 2204)

Version 2.23   2001-01-11 (CB)
        + (src/omdetect_mod.f90) Program now stores the source background
	count rates in the source-list file so that ommag can correctly
	apply the corrections for coincidence losses, etc.


Version 2.22.2   2000-11-08 (JPDM)
        + (src/omdetect_mod.f90) Program now calculates the
	detection-limit count rate and outputs the value to the
	source-list file.

Version 2.22.1   2000-10-25 (JPDM)
        + (src/omdetectsourceparams_mod.f90) Fix argument list error in
        simplex code and rewrote nexttopostion to nearestNeighbourNewParam
	to remove recursive nature of call (fix run time problem at estec)

Version 2.22   2000-10-03 (AMK)
------------------------------
	+ (src/omdetect_mod.f90) Added 'White ' to the list of possible
	filters. Just covers the lower case of 'WHITE' which has been seen in
	cycle 0070 SAS file. Filter WHITE is also in the list.
	
Version 2.20   2000-10-03 (AMK)
------------------------------
	+ (src/omdetect_mod.f90) REplace call to getFilterId by OAL call
	to filterIdToInt
	
Version 2.19   2000-0904  (AMK)
	+ (src/omdetect_mod.f90) Reinstated the call to CAL_omGetPLa
	teScale.
	
Version 2.19   2000-0904  (AMK)
	+ (src/omdetect_mod.f90) added code to read in the quality array. 
	The task will have to be modified eventually so that the quality
	array is processed in order to deal with image pixels that are zero
	in the flatfield. Currently these problem image pixels have been
	sent to zero. 

Version 2.18.3 2000-06-22 (JPDM)
        + (src/omdetect_mod.f90) changed tolerance for extent flag (SSC-SPR-1865)
    
Version 2.18.2 2000-06-21 (JPDM)
    + (config/omdetect.info) fixed VISIBLE keyword (SSC-SPR-1859)
    
Version 2.18.1 2000-06-16 (AMK/JPDM)
--------------
    + (config/omdetect.info) added (SSC-SPR 1701)`
    + (src/omdetect_mod.f90) changed RA/DEC from 32 to 64 bit numbers in output file. (SSC-SPR-1769)
    + (src/omdetect_mod.f90) fixed problem with deblending sources giving spurious bad sources
    + (src/omdetect_mod.f90) fixed some memory leaks.
    + (src/omdetectsourceparams.f90) fixed part of deblending code.

Version 2.18: 28 April 2000

Modified documentation to conform to new requirements - SPR 1644
Also fixed checkoutput in test bed

Version 2.17: 14 March 2000

Removed superfluous call release causing seg. fault.
	
Version 2.16: 1 March 2000

Test harness fixed.	
array oveflow problem fixed	
	
Version 2.15: 21 February 2000

Added Cal to Makefile	
	
Version 2.14: 27 January 2000
	
Effectively complete rewrite of main routines in OMDETECT.  New source
detection (multiple scales) + extractor like deblend algorithm and source
parameterisation

Fixed small bug with background determination

Version 2.13: 06 January 2000

Add in flat field and mod8 noise image to create background map to compare
against raw image (maintains poisson nature of data)

Version 2.12.1 (Marco Beijersbergen, 199-12-15)
--------------
- fixed obsolete DAL call
- fixed message calls


version 2.12: 25 November 1999

Fixed problem with stripy images

version 2.11: 22 November 1999

Fixed problem with very small windows (i.e. fast mode windows)

version 2.10: 12 November 1999

Fixed bug in getCounts changed an nx-1 to ny-1

version 2.9: 09 November 1999

Changed background determination method to smoothing+sigma clipping
Changed source detection to sliding box including Poisson statistics if
	needed
	
version 2.8: 29 September 1999

Made omdetect exit cleanly when image is empty.

version 2.7: 28 September 1999

Added error when image is empty.

version 2.6: 24 September 1999

Added checks to allow processing of images with blank areas.

version 2.5: 8 June 1999

Updated Dependencies for V3 delivery.
Updated testomdetect for exit values.	
Updated parameters to comply with Standardisation Rules.
Added new subroutine getCounts to sum counts in an elliptical apperture.
		
Version 2.4: 4 May 1999

Updated DEPEND and src/Makefile for new structure of SAS
Updated 'message' calls in code for new error library.
RA column now produces sensible values	
	
Version 2.3: 10 December 1998

updated Dependancy file RE: mssllib	
	
Version 2.2: 22 October 1998

bug fix in checkoutput in test harness

Version 2.1: 15th Sep 1998

diagnostic message added to print out number of iterations
	
Version 2.0: 17th August 1998

Algorithm changed to an island search
Test harness improved

	
Version 1.5: 28th July 1998

images moved to primary array

Version 1.4: 25th June 1998

A workaround was included for the nagace do,while bug. This work around
simply consists of an additional line of output per iteration - it has
no impact on the scientific functionality

Version 1.3: 16th June 1998

SPR 410 closed: gotos replaced by exit
SPR 409 closed: file deleted
SPR 408 closed: .par file editted


Version 1.2

ChangeLog added
DEPEND file edited


Version 1.1: 8 May 1998

Task test harness updated
SPR 224 closed: access privs changed
SPR 225 closed: .par added
SPR 226 closed: fatal call changed to error
SPR 227 closed: copy deleted
SPR 230 closed: datestamp call removed
Version 1.0: 20 March 1998