-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmyClass.h
158 lines (124 loc) · 5.2 KB
/
myClass.h
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
#ifndef MYCLASS_H
#define MYCLASS_H
#ifndef myTypeDef_H
#include "myTypeDef.h"
#endif
#include "Bounds.h"
// typedef tmv::Matrix<double> DMatrix;
// typedef tmv::Vector<double> DVector;
class c_Data {
public:
c_Data(): Xmat(1,1,0.0), dataMask(1,1,1), zTab(1,1,0.0) { Nmiss=0; };
DMatrix Xmat; // data matrix nrows x ncols
DMatrix dataMask; // 0 -> yes; 1-> no. which data values missing
// nrows/nShapelet x ncols; initialized to 1
std::vector<Bounds<> > bounds;
std::vector<double> meanVec; // mean data vector [nrows]
// only define when icMean is set
std::vector<int> masked; // 0 -> no; 1 -> yes. which vector is masked [ncols]
// replaced by Nmasked, but kept here for useTMV.cpp
std::vector<int> Nmasked; // number of data components masked in each exposure
// [ncols]; can replace masked? Yes, done.
std::vector<int> missIndex; // 0 -> missing; 1 -> non-missing (only used by
// Wiberg) [nrows*ncols];
int Nmiss; // total number of missing data components
DMatrix zTab; // defocus lookup table nrows x nzTabCol
// only define when icDefocus is set
std::vector<int> defocusID; // ID in the defocus lookup table best match
std::vector<double> defocusCoeff; // to the exposure (and the coefficient) [ncols]
// note: meanVec, defocusID, defocusCoeff are used by ROOT only, resizing is done
// where necessary. The rest should be resized by all nodes.
};
class c_ControlParam {
/* if the number of parameters in here is changed, modify N_len in the MPI datatype
definition in the main program accordingly.
*/
public:
int iverbose, // print out debugging comments: 0 -> no output; 1 -> y
icSVD, // perform PCA using SVD (=1) or not (=0); not reset by icMissing
icEM, // perform PCA using EM (=1) or not (=0)
icWiberg, // perform PCA using Wiberg algorithm (=1) or not (=0)
// this part haven't been updated; need to check missIndex()
icout, // output control: 0 -> all vectors in one file (line)
// 1 -> each vector a file
icMissing, // 0 -> no missing data; 1 -> missing some data
// SNAP stars on grid -> set by hand;
// stars random -> set to 0 then readjust in getRandStarPSF().
// It is necessary to BCAST icMissing
icMean, // 0 -> no mean subtraction; 1 -> mean subtracted
icDefocus, // remove defocus pattern before PCA (1) or not (0)
kEigen, // number of eigen vectors for reconstruction
iterMax, // maxium number of iterations for EM & Wiberg PCA
iSeed, // random number seed
icGetMat, // select routines to read in data matrix; 0 -> getMat()
// 1 -> getRandStarPSF()
readDESorSNAP, // read random stars of DES (=1) or SNAP (=2)
nrows, // data matrix is nrows x ncols; derived instead of reading in
nChips, // number of CCD chips;
// for random star runs, it is over-written by chipBound.dat
// for SNAP rect-grid tests, set this to the number of grid
// AND mc = nc = 1
mc, // number of cells along x on a single chip
nc, // number of cells along y on a single chip
nShapelet, // number of shapelet coefficients; iStartShapelet is
// hardwired in getRandStarPSF()
ncols, // number of exposures; over-written by the number of lines
// in DESpointingList
nzTabCol,// defocus table number of column
skip61;// skip ccd 61
};
class c_Result {
public:
c_Result(): reconXmat(1,1,0.0), reconErrMat(1,1,0.0), reconErrMeanPix(1,1,0.0),
reconErrMeanExp(1,1,0.0), eigenCoeffMat(1,1,0.0), Umat(1,1,0.0),
Svec(1,0.0) { };
double reconErr, // reconstruction error (avg e of all exposures)
// for non-missing data components only
reconErrMiss, // for missing data components only
reconErrTot; // for all data components
DMatrix reconXmat; // reconstruction of the data matrix nrows x ncols
DMatrix reconErrMat; // reconstruction error matrix nrows x ncols
DMatrix reconErrMeanPix; // recon error at each pixel 2 x nrows
DMatrix reconErrMeanExp; // recon error for each exposure 2 x ncols
// reconErrMean*(0,*) for non-missing data components only
// reconErrMean*(1,*) for missing data components only
DMatrix eigenCoeffMat; // SVD (U S V) eigen coeff matrix nrows x ncols
DMatrix Umat; // SVD U matrix nrows x nrows (could be large)
DVector Svec; // SVD S (diagonal) [nrows]
};
class c_inFileName {
public:
std::string inputDir,
controlParamFile,
chipBoundFile,
nameBaseSNAPpsf,
dirBaseDES,
runID_DES,
DESexpListFile,
nameBaseZtab;
};
class c_outFileName {
public:
std::string outputDir,
starRecFile,
gridXY2File,
dataMatFile,
dataMaskFile,
eigenValSVDfile,
eigenVecSVDfile,
eigenCoefSVDfile,
singularSVDfile,
reconSVDfile,
reconErrSVDfile,
reconErrPixSVDfile,
reconErrExpSVDfile,
eigenVecEMfile,
eigenCoefEMfile,
reconEMfile,
reconErrEMfile,
reconErrPixEMfile,
reconErrExpEMfile,
defocusIDfile,
defocusCoeffFile;
};
#endif