Home > Angelas_Raster_Code > plot_gfit_data2_radec.m

plot_gfit_data2_radec

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         sigmax(i,chan)=gfit{i,chan}.sigma_x;
0040         sigmay(i,chan)=gfit{i,chan}.sigma_y;
0041         theta(i,chan)=gfit{i,chan}.theta;
0042         
0043     end
0044 end
0045 fwhm_x = 2*sqrt(2*log(2)).*sigmax;
0046 fwhm_y = 2*sqrt(2*log(2)).*sigmay;
0047 %Plot the gaussian centres
0048 close all
0049 cell_size=0.05;
0050 figure
0051 subplot(2,2,1)
0052 for chan=chantofit
0053     %plot(x0(c,chan)*cell_size,'.')
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.1 0.1])
0063 grid on
0064 
0065 %figure
0066 subplot(2,2,2)
0067 for chan=chantofit
0068     %plot(y0(c,chan)*cell_size,'.')
0069     plot(y0(c,chan)*cell_size,'.')
0070     hold all
0071 end
0072 ylabel('y-offset,deg')
0073 xlabel('Raster number')
0074 legend(plot_labels(chantofit))
0075 %legend('I','Q','U','V')
0076 xlim([0 size(gfit,1)])
0077 ylim([-0.01 0.01])
0078 grid on
0079 
0080 %figure
0081 subplot(2,2,3)
0082 for chan=chantofit
0083     plot(a0(c,chan),'.')
0084     hold all
0085 end
0086 ylabel('Amplitude')
0087 xlabel('Raster number')
0088 legend(plot_labels(chantofit))
0089 %legend('I','Q','U','V')
0090 ylim([0 4])
0091 xlim([0 size(gfit,1)])
0092 
0093 subplot(2,2,4)
0094 for chan=chantofit
0095      %chan=1
0096      plot(fwhm_x(c,chan)./fwhm_y(c,chan),'.')
0097      hold all
0098 end
0099  %ylabel('FWHM x')
0100  xlabel('FWHM y')
0101  legend(plot_labels(chantofit))
0102  %legend('I','Q','U','V')
0103 ylim([0 2])
0104 xlim([0 size(gfit,1)])
0105 
0106 
0107 gtitle('Gaussian fits to each raster')
0108      plot_name = [maindir,start_date,'_',source_name,'_',IntensityType,'_gfit.png']
0109     
0110      print('-f1','-dpng',plot_name)
0111      close all
0112

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