# June 27, 2014 # ------------- docheck = True dotable = True # read in information on blanking times fft_vegas = genfromtxt('fftrates_v2.csv',delimiter=',',names=True) # fiducial blanking times for frequency switch and doppler update fs_blank = 0.016 #s doppler_blank = 0.038 #s ## No Doppler Tracking Case ## ------------------------ # the fastest that vegas can integrate is the hw exposure. This # assumes that there is no blanking. minint_vegas = fft_vegas['hwexpo_act'] / 1000.0 # ms -> s minblank_vegas = fft_vegas['min_blank'] / 1000.0 # ms -> s minstate_vegas = fft_vegas['min_state'] / 1000.0, # ms -> s # the fatest that vegas can switch. There are two phases per total power with cal switch and four phases for the frequency switch. # When you turn on switching you turn on blanking which is why we are using min_state instead of hwexpo_act minint_vegas_tpnocal = 1.0 * fft_vegas['min_state'] / 1000.0 minint_vegas_tp = 2.0 * fft_vegas['min_state'] / 1000.0 minint_vegas_fs = 4.0 * fft_vegas['min_state'] / 1000.0 minint_vegas_fsnocal = 2.0 * fft_vegas['min_state'] / 1000.0 # this is the minimum blanking time for vegas. minblank_vegas_tp = 2.0 * fft_vegas['min_blank'] / 1000.0 # ms -> s minblank_vegas_fs = 4.0 * fft_vegas['min_blank'] / 1000.0 # ms -> s minblank_vegas_fsnocal = 2.0 * fft_vegas['min_blank'] / 1000.0 # blanking time for each blank_time_tp = minblank_vegas_tp blank_time_fs = 2.0 * (fs_blank + fft_vegas['min_blank']/1000.0) # blankings overlap, not add blank_time_fsnocal = 2.0 * fs_blank # take whatever is the maximum blanking time and set it to the blanking time vegas_blank_tp = minblank_vegas_tp.copy() vegas_blank_fs = minblank_vegas_fs.copy() vegas_blank_fsnocal = minblank_vegas_fsnocal.copy() vegas_blank_tp[blank_time_tp > minblank_vegas_tp] = blank_time_tp[blank_time_tp > minblank_vegas_tp] vegas_blank_fs[blank_time_fs > minblank_vegas_fs] = blank_time_fs[blank_time_fs > minblank_vegas_fs] vegas_blank_fsnocal[blank_time_fsnocal > minblank_vegas_fsnocal]= blank_time_fsnocal # to have less than 10% blanked. ignoring doppler tracking for how minint_vegas_tpnocal_nodop = minint_vegas.copy() minint_vegas_tp_nodop = 10.0 * vegas_blank_tp minint_vegas_fs_nodop = 10.0 * vegas_blank_fs minint_vegas_fsnocal_nodop = 10.0 * vegas_blank_fsnocal # if the minimum integration time for less than 10% blanked is greater than # the minimum integration time for VEGAS set the minimum integration time to the larger doppler tracked number. # This is all true because the blanking is set earlier so that minint_vegas_tp_nodop > minint_vegas_tp minint_vegas_tpnocal_track_nodop = minint_vegas_tpnocal_nodop.copy() minint_vegas_tp_track_nodop = minint_vegas_tp.copy() minint_vegas_tp_track_nodop[minint_vegas_tp_nodop > minint_vegas_tp] = minint_vegas_tp_nodop[minint_vegas_tp_nodop > minint_vegas_tp] minint_vegas_fs_track_nodop = minint_vegas_fs.copy() minint_vegas_fs_track_nodop[minint_vegas_fs_nodop > minint_vegas_fs] = minint_vegas_fs_nodop[minint_vegas_fs_nodop > minint_vegas_fs] minint_vegas_fsnocal_track_nodop = minint_vegas_fsnocal.copy() minint_vegas_fsnocal_track_nodop[minint_vegas_fsnocal_nodop > minint_vegas_fsnocal] = minint_vegas_fsnocal_nodop[minint_vegas_fsnocal_nodop > minint_vegas_fsnocal] ## Check times if docheck: for i in range(len(minint_vegas)): print i+1, minblank_vegas_tp[i],vegas_blank_tp[i], minint_vegas_tp_track_nodop[i],minblank_vegas_fs[i], vegas_blank_fs[i],minint_vegas_fs_track_nodop[i] ## Doppler Tracking Case ## ---------------------- # a) mapping res_vegas = fft_vegas['chan_bw'] /1000.0 v_frame_lsr = 33.4 # km/s. LSR ~ Bary in this case for the maximum # deviation so I don't have to worry about the two # cases. minres_vegas_mapping_lsr = (1/16.0) * v_frame_lsr # I'm changing up a little bit how to calculate the blanking times # here. I'm going to extend the integration time if the first phase is # more than 10% blanked. minblank_vegas_tpnocal_mapping = zeros(len(minblank_vegas)) minblank_vegas_tp_mapping = minblank_vegas.copy() minblank_vegas_fsnocal_mapping = minblank_vegas.copy() minblank_vegas_fs_mapping = minblank_vegas.copy() vegas_blank_tpnocal_mapping = minblank_vegas_tpnocal_mapping.copy() vegas_blank_tp_mapping = minblank_vegas_tp_mapping.copy() vegas_blank_fsnocal_mapping = minblank_vegas_fsnocal_mapping.copy() vegas_blank_fs_mapping = minblank_vegas_fs_mapping.copy() vegas_blank_tpnocal_mapping[minint_vegas_tp > 0.5] = minblank_vegas_tpnocal_mapping[minint_vegas_tp > 0.5] + doppler_blank # otherwise the doppler blanking is zero vegas_blank_tp_mapping[minint_vegas_tp > 0.5] = doppler_blank + 2.0 * minblank_vegas_tp_mapping[minint_vegas_tp > 0.5] # Because the doppler blanking can occur anywhere vegas_blank_tp_mapping[minint_vegas_tp < 0.5] = 2.0 * minblank_vegas_tp_mapping[minint_vegas_tp < 0.5] # Because the doppler blanking can occur anywhere vegas_blank_fsnocal_mapping[fs_blank > minblank_vegas_fsnocal_mapping] = fs_blank vegas_blank_fs_mapping[fs_blank > minblank_vegas_fs_mapping] = fs_blank vegas_blank_fsnocal_mapping[doppler_blank > vegas_blank_fsnocal_mapping] = doppler_blank vegas_blank_fs_mapping[doppler_blank > vegas_blank_fs_mapping] = doppler_blank # I think I want less than 10% of the first state blanked. That should give plenty of leeway. minint_vegas_tpnocal_dop = (10.0 * vegas_blank_tpnocal_mapping) * 1.0 # 1 state minint_vegas_tp_dop = (10.0 * vegas_blank_tp_mapping) # don't need to multiply by two here because I'm calculating the total possible blanking above. minint_vegas_fsnocal_dop = (10.0 * vegas_blank_fsnocal_mapping) * 2.0 # 2 states minint_vegas_fs_dop = (10.0 * vegas_blank_fs_mapping) * 4.0 # 4 states minint_vegas_tpnocal_mapping_lsr = minint_vegas_tpnocal_track_nodop.copy() minint_vegas_tpnocal_mapping_lsr[res_vegas < minres_vegas_mapping_lsr] = minint_vegas_tpnocal_dop[res_vegas < minres_vegas_mapping_lsr] minint_vegas_tpnocal_mapping_lsr[minint_vegas_tpnocal_mapping_lsr < minint_vegas_tpnocal] = minint_vegas_tpnocal[minint_vegas_tpnocal_mapping_lsr < minint_vegas_tpnocal] minint_vegas_tp_mapping_lsr = minint_vegas_tp_track_nodop.copy() minint_vegas_tp_mapping_lsr[res_vegas < minres_vegas_mapping_lsr] = minint_vegas_tp_dop[res_vegas < minres_vegas_mapping_lsr] minint_vegas_fsnocal_mapping_lsr = minint_vegas_fsnocal_track_nodop.copy() minint_vegas_fsnocal_mapping_lsr[res_vegas < minres_vegas_mapping_lsr] = minint_vegas_fsnocal_dop[res_vegas < minres_vegas_mapping_lsr] minint_vegas_fs_mapping_lsr = minint_vegas_fs_track_nodop.copy() minint_vegas_fs_mapping_lsr[res_vegas < minres_vegas_mapping_lsr] = minint_vegas_fs_dop[res_vegas < minres_vegas_mapping_lsr] if docheck: print minres_vegas_mapping_lsr print doppler_blank for i in range(len(res_vegas)): print i+1, res_vegas[i], (res_vegas < minres_vegas_mapping_lsr)[i], minint_vegas_tp_track_nodop[i], minint_vegas_tp_mapping_lsr[i] for i in range(len(res_vegas)): print i+1, res_vegas[i], (res_vegas < minres_vegas_mapping_lsr)[i], vegas_blank_tp_mapping[i], minint_vegas_tp_track_nodop[i], minint_vegas_tp_mapping_lsr[i] # b) Pointing c = 3e5 # km/s v_frame_geo = 0.5 #km/s freq_tswper = res_vegas * 1e3 * c / ( 100.0 * v_frame_geo * 1.45e-4) / 1e9 # GHz * s break_freq_tpnocal = freq_tswper / minint_vegas_tpnocal_nodop break_freq_tp = freq_tswper / minint_vegas_tp_nodop break_freq_fsnocal = freq_tswper /minint_vegas_fsnocal_nodop break_freq_fs = freq_tswper / minint_vegas_fs_nodop minint_vegas_tpnocal_track_doppler = minint_vegas_tpnocal_dop.copy() minint_vegas_tpnocal_track_doppler[minint_vegas_tpnocal_track_doppler < minint_vegas_tpnocal_nodop] = minint_vegas_tpnocal_nodop[minint_vegas_tpnocal_track_doppler < minint_vegas_tpnocal_nodop] minint_vegas_tp_track_doppler = minint_vegas_tp_dop.copy() minint_vegas_fsnocal_track_doppler = minint_vegas_fsnocal_dop.copy() minint_vegas_fs_track_doppler = minint_vegas_fs_dop.copy() ## Write out tables if requested. if dotable: ## VEGAS properties f = file('vegas_properties.tex',mode='w') header = """ \\begin{table} \\centering \\scriptsize \\caption{VEGAS Hardware Parameters} \\label{tab:vegas_hardware} \\begin{tabular}{|c|c|c|c|c|} \\hline Mode & Spectral & Hardware & Minimum Blank Time & Minimum \\\\ & Resolution & Exposure & per State & State Time \\\\ & (kHz) & (s) & (s) & (s) \\\\ (1) & (2) & (3) & (4) & (5) \\\\ \\hline """ f.write(header) for i in range(len(minint_vegas)): f.write( str(i+1) + ' & ' + str('{:7.4f}').format(res_vegas[i]) + ' & ' + str('{:7.4f}').format(fft_vegas['hwexpo_act'][i]/1000.0) + ' & ' + str('{:7.4f}').format(fft_vegas['min_blank'][i]/1000.0) + ' & ' + str('{:7.4f}').format(fft_vegas['min_state'][i]/1000.0) + ' \\\\ \n' ) footer = """ \\hline \\end{tabular} \\\\ [1.2em] {\\flushleft Col (1): VEGAS mode Col (2): Spectral resolution of mode. Col (3): Hardware exposure time. This time is the fastest that VEGAS can produce data. Producing data this quickly is only possible when not doing any switching. Col (4): Blanking time per switching state. Note that in some cases the blanking time is a significant fraction of the minimum state time. Col (5): Minimum time per switching state including the minimum blanking time. } \\end{table} """ f.write(footer) f.close() ## blanking times without doppler tracking f = file('blanking_table_nodop.tex',mode='w') header = """ \\begin{table} \\centering \\scriptsize \\caption{Minimum Recommended Switching Periods for Observations Without Doppler Tracking} \\label{tab:minint_nodop} \\begin{tabular}{|c|cc|cc|} \\hline & Total Power & Total Power & Frequency Switched & Frequency Switched \\\\ & No Noise Diode & Noise Diode & No Noise Diode & Noise Diode \\\\ \\hline & \\verb+tp_nocal+ & \\verb+tp+ & \\verb+sp_nocal+ & \\verb+sp+ \\\\ \\hline Mode & (s) & (s) & (s) & (s) \\\\ \\hline (1) & (2) & (3) & (4) & (5) \\\\ \\hline """ f.write(header) for i in range(len(minint_vegas)): f.write( str(i+1) + ' & ' + str('{:7.4f}').format(minint_vegas_tpnocal_track_nodop[i]) + ' & ' + str('{:7.4f}').format(minint_vegas_tp_track_nodop[i]) + ' & ' + str('{:7.4f}').format(minint_vegas_fsnocal_track_nodop[i]) +' & ' + str('{:7.4f}').format(minint_vegas_fs_track_nodop[i]) +' \\\\ \n' ) footer = """ \\hline \\end{tabular} \\\\ [1.2em] {\\flushleft Col (1): VEGAS mode Col (2): Recommended minimum switching period for total power observations without the noise diode (\\verb+tp_nocal+) and without Doppler tracking. This value is equivalent to the hardware exposure value for VEGAS. Col (3): Recommmended minimum switching period (\\verb+swper+) for total power observations with the noise diode (\\verb+tp+) and without Doppler tracking. This switching period will result in less than 10\% of your data being blanked. Col (4): Recommended minimum switching period (\\verb+swper+) for frequency switched observations without the noise diode (\\verb+sp_nocal+) and without Doppler tracking. This switching period will result in less than 10\% of your data being blanked. Col (5): Recommended minimum switching period (\\verb+swper+) for frequency switched observations with the noise diode (\\verb+sp+) and without Doppler tracking. This switching period will result in less than 10\% of your data being blanked. } \\end{table} """ f.write(footer) ## Mapping Blanking times with Doppler Tracking f.close() f = file('blanking_table_dop_mapping.tex',mode='w') header = """ \\begin{table} \\centering \\scriptsize \\caption{Minimum Recommended Switching Periods for Mapping Observations with Doppler Tracking} \\label{tab:minint_dop_mapping} \\begin{tabular}{|c|cc|cc|} \\hline & Total Power & Total Power & Frequency Switched & Frequency Switched \\\\ & No Noise Diode & Noise Diode & No Noise Diode & Noise Diode \\\\ \\hline & \\verb+tp_nocal+ & \\verb+tp+ & \\verb+sp_nocal+ & \\verb+sp+ \\\\ \\hline Mode & (s) & (s) & (s) & (s) \\\\ \\hline (1) & (2) & (3) & (4) & (5) \\\\ \\hline """ f.write(header) for i in range(len(minint_vegas)): f.write( str(i+1) + ' & ' + str('{:7.4f}').format(minint_vegas_tpnocal_mapping_lsr[i]) + ' & ' + str('{:7.4f}').format(minint_vegas_tp_mapping_lsr[i]) + ' & ' + str('{:7.4f}').format(minint_vegas_fsnocal_mapping_lsr[i]) + ' & ' + str('{:7.4f}').format(minint_vegas_fs_mapping_lsr[i]) + ' \\\\ \n ' ) footer = """ \\hline \\end{tabular} \\\\ [1.2em] {\\flushleft Col (1): VEGAS mode Col (2): Recommended minimum switching period (\\verb+swper+) for Doppler-tracked, total power on-the-fly maps with no noise diode (\\verb+tp_nocal+). These values will yield less than 10\\% blanking overall. These values assume that the maps are sampled at twice Nyquist in the scanning direction and that there are four integrations per switching period. Col (3): Recommmended minimum switching period (\\verb+swper+) for Doppler-tracked, total power on-the-fly maps with the noise diode (\\verb+tp+). These values will yield less than 10\\% blanking overall. These values assume that the maps are sampled at twice Nyquist in the scanning direction and that there are four integrations per switching period. Col (4): Recommended minimum switching period (\\verb+swper+) for Doppler-tracked, frequency switch observations with the noise diode turned off (\\verb+sp_nocal+). These values will yield less than 10\\% blanking in the first state of the switching cycle as well as less than 10\\% blanking overall. This switching period will result in less than 10\% of your data being blanked. These values assume that the maps are sampled at twice Nyquist in the scanning direction and that there are four integrations per switching period. Col (5): Recommended minimum switching period (\\verb+swper+) for Doppler-tracked, frequency switch observations with the noise diode turned on (\\verb+sp+). These values will yield less than 10\\% blanking in the first state of the switching cycle as well as less than 10\\% blanking overall. These values assume that the maps are sampled at twice Nyquist in the scanning direction and that there are four integrations per switching period. } \\end{table} """ f.write(footer) f.close() ## Pointed Blanking times with Doppler Tracking f.close() f = file('blanking_table_dop_point.tex',mode='w') header = """ \\begin{table} \\centering \\scriptsize \\caption{Minimum Recommended Switching Periods for Pointed Observations with Doppler Tracking} \\label{tab:minint_dop_point} \\begin{tabular}{|c|cc|cc|cc|cc|} \\hline & \multicolumn{2}{|c|}{Total Power} & \multicolumn{2}{|c|}{Total Power} & \multicolumn{2}{|c|}{Frequency Switched} & \multicolumn{2}{|c|}{Frequency Switched} \\\\ & \multicolumn{2}{|c|}{No Noise Diode} & \multicolumn{2}{|c|}{Noise Diode} & \multicolumn{2}{|c|}{No Noise Diode} & \multicolumn{2}{|c|}{Noise Diode} \\\\ \\hline & \multicolumn{2}{|c|}{\\tpnocal} & \multicolumn{2}{|c|}{\\tp} & \multicolumn{2}{|c|}{\\spnocal} & \multicolumn{2}{|c|}{\\sp} \\\\ \\hline & $\\nu_{min}$ & swper & $\\nu_{min}$ & swper & $\\nu_{min}$ & swper & $\\nu_{min}$ & swper \\\\ \\hline Mode & GHz & (s) & GHz & (s) & GHz & (s) & GHz & (s) \\\\ \\hline (1) & (2) & (3) & (4) & (5) & (6) & (7) & (8) & (9) \\\\ \\hline """ f.write(header) for i in range(len(minint_vegas)): if break_freq_tpnocal[i] > 115: break_freq_tpnocal_str = "$> 115$" else: break_freq_tpnocal_str = str('{:5.1f}').format(break_freq_tpnocal[i]) if break_freq_tp[i] > 115: break_freq_tp_str = "$> 115$" else: break_freq_tp_str = str('{:5.1f}').format(break_freq_tp[i]) if break_freq_fsnocal[i] > 115: break_freq_fsnocal_str = "$> 115$" else: break_freq_fsnocal_str = str('{:5.1f}').format(break_freq_fsnocal[i]) if break_freq_fs[i] > 115: break_freq_fs_str = "$> 115$" else: break_freq_fs_str = str('{:5.1f}').format(break_freq_fs[i]) f.write( str(i+1) + ' & ' + break_freq_tpnocal_str + ' & ' + str('{:7.4f}').format(minint_vegas_tpnocal_track_doppler[i]) + ' & ' + break_freq_tp_str + ' & ' + str('{:7.4f}').format(minint_vegas_tp_track_doppler[i]) + ' & ' + break_freq_tp_str + ' & ' + str('{:7.4f}').format(minint_vegas_fsnocal_track_doppler[i]) + ' & ' + break_freq_fs_str + ' & ' + str('{:7.4f}').format(minint_vegas_fs_track_doppler[i]) + ' \\\\ \n' ) footer = """ \\hline \\end{tabular} \\\\ [1.2em] {\\flushleft Col (1): VEGAS mode Col (2, 4, 6, 8): Frequency above which you should use the minimum recommended switching period values in this table. Below this the values in Table~\\ref{tab:minint_nodop} are appropriate. Col (3): Recommended minimum switching period for pointed, Doppler-tracked, total power observations without the noise diode (\\verb+tp_nocal+). These values will yield less than 10\\% blanking overall. Col (5): Recommended minimum switching period for pointed, Doppler-tracked, total power observations with the noise diode (\\verb+tp+). These values will yield less than 10\\% blanking overall. Col (7): Recommended minimum switching period for pointed, Doppler-tracked, frequency-switched observations without the noise diode (\\verb+sp_nocal+). These values will yield less than 10\\% blanking in the first state of the switching cycle as well as less than 10\\% blanking overall. Col (9): Recommended minimum switching period for pointed, Doppler-tracked, frequency-switched observations with the noise diode (\\verb+sp+). These values will yield less than 10\\% blanking in the first state of the switching cycle as well as less than 10\\% blanking overall. } \\end{table} """ f.write(footer) f.close()