Home > Angelas_Raster_Code > plot_gfit_data2.m

plot_gfit_data2

PURPOSE ^

% Fit 2D gaussians to all the dgood data and then plot info about them

SYNOPSIS ^

function plot_gfit_data(nchan,plot_labels,save_path,start_date,source_name,IntensityType)

DESCRIPTION ^

% Fit 2D gaussians to all the dgood data and then plot info about them

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function plot_gfit_data(nchan,plot_labels,save_path,start_date,source_name,IntensityType)
0002 %% Fit 2D gaussians to all the dgood data and then plot info about them
0003 
0004 % Read in the data file
0005 %start_date = '25-Feb-2012:21:48:12'
0006 %source_name='CygA'
0007 %save_path ='/test_fits_June2013/' % Adds this on to path of cbass_analysis
0008 [home,installeddir] = where_am_i();
0009 addpath([home,'/',installeddir,'/Angelas_Raster_Code/']);
0010 % addpath([home,'/',installeddir,'/angela_cbass/angela_beam/sim_beams/']);
0011 % addpath([home,'/',installeddir,'/angela_cbass/angela_beam/Beam_plotting/'])
0012 % addpath([home,'/',installeddir,'/angela_cbass/angela_beam/rasters/'])
0013 % addpath([home,'/',installeddir,'/angela_cbass/angela_beam/Tsys_stuff/'])
0014 % addpath([home,'/',installeddir,'/angela_cbass/angela_beam/reducs/'])
0015 maindir= [home,'/',installeddir,'/',save_path,'/'];
0016 
0017 load([maindir,start_date,'_',source_name,'_',IntensityType,'_PA_IQUV.mat'])
0018 
0019 %%
0020 
0021 % good_rasters now staored in ***_PA_IQUV.mat%
0022 % % Check in case any of the gfit cells are empty - no data fitted on that
0023 % % raster if for example all data flagged
0024 %
0025 % empty=cellfun(@isempty,gfit);
0026 % good_rasters=find(~empty(:,1))';
0027 c = good_rasters;
0028 if(nchan==9)
0029     chantofit=[1,2,3,4,5,8]
0030 else
0031     chantofit=[1,2]
0032 end
0033 
0034 for chan=chantofit;
0035     for i=good_rasters
0036         x0(i,chan)=gfit{i,chan}.x0;
0037         y0(i,chan)=gfit{i,chan}.y0;
0038         a0(i,chan)=gfit{i,chan}.a1;
0039         sigma_x(i,chan)=gfit{i,chan}.sigma_x;
0040         sigma_y(i,chan)=gfit{i,chan}.sigma_y;
0041         theta(i,chan)=gfit{i,chan}.theta;
0042         
0043         
0044     end
0045 end
0046 
0047 
0048 %Plot the gaussian centres
0049 close all
0050 cell_size=0.05;
0051 figure
0052 subplot(2,2,1)
0053 for chan=chantofit
0054     plot(x0(c,chan)*cell_size,'.')
0055     hold all
0056 end
0057 ylabel('x-offset,deg')
0058 xlabel('Raster number')
0059 legend(plot_labels(chantofit))
0060 %legend('I','Q','U','V')
0061 xlim([0 size(gfit,1)])
0062 ylim([-0.01 0.01])
0063 grid on
0064 
0065 %figure
0066 subplot(2,2,2)
0067 for chan=chantofit
0068     plot(y0(c,chan)*cell_size,'.')
0069     hold all
0070 end
0071 ylabel('y-offset,deg')
0072 xlabel('Raster number')
0073 legend(plot_labels(chantofit))
0074 %legend('I','Q','U','V')
0075 xlim([0 size(gfit,1)])
0076 ylim([-0.01 0.01])
0077 grid on
0078 
0079 %figure
0080 subplot(2,2,3)
0081 for chan=chantofit
0082     plot(a0(c,chan),'.')
0083     hold all
0084 end
0085 ylabel('Amplitude')
0086 xlabel('Raster number')
0087 legend(plot_labels(chantofit))
0088 %legend('I','Q','U','V')
0089 ylim([-1 4])
0090 xlim([0 size(gfit,1)])
0091 
0092 subplot(2,2,4)
0093 for chan=chantofit
0094     plot(rad2deg(theta(c,chan)),'.')
0095     hold all
0096 end
0097 ylabel('Angle')
0098 xlabel('Raster number')
0099 legend(plot_labels(chantofit))
0100 %legend('I','Q','U','V')
0101 %ylim([0 4])
0102 xlim([0 size(gfit,1)])
0103 grid on
0104 gtitle('Gaussian fits to each raster')
0105      plot_name = [maindir,start_date,'_',source_name,'_',IntensityType,'_gfit.png']
0106     
0107      print('-f1','-dpng',plot_name)
0108      close all
0109

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