function hsi_cycle_bins,roll,phase_map_ctr,cycle_factor ;+ ; NAME: hsi_cycle_bins ; ; PURPOSE: ; Returns the width of the bins needed to extract visibilities ; ; Replaces the in-line code of hsi_calib_ev2vis.pro ; EJS Dec 16, 1999 ;- ; Find the parameters of the modulation frequency sigma=0. amp_pha=ls_sin_cos(roll,phase_map_ctr,1.0,yfit,sigma,/amp_pha) ; if keyword_set(verb) then $ ; message,'amp_pha='+string(amp_pha[0])+string(amp_pha[1]),/inform modulation_freq=amp_pha[0]*abs(sin(roll-amp_pha[1])) ; Set up cycle periods: (Needed for variable modulation binning) rmin_cycle_period=2*!pi/amp_pha[0] ;=pitch/R (radians) imin_cycle_period=rmin_cycle_period*N_elements(roll)/(max(roll)-min(roll)) ; (indices) message,'# indices per shortest cycle_period='+string(imin_cycle_period),/info c=0.75 ; The modulation freq vanishes at one angle, so we don't just invert ; it to get the period. Instead we use period=const/(const + frequency) di=fix(cycle_factor*imin_cycle_period/ $ (1.-c+c*modulation_freq/max(modulation_freq))) if (min(di) LT 3) then $ message,'Sample range LT 3, cannot determine visibilities' return,di end