1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
include <smw.h>
include "identify.h"
# ID_PEAK -- Find the peak value above continuum.
double procedure id_peak (id, pix)
pointer id # ID pointer
double pix # Pixel position
double peak # Peak value
int c, l, u
begin
if (IS_INDEFD(pix))
return (INDEFD)
c = nint (pix)
l = max (1, nint (pix - ID_FWIDTH(id)))
u = min (ID_NPTS(id), nint (pix + ID_FWIDTH(id)))
peak = IMDATA(id,c) - (IMDATA(id,l) + IMDATA(id,u)) / 2.
return (peak)
end
# ID_PEAKS -- Find peaks in the data. This just calls find_peaks but does
# the logical to physical pixel conversion.
int procedure id_peaks (id, data, x, npoints, contrast, separation, edge, nmax,
threshold, debug)
pointer id #I Identify pointer
real data[npoints] #I Input data array
real x[npoints] #O Output peak position array
int npoints #I Number of data points
real contrast #I Maximum contrast between strongest and weakest
int separation #I Minimum separation between peaks
int edge #I Minimum distance from the edge
int nmax #I Maximum number of peaks to be returned
real threshold #I Minimum threshold level for peaks
bool debug #I Print diagnostic information?
int i, n, np1, find_peaks()
double smw_c1trand()
errchk find_peaks
begin
# Find the peaks in logical coordinates.
n = find_peaks (data, x, npoints, contrast, separation, edge,
nmax, threshold, debug)
# Convert to physical coordinates.
np1 = NP1(ID_SH(id)) - 1
do i = 1, n
x[i] = smw_c1trand (ID_LP(id), double (x[i]+np1))
return (n)
end
# ID_UPEAKS -- Find uniformly distributed peaks in the data. This just calls
# find_upeaks but does the logical to physical pixel conversion.
int procedure id_upeaks (id, data, x, npoints, contrast, separation, edge,
nmax, nbins, threshold, debug)
pointer id #I Identify pointer
real data[npoints] #I Input data array
real x[npoints] #O Output peak position array
int npoints #I Number of data points
real contrast #I Maximum contrast between strongest and weakest
int separation #I Minimum separation between peaks
int edge #I Minimum distance from the edge
int nmax #I Maximum number of peaks to be returned
int nbins #I Number of bins across the data array
real threshold #I Minimum threshold level for peaks
bool debug #I Print diagnostic information?
int i, n, np1, find_upeaks()
double smw_c1trand()
errchk find_upeaks
begin
# Find the peaks in logical coordinates.
n = find_upeaks (data, x, npoints, contrast, separation, edge,
nmax, nbins, threshold, debug)
# Convert to physical coordinates.
np1 = NP1(ID_SH(id)) - 1
do i = 1, n
x[i] = smw_c1trand (ID_LP(id), double (x[i]+np1))
return (n)
end
|