diff --git a/fhd_core/gridding/vis_model_freq_split.pro b/fhd_core/gridding/vis_model_freq_split.pro index 9ec38fbb..3c0760f8 100644 --- a/fhd_core/gridding/vis_model_freq_split.pro +++ b/fhd_core/gridding/vis_model_freq_split.pro @@ -3,18 +3,23 @@ FUNCTION vis_model_freq_split,obs,status_str,psf,params,vis_weights,model_uv_arr file_path_fhd=file_path_fhd,rephase_weights=rephase_weights,silent=silent,$ vis_n_arr=vis_n_arr,x_range=x_range,y_range=y_range,preserve_visibilities=preserve_visibilities,$ obs_out=obs_out,psf_out=psf_out,save_uvf=save_uvf, uvf_name=uvf_name,bi_use=bi_use,_Extra=extra - ext='.UVFITS' + t0=Systime(1) IF N_Elements(silent) EQ 0 THEN silent=0 pol_names=obs.pol_names - vis_filepath=file_path_fhd+'_vis_' if keyword_set(save_uvf) then begin - if n_elements(uvf_name) ne 0 then uvf_filepath = file_path_fhd+'_'+uvf_name+'_gridded_uvf.sav' $ - else uvf_filepath = file_path_fhd+'_gridded_uvf.sav' + folder_use = file_dirname(file_path_fhd) + folder_use += path_sep() + "grid_data" + path_sep() + basename = file_basename(file_path_fhd) + if n_elements(uvf_name) ne 0 then begin + uvf_filepath = folder_use + basename + '_' + uvf_name + '_gridded_uvf_' + pol_names + '.sav' + endif else begin + uvf_filepath = folder_use + basename + '_gridded_uvf_' + pol_names + '.sav' + endelse endif - + n_freq=obs.n_freq n_pol=obs.n_pol dimension=obs.dimension @@ -71,13 +76,6 @@ FUNCTION vis_model_freq_split,obs,status_str,psf,params,vis_weights,model_uv_arr ENDIF ELSE obs_out=obs IF N_Elements(psf_out) EQ 0 THEN psf_out=psf - if keyword_set(save_uvf) then begin - dirty_uv_arr=Ptrarr(n_pol,nf,/allocate) - weights_uv_arr=Ptrarr(n_pol,nf,/allocate) - variance_uv_arr=Ptrarr(n_pol,nf,/allocate) - IF Keyword_Set(model_flag) THEN model_uv_arr=Ptrarr(n_pol,nf,/allocate) - endif - dirty_arr=Ptrarr(n_pol,nf,/allocate) weights_arr=Ptrarr(n_pol,nf,/allocate) variance_arr=Ptrarr(n_pol,nf,/allocate) @@ -97,6 +95,21 @@ FUNCTION vis_model_freq_split,obs,status_str,psf,params,vis_weights,model_uv_arr model_ptr=vis_model_arr[pol_i] freq_use=(*obs_out.baseline_info).freq_use n_vis_use=0. + + if keyword_set(save_uvf) then begin + if obs.double_precision then begin + dirty_uv_arr=dcomplexarr(dimension, dimension, nf) + weights_uv_arr=dcomplexarr(dimension, dimension, nf) + variance_uv_arr=dcomplexarr(dimension, dimension, nf) + IF Keyword_Set(model_flag) THEN model_uv_arr=dcomplexarr(dimension, dimension, nf) + endif else begin + dirty_uv_arr=complexarr(dimension, dimension, nf) + weights_uv_arr=complexarr(dimension, dimension, nf) + variance_uv_arr=complexarr(dimension, dimension, nf) + IF Keyword_Set(model_flag) THEN model_uv_arr=complexarr(dimension, dimension, nf) + endelse + endif + FOR fi=0L,nf-1 DO BEGIN fi_use=where((freq_bin_i2 EQ fi) AND (freq_use GT 0),nf_use) variance_holo=1 ;initialize @@ -116,12 +129,12 @@ FUNCTION vis_model_freq_split,obs,status_str,psf,params,vis_weights,model_uv_arr vis_n_arr[pol_i,fi]=n_vis if keyword_set(save_uvf) then begin - *dirty_uv_arr[pol_i,fi]=dirty_uv*n_vis - *weights_uv_arr[pol_i,fi]=weights_holo*rephase_use*n_vis - *variance_uv_arr[pol_i,fi]=variance_holo*rephase_use*n_vis - IF Keyword_Set(model_flag) THEN *model_uv_arr[pol_i,fi]=model_return*n_vis + dirty_uv_arr[*, *, fi]=dirty_uv*n_vis + weights_uv_arr[*, *, fi]=weights_holo*rephase_use*n_vis + variance_uv_arr[*, *, fi]=variance_holo*rephase_use*n_vis + IF Keyword_Set(model_flag) THEN model_uv_arr[*, *, fi]=model_return*n_vis endif - + IF Keyword_Set(fft) THEN BEGIN IF N_Elements(x_range)dimension by Nelements (where dimension and elements are FHD keywords). Each pixel value is how many visibilities contributed to that pixel, which is the same as our in-house uniform weighting. (!Q right?) +### \\_\\_gridded_uvf_\.sav
+Gridded uvf cubes, alternative input to eppsilon. Saved only if keyword `save_uvf` is set. + ## HEALPix
-### \\_even_cube\.sav / \_even_cube\.sav
+### \\_\_cube\.sav * **variance_cube/weights_cube**: an array of HEALPix pixels organized by hpx_inds for each output frequency. This is an image cube of 1's gridded with the beam for all visibilities (weights) or 1's gridded with the beam squared for all visibilities (variances). @@ -371,12 +374,6 @@ Residual image with the subtracted sources over-plotted. Each source is plotted ### \\_\\_UV_weights_\.png
-## UVF Cubes
-Saved only if keyword `save_uvf` is set. - -### \\_even_gridded_uvf.sav
- -### \\_odd_gridded_uvf.sav
## Vis Data