| 1 |
/* |
| 2 |
.VERSION |
| 3 |
031017 last modif |
| 4 |
*/ |
| 5 |
|
| 6 |
|
| 7 |
#include <stdio.h> |
| 8 |
#include <X11/Xlib.h> |
| 9 |
#include <X11/Xutil.h> |
| 10 |
#include <X11/Xos.h> |
| 11 |
#include <X11/Xatom.h> |
| 12 |
#define LO 0.05 |
| 13 |
#define UP 0.95 |
| 14 |
#define MOVE_WIN 1 |
| 15 |
#define MOVE_X1 2 |
| 16 |
#define MOVE_X2 3 |
| 17 |
#define MOVE_Y1 4 |
| 18 |
#define MOVE_Y2 5 |
| 19 |
#define STEPUP_X 6 |
| 20 |
#define STEPUP_Y 7 |
| 21 |
#define STEPDN_X 8 |
| 22 |
#define STEPDN_Y 9 |
| 23 |
#define DRAW "color=1" |
| 24 |
#define DRAWCOL "color=2" |
| 25 |
#define NODRAW "color=0" |
| 26 |
#define PLOTNAME "alice.plt" |
| 27 |
#define PLOTAPP "alice.plt/a" |
| 28 |
#define PLOTMODE 0 |
| 29 |
#define OVERMODE 1 |
| 30 |
#define MAXVALUES 30000 /* was: MAXVALUES 6000 */ |
| 31 |
#define MAXWINDOWS 10 |
| 32 |
#define STANDARDFONT 0 |
| 33 |
#define QUALITYFONT 1 |
| 34 |
#define GREEKFONT 2 |
| 35 |
#define SCRIPTFONT 3 |
| 36 |
#define OLDENGFONT 4 |
| 37 |
#define TINYFONT 5 |
| 38 |
#define CASEPRG 1 |
| 39 |
#define CASEBDF 2 |
| 40 |
#define OVERBDF 3 |
| 41 |
#define ZOPT 1 |
| 42 |
#define LOGOPT 2 |
| 43 |
#define INVOPT 3 |
| 44 |
#define LINEMODE 0 |
| 45 |
#define HISTMODE 1 |
| 46 |
#define POLYFITMODE 0 |
| 47 |
#define SPLINEFITMODE 1 |
| 48 |
#define NORMALPRINT 0 |
| 49 |
#define PORTRAITPRINT 1 |
| 50 |
|
| 51 |
int filterModStepWin, |
| 52 |
filterModWindWidth, |
| 53 |
filterWindWidth; |
| 54 |
|
| 55 |
int specModLineNum, |
| 56 |
specModLineStep, |
| 57 |
specInputFrame, |
| 58 |
specAbortCursor, |
| 59 |
specLineNum, |
| 60 |
specLineStep, |
| 61 |
specImno, |
| 62 |
specNilval, |
| 63 |
specNumData, |
| 64 |
specNaxis, |
| 65 |
specNpix[16], |
| 66 |
specDim; |
| 67 |
|
| 68 |
int specCurrCursor; |
| 69 |
int flush; |
| 70 |
int fitModFitDeg, |
| 71 |
fitAddFit, |
| 72 |
fitDegree, |
| 73 |
fitMode, |
| 74 |
fitPairNum; |
| 75 |
int gaussModNumOfComp, |
| 76 |
gaussModInitGuess, |
| 77 |
gaussFixOpt[27], /* boolean array */ |
| 78 |
gaussModMaxIterations, |
| 79 |
gaussModMinIterations, |
| 80 |
gaussNumOfComp, |
| 81 |
gaussNumOfSol, |
| 82 |
gaussNumOfFitData, |
| 83 |
gaussMaxIterations, |
| 84 |
gaussMinIterations; |
| 85 |
|
| 86 |
int plotModAngle, |
| 87 |
plotModSize, |
| 88 |
plotMode, |
| 89 |
plotDefaultTitle, |
| 90 |
plotFont, |
| 91 |
caseList; |
| 92 |
|
| 93 |
int LOOP, |
| 94 |
OverPlotMode, /* Redraw or not redraw mode */ |
| 95 |
ApplyOverPlot, /* boolean TRUE => overplot was applied */ |
| 96 |
OverPlotNum, /* number of overplot spectrum */ |
| 97 |
overPos; |
| 98 |
|
| 99 |
int rebinOption, |
| 100 |
rebinRebin; |
| 101 |
int ivalues[MAXVALUES]; |
| 102 |
|
| 103 |
int i, |
| 104 |
key, |
| 105 |
pixel, |
| 106 |
MonitorPid; |
| 107 |
|
| 108 |
float specX[MAXVALUES], /* current spectrum X values */ |
| 109 |
specY[MAXVALUES], /* current spectrum Y values */ |
| 110 |
specXaux[MAXVALUES], /* fit X values */ |
| 111 |
specYaux[MAXVALUES], /* fit Y values */ |
| 112 |
OverX[15][MAXVALUES],/* overplot spectrum X values */ |
| 113 |
OverY[15][MAXVALUES],/* overplot spectrum Y values */ |
| 114 |
specCuts[2], |
| 115 |
specClip[4], |
| 116 |
specDeltaCursor[100]; |
| 117 |
|
| 118 |
float overYmin, /* overplot Y limits */ |
| 119 |
overYmax; |
| 120 |
|
| 121 |
/* Midas window */ |
| 122 |
float specXmax, /* spectrum limits */ |
| 123 |
specXmin, |
| 124 |
specYmax, |
| 125 |
specYmin, |
| 126 |
specStep, /* image step */ |
| 127 |
specStart, /* image strat */ |
| 128 |
specXcen, /* frame central x value */ |
| 129 |
specYcen, /* frame central y value */ |
| 130 |
specDx, /* frame distance from central x to max. X */ |
| 131 |
specDy, /* frame distance from central x to max. Y */ |
| 132 |
specStepWin, /* window step */ |
| 133 |
|
| 134 |
/* AliceDrawingArea */ |
| 135 |
specXcenw2, |
| 136 |
specYcenw2, |
| 137 |
specDxw2, |
| 138 |
specDyw2, |
| 139 |
specXnorm, /* normalization factor (Midas window to AliceDrawigArea)*/ |
| 140 |
specYnorm; |
| 141 |
|
| 142 |
float specFluxReal; /* flux for integration command */ |
| 143 |
|
| 144 |
float specAxesXl, /* frame axes limits */ |
| 145 |
specAxesXu, |
| 146 |
specAxesYl, |
| 147 |
specAxesYu; |
| 148 |
|
| 149 |
double gaussErrors[27], /* gaussian fitting errors */ |
| 150 |
gaussAMatrix[28][28]; |
| 151 |
|
| 152 |
double gaussFitValues[27],/* continuum fit values */ |
| 153 |
fitPolyValues[20], /* continuum polynomial fit values */ |
| 154 |
fitXminPair[200], /* continuum limits */ |
| 155 |
fitXmaxPair[200]; |
| 156 |
|
| 157 |
float plotSize, |
| 158 |
plotAngle; |
| 159 |
|
| 160 |
double fitRms; |
| 161 |
|
| 162 |
int unit; |
| 163 |
|
| 164 |
char specImageName[80], |
| 165 |
specSaveName[80], |
| 166 |
specLastName[80], |
| 167 |
specFrameIdent[32]; |
| 168 |
|
| 169 |
char PrinterName[80]; |
| 170 |
|
| 171 |
char plotLabelX[80], |
| 172 |
plotLabelY[80], |
| 173 |
plotTitle[80]; |
| 174 |
|
| 175 |
Window wnds[MAXWINDOWS]; |
| 176 |
XPoint specPoints[MAXVALUES]; |
| 177 |
Pixmap p16[20]; |
| 178 |
Cursor p8[20]; |