0001 function d = read_arcSouthTiming(start, finish, regs, arcdir, calfile)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 if(~exist('regs'))
0015 regs=[];
0016 end
0017 if(~exist('arcdir'))
0018 arcdir=[];
0019 end
0020 if(~exist('calfile'))
0021 calfile=[];
0022 end
0023
0024 if(isempty(regs))
0025 regs={'array.frame.received'...
0026 'array.frame.utc double',...
0027 'array.frame.features',...
0028 'antenna0.roach1.LLfreq double',...
0029 'antenna0.roach1.utc double',...
0030 'antenna0.roach1.intCount double',...
0031 'antenna0.roach1.buffBacklog double',...
0032 'antenna0.roach2.buffBacklog double',...
0033 'antenna0.roach2.LLfreq double',...
0034 'antenna0.roach2.utc double',...
0035 'antenna0.roach2.intCount double',...
0036 'antenna0.roach1.switchstatus double',...
0037 'antenna0.roach2.switchstatus double',...
0038 'antenna0.thermal.utc double',...
0039 'antenna0.roach1.version double',...
0040 'antenna0.servo.fast_az_pos double',...
0041 'antenna0.servo.fast_el_pos double',...
0042 'antenna0.servo.fast_az_err double',...
0043 'antenna0.servo.fast_el_err double',...
0044 'antenna0.servo.utc double',...
0045 'antenna0.servo.utcFast double',...
0046 'antenna0.tracker.lst double',...
0047 'antenna0.tracker.lacking double',...
0048 'antenna0.tracker.equat_geoc double',...
0049 'antenna0.tracker.horiz_topo double',...
0050 'antenna0.tracker.horiz_mount double',...
0051 'antenna0.tracker.flexure double',...
0052 'antenna0.tracker.horiz_off double',...
0053 'antenna0.tracker.tilts double',...
0054 'antenna0.tracker.fixedCollimation double',...
0055 'antenna0.tracker.encoder_off double',...
0056 'antenna0.tracker.sky_xy_off double',...
0057 'antenna0.tracker.source string',...
0058 'antenna0.tracker.scan_off double',...
0059 'antenna0.tracker.refraction double',...
0060 'antenna0.tracker.ut1utc double',...
0061 'antenna0.tracker.eqneqx double',...
0062 'antenna0.tracker.utc double',...
0063 'antenna0.tracker.time_diff double',...
0064 'antenna0.tracker.offSource double',...
0065 'antenna0.tracker.siteActual double',...
0066 'antenna0.tracker.siteFiducial double',...
0067 'array.weather.airTemperature double',...
0068 'array.weather.pressure double',...
0069 'array.weather.relativeHumidity double',...
0070 'antenna0.thermal.ccTemperatureLoad double',...
0071 'antenna0.thermal.ccHeaterCurrent double',...
0072 'antenna0.thermal.lsTemperatureSensors double',...
0073 'antenna0.servo.servoSecond double',...
0074 'antenna0.servo.servouSecond double',...
0075 'antenna0.roach1.roachSample double',...
0076 'antenna0.roach2.roachSample double',...
0077 'antenna0.roach1.ntpSeconds double',...
0078 'antenna0.roach2.ntpSeconds double',...
0079 'antenna0.roach1.ntpUSeconds double',...
0080 'antenna0.roach2.ntpUSeconds double',...
0081 'antenna0.servo.ntpSecond double',...
0082 'antenna0.servo.ntpUSecond double',...
0083 'antenna0.roach1.fpgaClockStamp',...
0084 'antenna0.roach2.fpgaClockStamp',...
0085 };
0086 end
0087
0088
0089 if(any(size(unique(regs))~=size(regs)))
0090 error('read_arcSouthTiming:: regs should be unique');
0091 end
0092
0093
0094
0095 [defaultDataDir defaultCalFile defaultReaderPath] = whichHostSa();
0096
0097 if(isempty(arcdir))
0098
0099 arcdir = defaultDataDir;
0100 end
0101 if(isempty(calfile))
0102 calfile = defaultCalFile;
0103 end
0104
0105 eval(sprintf('addpath %s', defaultReaderPath));
0106
0107
0108
0109 mjdstartorig = tstr2mjd(start);
0110 mjdstart = mjdstartorig - 5/60/60/24;
0111 mjdstoporig = tstr2mjd(finish);
0112 mjdstop = mjdstoporig + 5/60/60/24;
0113
0114
0115 d = cbassMatReadArcOpt(regs, mjd2string(mjdstart), mjd2string(mjdstop), arcdir, calfile);
0116
0117
0118
0119 d = massageDataSa(d);
0120
0121
0122 d = reshapeRegisters(d);
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133 return;
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149
0150
0151
0152
0153
0154
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168
0169
0170
0171
0172
0173
0174
0175
0176
0177
0178
0179
0180
0181
0182
0183
0184
0185
0186
0187
0188
0189
0190
0191
0192
0193
0194
0195
0196
0197
0198
0199
0200
0201
0202
0203
0204
0205
0206
0207
0208
0209
0210
0211
0212
0213
0214
0215
0216
0217
0218
0219
0220
0221
0222
0223
0224
0225
0226
0227 host = strfind(w, 'aslx5');
0228 if(~isempty(host))
0229 hostNum = 7;
0230 defaultDataDir = '/home/cbassuser/cbass_data/arc';
0231 defaultCalfile = '/home/cbassuser/cbass/gcpCbass/control/conf/cbass/cal';
0232 defaultReader = '/home/cbassuser/cbass/gcpCbass/matlab/common/';
0233 end
0234
0235
0236
0237
0238
0239
0240
0241
0242
0243
0244
0245
0246
0247
0248 function d = cutDesiredData(d, mjdstartorig, mjdstoporig)
0249
0250 if(~isfield(d, 'array'))
0251 return;
0252 end
0253
0254 if(~isfield(d, 'antenna0'))
0255 return;
0256 end
0257
0258 if(issubfield(d.antenna0, 'receiver', 'utc'))
0259 indFast = d.antenna0.receiver.utc>=mjdstartorig & ...
0260 d.antenna0.receiver.utc<mjdstoporig;
0261 noRx = 0;
0262 else
0263 indFast = ones(length(d.array.frame.utc)*100,1);
0264 indFast = logical(indFast);
0265 noRx = 1;
0266 end
0267
0268 if(isfield(d.antenna0, 'servo'))
0269 indMed = d.antenna0.servo.utc>=mjdstartorig & ...
0270 d.antenna0.servo.utc<mjdstoporig;
0271 noServo = 0;
0272 else
0273 indMed = ones(length(d.array.frame.utc)*5,1);
0274 indMed = logical(indMed);
0275 noServo = 1;
0276 end
0277
0278 indSlow = d.array.frame.utc>=mjdstartorig & d.array.frame.utc<mjdstoporig;
0279
0280
0281 indF = reshape(indFast, [5 20 length(indSlow)]);
0282 indF = permute(indF, [3 1 2]);
0283 indFs = mean(mean(indF,3),2)==1;
0284
0285 indM = reshape(indMed, [5 length(indSlow)]);
0286 indM = permute(indM, [2 1]);
0287 indMs = mean(indM,2)==1;
0288
0289 ind = indMs & indFs & indSlow;
0290
0291
0292
0293
0294 d = framecut(d, ind, 'regular');
0295
0296 return;
0297