Home > example_scripts > getDatpipelineData.m

getDatpipelineData

PURPOSE ^

This script reads in scan data and then p writes the data to fits file for the map maker using cbass_write_data.c routine

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

This script reads in scan data and then p writes the data to fits file for the map maker using cbass_write_data.c routine

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %This script reads in scan data and then p writes the data to fits file for the map maker using cbass_write_data.c routine
0002 
0003 clear
0004 nside = 128
0005 h = gov.fnal.eag.healpix.PixTools;
0006 npix= h.Nside2Npix(nside);
0007 start_scan=1; %which scan to start from
0008 
0009 %list of scans to use- check obslog to get appropriate scan
0010 
0011 
0012 time1{1}='15-May-2010:18:20:32';time2{1}='15-May-2010:23:38:52' %tauaRegio
0013 time1{2} ='16-May-2010:00:23:17';time2{2}='16-May-2010:02:51:26' %taua region
0014 time1{3}='16-May-2010:05:18:31';time2{3}= '16-May-2010:07:33:26'
0015 time1{4}='16-May-2010:08:18:58';time2{4}='16-May-2010:11:38:28'
0016 time1{5}='16-May-2010:12:17:22';time2{5}='16-May-2010:15:36:44'
0017 time1{6}='16-May-2010:15:59:37';time2{6}='16-May-2010:16:04:22'
0018 time1{7} = '16-May-2010:20:16:19';time2{7}='16-May-2010:23:37:13' %taua region
0019 time1{8}='17-May-2010:00:21:49';time2{8}='17-May-2010:03:19:26'
0020 time1{9}='17-May-2010:04:19:11';time2{9}='17-May-2010:07:17:02'
0021 time1{10}='17-May-2010:08:17:32';time2{10}='17-May-2010:11:15:30'
0022 time1{11}='17-May-2010:12:17:24';time2{11}='17-May-2010:15:15:08'
0023 time1{12} = '18-May-2010:06:21:35';time2{12} = '18-May-2010:08:17:49'
0024 time1{13} ='18-May-2010:09:11:04'; time2{13} = '18-May-2010:12:13:32'
0025 time1{14} = '18-May-2010:13:15:09';time2{14}='18-May-2010:15:55:27'
0026 time1{15} = '18-May-2010:16:09:53';time2{15}='18-May-2010:20:19:02'
0027 time1{16}='18-May-2010:21:12:38';time2{16}='19-May-2010:00:15:08'  
0028 time1{17}='19-May-2010:01:07:42';time2{17}='19-May-2010:04:10:03'    
0029 time1{18}='19-May-2010:05:09:08';time2{18}='19-May-2010:07:27:21'   
0030 time1{19}='19-May-2010:08:12:54';time2{19}='19-May-2010:11:15:16'    
0031 time1{20}='19-May-2010:12:09:27';time2{20}='19-May-2010:15:12:18'      
0032 
0033 
0034 time1{21} = '20-May-2010:23:30:21'; time2{21} = '21-May-2010:01:20:22'   
0035 time1{22} = '21-May-2010:02:05:52';time2{22} ='21-May-2010:05:10:07'   
0036 time1{23} ='21-May-2010:06:01:41';time2{23}='21-May-2010:09:06:02'   
0037 time1{24}= '21-May-2010:09:59:43';time2{24}='21-May-2010:13:04:00'    
0038 time1{25} = '21-May-2010:13:57:04';time2{25}='21-May-2010:14:02:58'    
0039 time1{26} = '21-May-2010:23:30:42';time2{26}='22-May-2010:00:02:21'    
0040 time1{27}= '22-May-2010:00:54:59';time2{27}='22-May-2010:03:59:11'    
0041 time1{28}='22-May-2010:04:58:15'; time2{28}='22-May-2010:08:02:38'   
0042 time1{29}='22-May-2010:08:55:54';time2{29}='22-May-2010:12:00:11'   
0043 time1{30}='22-May-2010:12:54:16'; time2{30}='22-May-2010:16:58:07'   
0044 time1{31}='22-May-2010:17:59:47'; time2{31}='22-May-2010:21:03:59'   
0045 time1{32}='22-May-2010:21:56:34'; time2{32}='23-May-2010:01:00:49'    
0046 time1{33}='23-May-2010:01:53:37'; time2{33}='23-May-2010:04:57:33'    
0047 time1{34}='23-May-2010:05:55:59'; time2{34}='23-May-2010:09:00:36'    
0048 time1{35}='23-May-2010:09:54:10';time2{35}='23-May-2010:12:58:23'    
0049 time1{36}='23-May-2010:13:51:28'; time2{36}='23-May-2010:13:57:20'   
0050 time1{37}='24-May-2010:03:33:24';time2{37}='24-May-2010:03:33:34'    
0051 time1{38}='24-May-2010:03:33:34'; time2{38}='24-May-2010:03:33:37'    
0052 time1{39}='24-May-2010:04:18:12'; time2{39}='24-May-2010:06:56:59'      
0053 time1{40}='24-May-2010:07:50:02'; time2{40}='24-May-2010:10:54:01'      
0054 time1{41}='24-May-2010:11:48:01';time2{41}='24-May-2010:14:52:40'      
0055 time1{42}='24-May-2010:16:56:34';time2{42}='24-May-2010:16:56:45'      
0056 
0057 
0058 
0059 
0060 numscans=42
0061 i=0;
0062 n=0;
0063 
0064 [r, home] = unix('printenv HOME');
0065 
0066 
0067 if ~strcmp(home(1:5),'/home')
0068   %case where you get tcsh shell error
0069    startpt=find(home=='/');
0070    home=home(startpt(1):end-1);
0071    clear startpt
0072 else
0073    home=home(1:end-1);
0074 end
0075 
0076 
0077 i=start_scan
0078 unix(['mkdir ','/data/cbassuser/data/scanfits/skymap/']);
0079 while i<=numscans
0080     fits{i} = (['/data/cbassuser/data/scanfits/skymap/skymap',num2str(80+i-1),'.fits']);
0081    % fits2{i} = ([home,'/cbass_analysis/fits_files/atestcumulative',num2str(80+i-1),'.fits']);
0082     %unix(['rm ',fits{i}]);
0083   %  unix(['rm ',fits2{i}]);
0084     
0085     i=i+1;
0086     
0087 end
0088 
0089 
0090 for i=start_scan:numscans
0091     
0092     try
0093         d=pipe_read(time1{i},time2{i});
0094         disp(['Recording the fits file: ',fits{i}])
0095         disp(['Time Start: ',time1{i},' Time End: ',time2{i}]);
0096         disp(['Total Reduction Run from ',time1{1},' to ',time2{length(time2)}]);
0097         d=pipelinedData(d)
0098         unix(['rm ',fits{i}]);
0099         start_time = datenum(time1{i},'dd-mmm-yyyy:hh:MM:ss');
0100         end_time = datenum(time1{i},'dd-mmm-yyyy:hh:MM:ss');
0101         start_batch_scan = datenum(time1{1},'dd-mmm-yyyy:hh:MM:ss');
0102         end_batch_scan = datenum(time2{length(time2)},'dd-mmm-yyyy:hh:MM:ss');
0103         [y_start,m_start,d_start,h_start,mi_start,s_start] = datevec(start_time);
0104         [y_end,m_end,d_end,h_end,mi_end,s_end] = datevec(end_time);
0105         [y_start_batch,m_start_batch,d_start_batch,h_start_batch,mi_start_batch,s_start_batch] = datevec(start_batch_scan);
0106         [y_end_batch,m_end_batch,d_end_batch,h_end_batch,mi_end_batch,s_end_batch] = datevec(end_batch_scan);
0107         start_time_mjd = date2mjd(y_start,m_start,d_start,h_start,mi_start,s_start);
0108         end_time_mjd = date2mjd(y_end,m_end,d_end,h_end,mi_end,s_end);
0109         start_time_batch_mjd = date2mjd(y_start_batch,m_start_batch,d_start_batch,h_start_batch,mi_start_batch,s_start_batch);
0110         end_time_batch_mjd = date2mjd(y_end_batch,m_end_batch,d_end_batch,h_end_batch,mi_end_batch,s_end_batch);
0111         
0112         cbass_write_data(fits{i},[d.antenna0.receiver.utc-start_time_mjd d.antenna0.servo.equa(:,1:2) d.antenna0.servo.apparent(:,1:2) d.antenna0.receiver.dataTcorr],0,0,start_time_mjd,end_time_mjd,i,numscans,start_time_batch_mjd,end_time_batch_mjd )
0113         %cbass_write_image(fits{i},d.antenna0.writeHealpixDat,nside,npix,time1{1},time2{length(time2)});
0114     catch
0115         disp('Error in data')
0116     end
0117     
0118 end
0119     
0120 
0121

Generated on Sun 14-Jun-2015 17:12:45 by m2html © 2005