def load_file(filename): spec = s6fits.s6dataspec_t() spec.filename = filename spec.sortby_rfreq = 0 spec.sortby_time = 0 spec.sortby_bors = 0 #spec.sortby_ifreq = 0 # Setting up this mode will remove all those hits which shows change of RF due to # smart frequency switching experiment. It only reads those hits which occur maximum number of time. spec.filterby_rf_center_mode = 1 #Get hits from file s6fits.get_s6data(spec) hitnum = int(s6fits.get_hits_over_file(spec.filename)) m_rfreq = [] m_unix_time = [] m_meanpower = [] base_filename = ntpath.basename(spec.filename) start_time = spec.s6hits[0].unix_time #MARK for i in range(0,hitnum-1): for i in range(hitnum): if spec.s6hits[i].unix_time == start_time: m_rfreq.append(spec.s6hits[i].rfreq) m_unix_time.append(spec.s6hits[i].unix_time) m_meanpower.append(spec.s6hits[i].mean_power) else: break sort_rfreq_index = np.argsort(m_rfreq) sort_rfreq = np.array(m_rfreq)[sort_rfreq_index] sort_meanpower = np.array(m_meanpower)[sort_rfreq_index] return sort_meanpower, sort_rfreq, base_filename
def get_size_and_hits(filename, file_list): hits_size_file = [] spec = s6fits.s6dataspec_t() spec.filename = filename s6fits.get_s6data(spec) total_hits = 0 for hit in spec.s6hits: total_hits += 1 hits_size_file = [ filename, (os.stat(filename).st_size / (1024 * 1024)), total_hits ] file_list.append(hits_size_file) return file_list
def get_size_and_hits(filename, file_list): hits_size_file = [] spec = s6fits.s6dataspec_t() spec.filename = filename s6fits.get_s6data(spec) total_hits = 0 for hit in spec.s6hits: total_hits += 1 hits_size_file = [filename, (os.stat(filename).st_size/(1024*1024)), total_hits] file_list.append(hits_size_file) return file_list
def main(): if sys.argv is None: print "provide a valid fits file to run this" exit() """ initialize your dataspec_t object. For now you must initialize it with no arguments and fill them in subsequent lines. If you only specify filename, the program will assume you want all the hits in the file you provide. """ dataspec = s6fits.s6dataspec_t() dataspec.filename = sys.argv[1] dataspec.sortby_bors = 0 dataspec.sortby_time = 0 dataspec.sortby_ifreq = 0 dataspec.sortby_rfreq = 0 """ get_s6data() will either create a new s6fits vector, or if your dataspec includes a vector, it will add hits to it. Right now we have no vector of hits we want to add to so we'll just leave it empty. """ s6fits.get_s6data(dataspec) s6fits.print_hits_table(dataspec.s6hits)
def main(): if sys.argv is None: print "provide a valid fits file to run this" exit() """ initialize your dataspec_t object. For now you must initialize it with no arguments and fill them in subsequent lines. If you only specify filename, the program will assume you want all the hits in the file you provide. """ dataspec = s6fits.s6dataspec_t() dataspec.filename = sys.argv[1] dataspec.sortby_bors = 0 dataspec.sortby_time = 0 dataspec.sortby_ifreq = 0 dataspec.sortby_rfreq = 0 dataspec.filterby_rf_reference_mode = 1 """ get_s6data() will either create a new s6fits vector, or if your dataspec includes a vector, it will add hits to it. Right now we have no vector of hits we want to add to so we'll just leave it empty. """ s6fits.get_s6data(dataspec) s6fits.print_hits_table(dataspec.s6hits)
plt.show() end_time = time.time() print("show plot was %g seconds" % (end_time - start_time)) if __name__ == "__main__": spec = s6fits.s6dataspec_t() spec.filename = sys.argv[1] #Set various data spec spec.sortby_rfreq = 0 spec.sortby_time = 0 spec.sortby_bors = 0 spec.sortby_ifreq = 0 # Setting up this mode will remove all those hits which shows change of RF due to # smart frequency switching experiment. It only reads those hits which occur maximum number of time. spec.filterby_rf_center_mode = 1 #Get hits from file start_time = time.time() s6fits.get_s6data(spec) end_time = time.time() print("read time was %g seconds" % (end_time - start_time)) #s6fits.get_s6hitsheaders(spec) #plot_data_with_matplotlib(spec) plot_data_with_gnuplot(spec)
def s6fits_test(filename): spec = s6fits.s6dataspec_t() spec.filename = filename s6fits.get_s6data(spec)
def run_s6(filename): spec = s6fits.s6dataspec_t() spec.filename = filename s6fits.get_s6data(spec)
import s6fits a = s6fits.s6dataspec_t() a.filename = "serendip6_eth2_AO_ALFA_2820_20150609_130436.fits" s6fits.get_s6data(a) vec = a.s6hits for i in vec: print(i.ra)
import s6fits a = s6fits.s6dataspec_t() a.filename = "serendip6_eth2_AO_ALFA_2820_20150609_130436.fits" s6fits.get_s6data(a) vec = a.s6hits for i in vec: print (i.ra)